From "man patch" : patch's exit status is 0 if all hunks are applied successfully, 1 if some hunks cannot be applied, and 2 if there is more serious trouble. When applying a set of patches in a loop it behooves you to check this exit status so you don't apply a later patch to a partially patched file. It would be helpful to easier see the culprit in a mcuh smaller log file (example attached). Reproducible: Always
Created attachment 280593 [details] /var/tmp/portage/kde-base/systemsettings-4.6.5/temp/krandr.patch.out
so what exactly are you looking for here ? you want epatch to log the exit status after every execution of `patch` ? ... Hunk #2 FAILED at 62. 1 out of 2 hunks FAILED -- saving rejects to file kcontrol/randr/randrconfig.h.rej +command exited with $? ========================
(In reply to comment #2) > so what exactly are you looking for here ? you want epatch to log the exit > status after every execution of `patch` ? Yes - b/c it doesn't make too much sense to probe for -p2, -p3, etc or?
that's something else. including it in the log is trivial, but you're also asking for the loop behavior to change. the man page indicates that the patch exit status is specific to GNU patch. it also doesnt really say what "serious trouble" means. i'm not sure that we can say that a patch which happens to match some files at say p0 should abort immediately when we actually want p1 and it matches everything. the overhead of trying up to p5 is irrelevant as it only happens when earlier ones failed. i dont think we should optimize for the "failure" paths.
Yep, you're right, seems that "serious" means much more than only a non-sense -p?, patch should behave more subtile ... tfoerste@n22 ~/tmp $ patch -p0 -g0 -E --no-backup-if-mismatch < p.patch patching file foo tfoerste@n22 ~/tmp $ echo $? 0 tfoerste@n22 ~/tmp $ echo foo > foo; echo foo > bar; echo bar >> bar; diff -u foo bar > p.patch; cp foo bar tfoerste@n22 ~/tmp $ patch -p1 -g0 -E --no-backup-if-mismatch < p.patch missing header for unified diff at line 3 of patch can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |--- foo 2011-07-22 21:40:06.000000000 +0200 |+++ bar 2011-07-22 21:40:06.000000000 +0200 -------------------------- File to patch: Skip this patch? [y] y Skipping patch. 1 out of 1 hunk ignored tfoerste@n22 ~/tmp $ echo $? 1
the exact exit status is now logged for all runs http://sources.gentoo.org/eclass/eutils.eclass?r1=1.359&r2=1.360