Package: quilt
Version: 0.67+really0.67-1
Severity: important
Tags: fixed-upstream patch
The /usr/share/quilt/scripts/patchfns script contains a gawkism and does
not work correctly with either mawk or original-awk. In both cases
"quilt refresh" corrupts existing patches, but the symptoms are quite
different:
- With awk=original-awk the refreshed patch is appended after the
original one instead of replacing it, and applying the refreshed patch
later fails.
- With awk=mawk there is a complaint from mawk:
,----
| awk: line 21: regular expression compile failed (syntax error ^* or ^+)
| ^+++[ \t][^ \t]
`----
This time there is no duplication of the patch, but the complete patch
header is removed, causing information loss. :-(
Fortunately the problem had already been reported upstream and fixed in
commit ce9c68abb7c ("patchfns: Compatibility fix for BSD awk"), I have
attached the patch for your convenience and already tested it
successfully with both mawk and original-awk. :-)
-- System Information:
Debian Release: trixie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
From ce9c68abb7cee0b4fb0d5a7ff7048d0ab3b726f8 Mon Sep 17 00:00:00 2001
From: Jean Delvare <[email protected]>
Date: Thu, 23 Jun 2022 14:36:58 +0200
Subject: [PATCH 1/1] patchfns: Compatibility fix for BSD awk
"+" needs to be quoted to be considered as a literal "+" by BSD awk.
Without this fix, patch_header() fails to find the beginning of the
changes and treats the whole patch as a header, subsequently causing
"quilt refresh" to append the refreshed patch after the original one
instead of replacing it.
Bug reported and fix suggested by Dominic Evans.
Signed-off-by: Jean Delvare <[email protected]>
Fixes: 1d94980dbdd4 ("Tighten the patch format parsing")
---
quilt/scripts/patchfns.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index 75cee52..c2d5f9d 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -848,7 +848,7 @@ patch_header()
MAYBE_CONTEXT=0
}
MAYBE_UNIFIED {
- if (/^+++[ \t][^ \t]/)
+ if (/^\+\+\+[ \t][^ \t]/)
exit
print eaten
MAYBE_UNIFIED=0
@@ -881,7 +881,7 @@ patch_body()
MAYBE_CONTEXT=0
}
MAYBE_UNIFIED {
- if (/^+++[ \t][^ \t]/) {
+ if (/^\+\+\+[ \t][^ \t]/) {
print eaten
body=1
}
--
2.42.0