Subject: bug#66450: 29.1; Debbugs/Gnus sometimes corrupt git formatted patches

From: Michael Albinus <[email-masked]>
Date: Thu, 12 Oct 2023 18:52:36 +0200

Maxim Cournoyer <[email-masked]> writes:

> Hello,

Hi Maxim,

> While working via Emacs Debbugs, I noticed that applying a patch would
> fail, and that this only occurred when fetching and saving the patch via
> Debbugs/Gnus.  Below is a reproducer:
>
> 1. mkdir -p src && cd src && git clone https://git.savannah.gnu.org/git/guix.git
> 2. cd guix && git checkout core-updates
> 3. in emacs: M-x debbugs-gnu-bugs RET 65479 RET
> 4. Navigate to the message with [PATCH core-updates v3 10/63] in its
> subject
> 5. M-x cd RET ~/src/guix
> 6. Try to apply the patch by pressing: | RET git am
> 7. Notice that it fails with a patch corrupted message
> 8. Save the patch message to a file via: O f /tmp/bad.txt
> 9. Save a pristine version from Mumi:
> wget https://issues.guix.gnu.org/issue/65479/raw/164 -O/tmp/good.txt
>
> 10. From your shell in the Guix checkout: git am --abort; git am <
> /tmp/bad.txt
> Observe:
>
> Applying: gnu: docbook: Remove leftovers.
> error: corrupt patch at line 97
> Patch failed at 0001 gnu: docbook: Remove leftovers.
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
>
>
> 11. git am --abort; git am < /tmp/good.txt
>
> It'll fail also because we haven't applied patches 1 to 9, but note the
> error is not about a corrupted patch.

Eric has told you already what's up from gnus pov.

The debbugs manual gives you a further approach: debbugs-gnu-apply-patch
(M-m). Read it at (info "(debbugs-ug) Applying Patches")

The documentation speaks about the Emacs repository, but I believe it
should be possible also to apply it to GUIX with proper setting of
debbugs-gnu-trunk-directory. If not pls tell me; we could adapt it then.
There is, for example, a minibuffer prompt "Emacs repository location: "
which should work anyway.

Best regards, Michael.