Closed khanku closed 3 years ago
I just tried that out and found this error to be in effect on snapshot-builds. This issue is on the filename-lenght-patch.
I'm not certain on that -f
is a good option here. Is it really safe to force a patch? Would it brake anything if we patch something twice?
On the other hand I have no idea how we could check, if a patch is applied already. @khanku Do you have code for that?
I just found -R
option. I didn't flash the image, but the build doesn't stop anymore that way.
-R or --reverse
Assume that this patch was created with the old and new files swapped. (Yes, I'm afraid that does happen occasion‐
ally, human nature being what it is.) patch attempts to swap each hunk around before applying it. Rejects come out
in the swapped format. The -R option does not work with ed diff scripts because there is too little information to
reconstruct the reverse operation.
If the first hunk of a patch fails, patch reverses the hunk to see if it can be applied that way. If it can, you are
asked if you want to have the -R option set. If it can't, the patch continues to be applied normally. (Note: this
method cannot detect a reversed patch if it is a normal diff and if the first command is an append (i.e. it should
have been a delete) since appends always succeed, due to the fact that a null context matches anywhere. Luckily,
most patches add or change lines rather than delete them, so most reversed normal diffs begin with a delete, which
fails, triggering the heuristic.)
I would argue that -f
is safe in the sense that it will work non-interactively but still fail if a patch cannot be applied.
Regarding the combination of -f
and -R
: I agree, see https://github.com/Freifunk-Spalter/builter/pull/75
Fixed by #75
If any of the patches that live under
patches/
have already been applied upstream thenpatch
will detect it and ask for user input ("Reversed (or previously applied) patch detected! Assume -R? [n]") effectively preventing the build from continuing until that happens. Note that buildbot is not affected by this (presumably because it closes stdin). Still it would be nice to usepatch -f
to prevent this. It'd be even better to check whether a patch has been applied already and skip if it has.