I'm applying hundreds of patches in a batch, so am using unusual arguments as I want to be able to generate a reject file whilst dry run patching, and have all the rejects from one patch to go to the same file. This has worked fine for ages until I hit this issue with a specific patch file.
The issue occurs when applying the linux-4.4.66 patch to linux-4.4.
I get the same issue using all versions of patch I've tried including v2.5.4 and the latest v2.7.5.
To help you reproduce:
tar xvf opensource/packages/linux-4.4.tar.xz
xzcat patch-4.4.66.xz > patch-4.4.66
address@hidden:~$ cat /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
address@hidden:~$ patch --version
GNU patch 2.7.5
address@hidden:~$ patch -d linux-4.4 -Np1 -i ../patch-4.4.66 -o tmp --reject-file=patch-4.4.66.rej
patching file tmp (read from Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935)
patching file tmp (read from Documentation/ABI/testing/sysfs-bus-usb)
patching file tmp (read from Documentation/Makefile)
patching file tmp (read from drivers/gpu/drm/drm_irq.c)
patching file tmp (read from drivers/gpu/drm/drm_modes.c)
patching file tmp (read from drivers/gpu/drm/drm_prime.c)
patch: patch.c:1419: apply_hunk: Assertion `outstate->after_newline' failed.
Aborted (core dumped)