[nycbug-talk] Reversed (or previously applied) patch detected

John Baldwin jhb at freebsd.org
Wed Dec 29 09:04:15 EST 2010

On Tuesday, December 28, 2010 4:35:31 pm Francisco Reyes wrote:
> John Baldwin writes:
> > Try:
> > 
> > cd original; patch -p1 < ../dir.diff
> Thanks. That worked.
> How can one the equivalent of an absolute path?
> For, example I got a patch to a port and I just ran the patch command and it 
> updated the port. I didn't have to change to the port directory.
> Just re-did my little experiment and used the full path to source on the 
> diff, then went into the source dir and ran patch without any parameter 
> other than the patch; it loaded properly. I still don't get why it would not 
> work from ~/tmp if the original diff had the full path (ie tried running 
> patch from ~/tmp and did not work).
> The patch to the port was:
> diff -ruN /usr/ports/databases/skytools/Makefile skytools/Makefile
> --- /usr/ports/databases/skytools/Makefile      2010-12-02 
> 22:55:36.000000000 +0800
> +++ skytools/Makefile   2010-12-26 06:00:36.000000000 +0800
> @@ -6,9 +6,9 @@

I believe it has to do with out patch resolves paths.  In this case it will 
probably look for 1) the full relative path in the '+++' line and then 2) just 
the basename ('Makefile') in the current directory.  I'm not sure if it will 
fall back to the name in the --- line as well, but it might, probably using 
the full path first followed by the basename second.  However, in your 
original patch you had the 'original/' directory in your path name and when 
you cd'd into 'original' neither the full relative path or the simple basename 
matched, so it failed to find a file to apply the patch to.

John Baldwin

More information about the talk mailing list