Hi, Am Mo., 20. Juli 2026 um 03:43 Uhr schrieb Collin Funk <[email protected]>: > Hi Andreas, > > Andreas Metzler <[email protected]> writes: > > > GNU patch 2.8 cannot apply recursive normal-format diffs: > > --------------------------- > > ametzler@argenau:/tmp$ mkdir -p /tmp/reprod/dira > > ametzler@argenau:/tmp$ cat << EOF > /tmp/reprod/dira/file > >> line 1 > >> blah > >> line 3 > >> EOF > > ametzler@argenau:/tmp$ cp -a /tmp/reprod/dira /tmp/reprod/dirb > > ametzler@argenau:/tmp$ sed -i -e 's/blah/blub/' /tmp/reprod/dirb/file > > ametzler@argenau:/tmp$ cd /tmp/reprod/ > > ametzler@argenau:/tmp/reprod$ diff --recursive --new-file dira dirb > > > diffexamle.diff > > ametzler@argenau:/tmp/reprod$ cat diffexamle.diff > > diff --recursive --new-file dira/file dirb/file > > 2c2 > > < blah > > --- > >> blub > > ametzler@argenau:/tmp/reprod$ cd dira/ > > ametzler@argenau:/tmp/reprod/dira$ patch --dry-run -p1 < ../diffexamle.diff > > patch: **** Only garbage was found in the patch input. > > ametzler@argenau:/tmp/reprod/dira$ patch --normal --dry-run -p1 < > > ../diffexamle.diff > > can't find file to patch at input line 2 > > The text leading up to this was: > > -------------------------- > > |diff --recursive --new-file dira/file dirb/file > > -------------------------- > > File to patch: ^C > > --------------------------- > > Thanks for the report. I am going to forward it to [email protected], > and close this as notabug in diffutils, which does not contain 'patch'.
GNU patch doesn't recognize filenames in "diff" lines, and it never has. (The exception are lines starting with "diff --git", which are assumed to be well-structured.) We could fix that, but only at the risk of breaking existing patches that contain unexpected "diff" lines. I'm sure we'd have to support things like multiple filename quoting styles, for example. So unless an obvious need for this functionality can be demonstrated, I'm fairly reluctant to add support for it. Until then, just use unified or context format diffs instead. Thanks, Andreas > Collin
