Bug 217852 - b4 patch corruption
Summary: b4 patch corruption
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Infra (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: Konstantin Ryabitsev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-31 20:32 UTC by Bugbot
Modified: 2023-09-06 21:09 UTC (History)
0 users

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
rework-wrap.patch (5.96 KB, text/x-patch)
2023-08-31 20:32 UTC, Bugbot
Details

Description Bugbot 2023-08-31 20:32:04 UTC
Andrew Cooper <andrew.cooper3@citrix.com> writes:

Hi,

I'm using b4 v0.12.3, and getting some kind of patch corruption issue:

xen.git$ b4 shazam a67c2fa3-ba1c-3783-c3ee-250aff6903d5@suse.com
Grabbing thread from
lore.kernel.org/all/a67c2fa3-ba1c-3783-c3ee-250aff6903d5@suse.com/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 1 messages in the thread
Checking attestation on all messages, may take a moment...
---
  ✓ [PATCH] x86emul: rework wrapping of libc functions in test and
fuzzing harnesses
  ---
  ✓ Signed: DKIM/suse.com
---
Total patches: 1
---
Applying: x86emul: rework wrapping of libc functions in test and fuzzing
harnesses
Patch failed at 0001 x86emul: rework wrapping of libc functions in test
and fuzzing harnesses
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".
error: corrupt patch at line 11
hint: Use 'git am --show-current-patch=diff' to see the failed patch

Forwarding this to patch does produce a more specific complaint:

xen.git$ git am --show-current-patch=diff | patch
patching file Makefile
patch: **** malformed patch at line 11: @@ -51,10 +53,10 @@
x86-insn-fuzzer.a: $(OBJS) cpuid.o

but it's not clear what exactly is wrong here.

If I copy the patch out of the email and feed it to `git am` directly,
it's happy:

xen.git$ git am rework-wrap.patch
Applying: x86emul: rework wrapping of libc functions in test and fuzzing
harnesses

I can't spot any interesting differences between what failed and what
`git format-patch` reproduced, but I'm out of my depth here.

My gut feeling is that something has been mangled while b4 was
processing the change, but it's only a guess.

I've attached the copied-off-list patch, and the base commit is
d0eabe3eaf0db5b78843095a2918d50961e99e96

Thanks,

~Andrew

(via https://msgid.link/c9643b70-8751-a2a2-185e-174ec2560328@citrix.com)
Comment 1 Bugbot 2023-08-31 20:32:06 UTC
Created attachment 304996 [details]
rework-wrap.patch
Comment 2 Bugbot 2023-08-31 20:32:09 UTC
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:

On Thu, Aug 17, 2023 at 01:23:06PM +0100, Andrew Cooper wrote:
> Hi,
> 
> I'm using b4 v0.12.3, and getting some kind of patch corruption issue:

Indeed, I can confirm the problem.

bugbot assign to me

> I can't spot any interesting differences between what failed and what
> `git format-patch` reproduced, but I'm out of my depth here.
> 
> My gut feeling is that something has been mangled while b4 was
> processing the change, but it's only a guess.

I'll have to dig deeper, but the main reason is that it's not a patch
generated with git (you can tell by the lack of diff --git and index lines).
However, b4 shouldn't corrupt such patches either, so I will have to figure
out what is throwing it off.

Thanks for the report.

-K

(via https://msgid.link/20230831-finale-hurrah-chai-2791dd@meerkat)
Comment 3 Bugbot 2023-09-06 21:09:07 UTC
Konstantin Ryabitsev writes in commit 0438c6a107d3475895281146e51d68069a41dc3d:

am: properly handle non-git diffs

We were not properly parsing patches generated by something other than
"git diff" or "git format-patch". Notably, these are pretty rare, but we
still shouldn't fail when doing that.

This additionally adds a few tests and fixes a silly mistake that I had
all along in the sample data.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217852
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>

(via https://git.kernel.org/pub/scm/utils/b4/b4.git/commit/?id=0438c6a107d3)

Note You need to log in before you can comment on or make changes to this bug.