Linux-4.X-rcY patches can't be applied with git?
From: Jarod Wilson
Date: Mon Oct 24 2016 - 14:25:29 EST
It's entirely possible that we (Red Hat and the Fedora kernel team) are
doing something wrong here, but to the best of our knowledge, it seems
that the canonical upstream RC snap patches can't be applied to a tree
using either git or old-fashioned patch.
For example:
$ cd /tmp
$ wget http://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.8.tar.xz
$ tar xf linux-4.8.xz
$ cd linux-4.8
$ wget http://cdn.kernel.org/pub/linux/kernel/v4.x/testing/patch-4.9-rc2.xz
$ unxz patch-4.9-rc2.xz
$ git --version
git version 2.10.0
$ git apply patch-4.9-rc2
patch-4.9-rc2:15822: space before tab in indent.
IRQ_AUDIO pin
patch-4.9-rc2:15832: space before tab in indent.
IRQ_RTC pin
patch-4.9-rc2:19120: space before tab in indent.
};
patch-4.9-rc2:20847: space before tab in indent.
- "moxa,moxart-timer"
patch-4.9-rc2:20848: space before tab in indent.
- "aspeed,ast2400-timer"
error: cannot apply binary patch to 'Documentation/media/media_api_files/typical_media_device.pdf' without full index line
error: Documentation/media/media_api_files/typical_media_device.pdf: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf' without full index line
error: Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_625.pdf' without full index line
error: Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_625.pdf: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif' without full index line
error: Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.png' without full index line
error: Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.png: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.gif' without full index line
error: Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.gif: patch does not apply
error: cannot apply binary patch to 'Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.png' without full index line
error: Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.png: patch does not apply
$ echo $?
1
Most of the patch applies with 'patch -p1 < patch-4.9-rc2', but those same
binary files fail. No big deal, except that there's an error return from
patch, which means an rpm build using standard rpm macro stuff fails.
That's actually one of the reasons we switched to using git to apply any
patches in the Fedora kernel rpm spec files. But as per above, that doesn't
work all the tme either, which has resulted in the addition of a perl
script that gets called to strip binary patch data out entirely, which of
course, makes the resulting rpm omit the binary changes entirely, and thus
not *quite* 4.9-rc2 that gets spit out here.
Perl script:
http://pkgs.fedoraproject.org/cgit/rpms/kernel.git/tree/remove-binary-diff.pl
However, if the RC patch is generated like so:
$ cd ~/src/linux
$ git diff --binary v4.8..v4.9-rc2 > /tmp/linux-4.8/patch-4.9-rc2
Then:
$ cd /tmp/linux-4.8
$ git apply patch-4.9-rc2
patch-4.9-rc2:8359: space before tab in indent.
./configure
patch-4.9-rc2:8719: space before tab in indent.
alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
patch-4.9-rc2:8720: space before tab in indent.
CRYPTO_ALG_TYPE_MASK);
patch-4.9-rc2:8721: space before tab in indent.
if (IS_ERR(alg))
patch-4.9-rc2:8725: space before tab in indent.
/* Block size must be >= 4 bytes. */
warning: squelched 104 whitespace errors
warning: 109 lines add whitespace errors.
$ echo $?
0
I just noticed that the 'space before tab in indent' noise is different
between the two, but otherwise, things seem to work much better. I know
it results in a slightly larger patch file to download (unxz size is 2MB
larger), and it still will not apply with plain old patch, but at least
it applies with git.
Or am I missing something blindingly obvious in the git apply options
that would work with the existing patches?
--
Jarod Wilson
jarod@xxxxxxxxxx