Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 565336

Summary: eutils.eclass: epatch: failed to apply patch when using --dry-run and multiple hunks against the same file
Product: Gentoo Linux Reporter: Perfect Gentleman <perfect007gentleman>
Component: [OLD] LibraryAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Perfect Gentleman 2015-11-10 07:53:40 UTC
epatch failed to patch media-libs/freetype with https://github.com/bohoomil/fontconfig-ultimate/blob/master/freetype/02-upstream-2015.11.08.patch

patch.out - https://bpaste.net/show/87a872c50511

patch -p1 -i /home/my_user/overlay/media-libs/freetype/files/02-upstream-2015.11.08.patch - works.

patch -p1 -g0 -E --no-backup-if-mismatch < '/home/my_user/overlay/media-libs/freetype/files/02-upstream-2015.11.08.patch' - works too.
Comment 1 Felix Janda 2015-11-10 18:49:25 UTC
I think this might be a bug in sys-apps/patch. 'patch -p1 --dry-run'
fails while 'patch -p1' succeeds (on freetype-2.6.1).
Comment 2 Felix Janda 2015-11-10 19:08:01 UTC
The problem seems to be that the patch patches "ChangeLog" multiple
times and these patches on depend on each other. Without --dry-run
patch applies the patches one after each other and everything works.
With --dry-run patch sees whether the first patch applies. Next, it
checks whether the second patch applies _to the original file_, to
which the second patch might not apply after all. Another thing to note
is that patch is also not able to reverse (option -R) these kind of
patches.

Either such patches are invalid or these are bugs in patch.
Comment 3 Perfect Gentleman 2015-11-10 19:19:13 UTC
did you read patch.out?
there is "patch -p1 -g0 -E --no-backup-if-mismatch < '/home/my_user/overlay/media-libs/freetype/files/02-upstream-2015.11.08.patch'" which didn't work for epatch, but it works itself.
Comment 4 Felix Janda 2015-11-10 21:29:50 UTC
epatch first uses internally in addition the "--dry-run" and "-f"
options but does not tell you about that in patch.out.
Comment 5 SpanKY gentoo-dev 2015-11-11 02:37:46 UTC
i've clarified the log here:
http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1bb3a73979d7023e7425b9a0acc1324070044278

but in the end, epatch requires patches pass --dry-run mode, and your patch does not do that (because it modifies the same file multiple times).