A problem with the patch utility and windows paths.

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Fri Sep 30 15:05:00 GMT 2005


On Fri, Sep 30, 2005 at 08:23:56AM -0600, Bob Rundle wrote:
>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:
>
>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.
>
>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.

If you're attempting to have patch interpret the paths in the patch file
then, as Eric said, you need to specify the "-p" option.  In the above
case, specifying "patch -p0 <1.tm" will cause old/file to be patched.
This is the case on both linux and cygwin.

cgf

--
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/



More information about the Cygwin mailing list