Bug#1053463: quilt: quilt functions corrupt patches if awk is not gawk
control: tag -1 pending Am 05.10.23 um 19:18 schrieb Sven Joachim: If you would like a merge request on Salsa, I can do that. But applying the upstream patch is trivial, the only question is what name you want to give it. Cheers, Sven Hi Sven, thanks for filing this bug and pointing to a patch. I'll certainly include that. However, as you might be aware, I've uploaded v0.67 recently and the upgrade is not as smooth as I would have hoped. I'm currently dealing with a lot of FTBFS bugs in dependent packages, and therefore I'd like to sort that out cleanly before adding another patch. So once the dust settles (hopefully in the next couple of days), I can prepare another upload with your suggested patch. Regards, Tobias OpenPGP_signature.asc Description: OpenPGP digital signature
Bug#1053463: quilt: quilt functions corrupt patches if awk is not gawk
Control: severity -1 grave On 2023-10-04 17:16 +0200, Sven Joachim wrote: > Package: quilt > Version: 0.67+really0.67-1 > Severity: important Thinking about it again, that severity was too low. This bug causes non-serious data loss with Debian's default awk implementation. > 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. That is what had been observed in the upstream report, but considering original-awk's low popcon, few Debian users will see that. > - 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. :-( I think that is really bad, as there is no way to recover the header if it had not been backed up (e.g. committed to a VCS). And not everyone has gawk installed or uses it as the default awk implementation. So quite a few people will observe that bug, and we should not let the package migrate to testing without fixing it. > 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. :-) If you would like a merge request on Salsa, I can do that. But applying the upstream patch is trivial, the only question is what name you want to give it. Cheers, Sven
Bug#1053463: quilt: quilt functions corrupt patches if awk is not gawk
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 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 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