Subject: Re: patch problem with forward/backward slashes in patch file
From: Christopher Faylor <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 7 Mar 2001 11:15:25 -0500

On Wed, Mar 07, 2001 at 12:19:29AM -0800, David Rees wrote:
>First of all the "-d ." in my call is redundant. I had been using it
>for testing, but feel free to ignore it in tracking down the problem.
>
>Also, as I hope I implied (but didn't say) in my previous email,
>altering the diff file to use backward slashes as follows also causes
>patch to run fine:
>|--- src\testcases\org\apache\tools\ant\taskdefs\ZipTest.java   2001/03/02 16:01:01     1.3
>|+++ src\testcases\org\apache\tools\ant\taskdefs\ZipTest.java   2001/03/07 00:11:39

Yeah, you've changed the paths into a format that patch doesn't really
understand, so it just applies the patch to the current directory.
Patch has no idea that '\' is a directory separator.  On Unix, it's a
valid filename character.  However, when this "filename" reaches the
Windows API layour, Windows will translate it into a relative path so
things will "work".

>All this said, using "-p0" or "-p" solves the problem. However, from
>my understanding, patch should do -p0 by default since its a relative
>directory. So what I think seems to be happening is that patch doesn't
>recognize a relative path inside a patch file as relative if it uses
>forward slashes.

Your understanding is incorrect.  Patch does not default to -p0 by
default.  Not supplying -pN on the command line is a common cockpit
error when attempting to apply a patch.  There is nothing strange going
on here besides the fact that you didn't supply -p0 on the command
line.

IMO,
cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple