Skip to contentSkip to conversation

git applymbox is too anal

DISCUSSION Greg KH 3 participants 5 messages Jun 15, 2016 USB

lore
Share & tools
lore

Greg KH

author
#0 lore raw

Ick. I'm trying to apply a bunch of patches to a git repo (the kernel tree), using 'git applymbox' and it's just dieing on simple patches that apply with fuzz.

for example:

$ git applymbox ~/linux/patches/u07

Applying 'USB: fix up URB_ASYNC_UNLINK usages from the usb-serial drivers'

error: patch failed: drivers/usb/serial/option.c:513
error: drivers/usb/serial/option.c: patch does not apply

$ patch -p1 --dry-run < ~/linux/patches/u07
patching file drivers/usb/serial/keyspan.c
patching file drivers/usb/serial/option.c
Hunk #3 succeeded at 509 with fuzz 1.

So, I have to then do a 'patch, git diff, git checkout-cache -f -u -a, git applymbox' type dance to get this patch to apply.

Or am I missing some option to 'git applymbox' that I can't seem to find?

thanks,

greg k-h

author
#1 lore raw
Quoted 3 lines · Greg KH

Ick. I'm trying to apply a bunch of patches to a git repo (the kernel tree), using 'git applymbox' and it's just dieing on simple patches that apply with fuzz.

Ok, found another one. This time I looked at the patch itself, and it is a bit "odd", but normal patch handles it fine.

The patch is:

drivers/usb/input/Makefile 2005-08-16 12:31:54.000000000 -0700 renamed from drivers/usb/input/Makefile 2005-08-15 23:39:10.000000000 -0700 +1 -0
@@ -39,5 +39,6 @@
 obj-$(CONFIG_USB_POWERMATE)    += powermate.o
 obj-$(CONFIG_USB_WACOM)        += wacom.o
 obj-$(CONFIG_USB_ACECAD)       += acecad.o
+obj-$(CONFIG_USB_YEALINK)      += yealink.o
 obj-$(CONFIG_USB_XPAD)         += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o

While the original drivers/usb/input/Makefile in this area is:

obj-$(CONFIG_USB_POWERMATE)     += powermate.o
obj-$(CONFIG_USB_WACOM)         += wacom.o
obj-$(CONFIG_USB_ACECAD)        += acecad.o
obj-$(CONFIG_USB_XPAD)          += xpad.o

(ignore tab issues, this was cut-and-pasted).

So, the patch shows that there was another line at the end of the file, while in reality it isn't (this is due to me excluding a patch from the series that I'm applying due to other reasons.)

Is this something that git can handle without me editing the patch by hand? :)

thanks,

greg k-h

#2 lore raw
Quoted 6 lines · Greg KH

So, the patch shows that there was another line at the end of the file, while in reality it isn't (this is due to me excluding a patch from the series that I'm applying due to other reasons.)

Is this something that git can handle without me editing the patch by hand? :)

Linus was quite strict about rejecting any fuzz, but I am sympathetic to the cause. I do not mind if somebody comes up with a patch to add '--fuzz' option to git-apply; we can try applying first without --fuzz and ask the user if he wants one from 'git applymbox' main loop when it fails.

#3 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

Or am I missing some option to 'git applymbox' that I can't seem to find?

No. git-apply wants an exact bit-for-bit match. Partly because fuzz is hard, but mostly because I don't like it. I apply a _lot_ of patches, and if a unforgiving "git-apply" works for me, it should work for you too.

One issue is that I want to apply patches that apply cleanly, and if the patch was generated against some older kernel version, then it should quite likely be _applied_ towards that older kernel version. Then you can use git to merge the two.

Of course, I only do that occasionally, for bigger clashes. For smaller things, I just edit the patch by hand. And sometimes, I ask the sending side to re-generate the patch.

Applying with a fuzz does the right thing most of the time. But "most" isn't good enough. I'd rather have a human look at anything that requires fuzz.

Linus

author
#4 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Or am I missing some option to 'git applymbox' that I can't seem to find?

No. git-apply wants an exact bit-for-bit match. Partly because fuzz is hard, but mostly because I don't like it. I apply a _lot_ of patches, and if a unforgiving "git-apply" works for me, it should work for you too.

Ok, as I've been using quilt to stage patches before they are ready to send to you, sometimes, when I build up the final tree, there are tiny fuzz issues. I'll just make sure to fix this up before running applymbox in the future.

thanks,

greg k-h