I narrowed the issue down to patching a file that ends without a new line,
followed by patching another file.
The following trimmed down linux-4.4.66 patch exhibits this behaviour:
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1487,6 +1494,8 @@ int drm_mode_convert_umode(struct drm_display_mode
*out,
if (out->status != MODE_OK)
goto out;
+ drm_mode_set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);
+
ret = 0;
out:
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -339,14 +339,17 @@ static const struct dma_buf_ops
drm_gem_prime_dmabuf_ops = {
* using the PRIME helpers.
*/
struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
- struct drm_gem_object *obj, int flags)
+ struct drm_gem_object *obj,
+ int flags)
{
- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
- exp_info.ops = &drm_gem_prime_dmabuf_ops;
- exp_info.size = obj->size;
- exp_info.flags = flags;
- exp_info.priv = obj;
+ struct dma_buf_export_info exp_info = {
+ .exp_name = KBUILD_MODNAME, /* white lie for debug */
+ .owner = dev->driver->fops->owner,
+ .ops = &drm_gem_prime_dmabuf_ops,
+ .size = obj->size,
+ .flags = flags,
+ .priv = obj,
+ };
if (dev->driver->gem_prime_res_obj)
exp_info.resv = dev->driver->gem_prime_res_obj(obj);
I've managed to fix the issue with the following patch to patch-2.7.5:
--- patch-2.7.5/src/patch.c 2015-03-07 00:34:20.000000000 +0000
+++ patch-2.7.5/src/patch.c 2017-05-04 16:50:29.356159495 +0100
@@ -50,7 +50,7 @@
static void init_output (struct outstate *);
static FILE *open_outfile (char const *);
static void init_reject (char const *);
-static void reinitialize_almost_everything (void);
+static void reinitialize_almost_everything (struct outstate *);
static void remove_if_needed (char const *, bool *);
static void usage (FILE *, int) __attribute__((noreturn));
@@ -190,7 +190,7 @@
open_patch_file (patchname);
there_is_another_patch (! (inname || posixly_correct), &file_type)
|| apply_empty_patch;
- reinitialize_almost_everything(),
+ reinitialize_almost_everything(&outstate),
skip_reject_file = false,
apply_empty_patch = false
) { /* for each patch in patch
file */
@@ -682,7 +682,7 @@
/* Prepare to find the next patch to do in the patch file. */
static void
-reinitialize_almost_everything (void)
+reinitialize_almost_everything (struct outstate *outstate)
{
re_patch();
re_input();
@@ -707,6 +707,9 @@
reverse = reverse_flag_specified;
skip_rest_of_patch = false;
+
+ outstate->after_newline = true;
+ outstate->zero_output = true;
}
static char const shortopts[] = "bB:cd:D:eEfF:g:i:l"
Resetting zero_output might not be necessary, but after_newline needs to be
reset when we move on to patching the next file.
Best regards
Barry Davis
On 4 May 2017 at 14:44, Barry Davis <[email protected]> wrote:
> 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:~$
>
>
>