Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: David Rees To: cygwin AT cygwin DOT com Subject: Re: patch problem with forward/backward slashes in patch file Date: Wed, 07 Mar 2001 13:29:23 -0800 Message-ID: <329dat08cnf9q6i137l3udjhe0di2ehpd5@4ax.com> References: <4nrbat4k7l19ndugn851cro7072ai9ftqt AT 4ax DOT com> <20010307111525 DOT E18117 AT redhat DOT com> In-Reply-To: <20010307111525.E18117@redhat.com> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id QAA29557 On Wed, 7 Mar 2001 11:15:25 -0500, Christopher Faylor wrote: >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". > Your explanation makes sense, but shouldn't it be using the cygwin DLL to recognize that its directory path? Its obviously using the cygwin DLL to access the file. >>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. > This is from the diffutils manual: "By default, patch strips off all leading directories, leaving just the base file names, except that when a file name given in the patch is a relative file name and all of its leading directories already exist, patch does not strip off the leading directory. (A relative file name is one that does not start with a slash.) " http://www.delorie.com/gnu/docs/diffutils/diff_77.html Of course, the patch manual doesn't mention what it does for relative vs. absolute files at all. Maybe its a version issue? Anyway, the obvious solution is always use -p0. thanks for the info, dave -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple