This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: A problem with the patch utility and windows paths.


Ugh, top-posting...  Reformatted.

On Fri, 30 Sep 2005, Bob Rundle wrote:

> > -----Original Message-----
> > From: Eric Blake [mailto:ebb9@XXX.XXX]
> > Sent: Thursday, September 29, 2005 9:40 PM
> > To: Bob Rundle
> > Cc: cygwin@XXXXXX.XXX

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > Subject: Re: A problem with the patch utility and windows paths.
> >
> > According to Bob Rundle on 9/29/2005 8:27 AM:
> > > Greetings,
> > >
> > > I've having a few issues with the patch utility.  It is not working
> > > with windows paths.  I am using Windows XP and the latest cygwin
> > > patch.  Any help is appreciated.  Attached is the cygcheck file.
> > >
> > > If I have two directories "oldversion" and "newversion"
> > >
> > > $ diff -u oldversion newversion >1.tm
> > > $ patch <1.tm
> >
> > What error message are you getting that you think is not right?  Did
> > you use the -p option?  We need a reproducible test case.  Also, it
> > may help to follow these directions:
> >
> > > Problem reports:       http://cygwin.com/problems.html
>
> Here is a reproducible script
>
> $ mkdir old
> $ mkdir new
> $ cat >old/file
> Line1
> Asdf
> Line2
> ^D
> $ cat >new/file
> Line1
> Fdsa
> Line2
> ^D
> $ diff -u old new >1.tm
> $ patch <1.tm
>
> The last command gives the error
>
> can't find file to patch at input line 4
> Perhaps you should have used the -p or --strip option?
> The text leading up to this was:
> --------------------------
> |diff -u old/file new/file
> |--- old/file   2005-09-30 08:15:00.796875000 -0600
> |+++ new/file   2005-09-30 08:16:18.796875000 -0600
> --------------------------
> File to patch:

You need to use "patch -p0 <1.tm".

> If then you simply enter old/file at the prompt, then patch works.
> This is a clear indication that there is a problem with the tool's
> interpretation of a windows path.

Umm, where exactly did you find a Windows path in the above text?

> This is not a case of "I don't know how patch works."  I have been using
> patch for a long time.  It is simply not working.

It is indeed the case of not knowing how patch works.  The "patch" manpage
describes the rules patch uses to extract filenames from the diff.  In
particular, it uses the -p option to help guide it in extracting the
filenames containing slashes.  The only case when you don't need -p is
when the file being patched is in the current directory.

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]