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: wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz wget https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-4.4.66.xz tar xvf opensource/packages/linux-4.4.tar.xz xzcat patch-4.4.66.xz > patch-4.4.66 bdavis@ubuntuvsabuild:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" bdavis@ubuntuvsabuild:~$ patch --version GNU patch 2.7.5 bdavis@ubuntuvsabuild:~$ 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) <snip> 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) bdavis@ubuntuvsabuild:~$