From MAILER-DAEMON Thu May 04 10:03:33 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d6HLx-0003Ny-MF
	for mharc-bug-patch@gnu.org; Thu, 04 May 2017 10:03:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52170)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <barry_davis@stormagic.com>) id 1d6H4J-0002BY-Ir
	for bug-patch@gnu.org; Thu, 04 May 2017 09:45:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <barry_davis@stormagic.com>) id 1d6H4I-00026W-EG
	for bug-patch@gnu.org; Thu, 04 May 2017 09:45:19 -0400
Received: from mail-yw0-x246.google.com ([2607:f8b0:4002:c05::246]:40203)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <barry_davis@stormagic.com>)
	id 1d6H4I-00025u-9W
	for bug-patch@gnu.org; Thu, 04 May 2017 09:45:18 -0400
Received: by mail-yw0-x246.google.com with SMTP id 17so7866895ywk.7
	for <bug-patch@gnu.org>; Thu, 04 May 2017 06:45:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=stormagic.com; s=stormagic;
	h=mime-version:from:date:message-id:subject:to;
	bh=ySE3PtWQaO3SkEovZeBs3yUN9Io9xEN3idS3MN0GzB4=;
	b=Ln6dEfK3aetjSTTKK2A8OqoxnmI+yQYQVL4It7bpiCgCELssnEwkBAfFO+Dt/kACJz
	SH/KaJ+vu5HnfYdZLvGDXTW+ORzvzr1wHLK8KeEZ1Pd+igR9cdaI0u6x6rjP65cyU4Qb
	C9OlEgxJ2T1Jh/Eq2aKbA1H+6Y0Qrm1tldAdA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=ySE3PtWQaO3SkEovZeBs3yUN9Io9xEN3idS3MN0GzB4=;
	b=TC0RKG64YjRga2GHCo0ZanDcT3Mn3pIfuz/sIG0ra0LZ3WbG3i4JS0GG+RJloQAfAs
	nmM8l4S0NaMb6x0CSb462XPGhiJm4fWUN4SbD3tXRO+XJU5liZzyXPAGDk7ylPOwotiN
	hSW+9DyPaAmtjMQlArEoMAMFEaug178otZ7mu+6dxIRvLYobnOQn9B9CliDuo7QLymW/
	bx7WfuBv69ol6nXwdO3cag4BrrlsTjtcQ8q6HNeIJsahiTsf116hQpKFy6PLF1myTjMB
	SARPGf9TPG1XrYTndkua1vfSWokgeBnmKbM/3ZjxUVSxRS22erlFQ1i+kvFv9/75qVMH
	Iqcg==
X-Gm-Message-State: AN3rC/7klsXRUyd2zxYLQBcTZnZwpR9VjhXC+xCQCSolHv/Dx7XRGmoB
	Gm/LYY1XeQS669mwIF8H0MnZanYW4/o4t3k=
X-Received: by 10.37.224.215 with SMTP id x206mr35118847ybg.101.1493905515517; 
	Thu, 04 May 2017 06:45:15 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.125.131 with HTTP; Thu, 4 May 2017 06:44:55 -0700 (PDT)
From: Barry Davis <barry_davis@stormagic.com>
Date: Thu, 4 May 2017 14:44:55 +0100
Message-ID: <CAPrKAMehaHv2T==gBPT5FRPWdXFxvX52ZEopH6Qk+OCEriazwA@mail.gmail.com>
To: bug-patch@gnu.org
Content-Type: multipart/alternative; boundary=94eb2c086896951b06054eb2fbfe
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4002:c05::246
X-Mailman-Approved-At: Thu, 04 May 2017 10:03:32 -0400
Subject: [bug-patch] Patch abort while patching the linux kernel
X-BeenThere: bug-patch@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Bug reports, suggestions,
	general discussion for GNU patch." <bug-patch.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-patch>,
	<mailto:bug-patch-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-patch/>
List-Post: <mailto:bug-patch@gnu.org>
List-Help: <mailto:bug-patch-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-patch>,
	<mailto:bug-patch-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 04 May 2017 13:45:20 -0000

--94eb2c086896951b06054eb2fbfe
Content-Type: text/plain; charset=UTF-8

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:~$

--94eb2c086896951b06054eb2fbfe
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I&#39;m applying hundreds of patches in a batch, so a=
m using unusual arguments as I want to be able to generate a reject file wh=
ilst 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 spe=
cific patch file.<br></div><div><br></div><div><div>The issue occurs when a=
pplying the linux-4.4.66 patch to linux-4.4.</div><div>I get the same issue=
 using all versions of patch I&#39;ve tried including v2.5.4 and the latest=
 v2.7.5.</div></div><div><br></div><div>To help you reproduce:<br></div><di=
v>wget <a href=3D"https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.ta=
r.xz">https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz</a><br>=
</div><div>wget <a href=3D"https://cdn.kernel.org/pub/linux/kernel/v4.x/pat=
ch-4.4.66.xz">https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-4.4.66.xz<=
/a><br></div><div>tar xvf opensource/packages/linux-4.4.tar.xz<br></div><di=
v><div>xzcat patch-4.4.66.xz &gt; patch-4.4.66</div></div><div><br></div><d=
iv><div>bdavis@ubuntuvsabuild:~$ cat /etc/lsb-release</div><div>DISTRIB_ID=
=3DUbuntu</div><div>DISTRIB_RELEASE=3D16.04</div><div>DISTRIB_CODENAME=3Dxe=
nial</div><div>DISTRIB_DESCRIPTION=3D&quot;Ubuntu 16.04.2 LTS&quot;</div></=
div><div><br></div><div><div>bdavis@ubuntuvsabuild:~$ patch --version</div>=
<div>GNU patch 2.7.5</div></div><div><br></div><div>bdavis@ubuntuvsabuild:~=
$ patch -d linux-4.4 -Np1 -i ../patch-4.4.66 -o tmp --reject-file=3Dpatch-4=
.4.66.rej<br></div><div><div>patching file tmp (read from Documentation/ABI=
/testing/sysfs-bus-iio-proximity-as3935)</div><div>patching file tmp (read =
from Documentation/ABI/testing/sysfs-bus-usb)</div><div>patching file tmp (=
read from Documentation/Makefile)</div></div><div>&lt;snip&gt;</div><div><d=
iv>patching file tmp (read from drivers/gpu/drm/drm_irq.c)</div><div>patchi=
ng file tmp (read from drivers/gpu/drm/drm_modes.c)</div><div>patching file=
 tmp (read from drivers/gpu/drm/drm_prime.c)</div><div>patch: patch.c:1419:=
 apply_hunk: Assertion `outstate-&gt;after_newline&#39; failed.</div><div>A=
borted (core dumped)</div><div>bdavis@ubuntuvsabuild:~$</div></div><div><br=
></div><div><br></div></div>

--94eb2c086896951b06054eb2fbfe--


From MAILER-DAEMON Fri May 05 05:30:00 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d6ZYm-0003iG-1H
	for mharc-bug-patch@gnu.org; Fri, 05 May 2017 05:30:00 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38001)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <barry_davis@stormagic.com>) id 1d6ZYi-0003gb-LA
	for bug-patch@gnu.org; Fri, 05 May 2017 05:29:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <barry_davis@stormagic.com>) id 1d6ZYg-0007MQ-LN
	for bug-patch@gnu.org; Fri, 05 May 2017 05:29:56 -0400
Received: from mail-yw0-x247.google.com ([2607:f8b0:4002:c05::247]:35507)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <barry_davis@stormagic.com>)
	id 1d6ZYg-0007Ll-Ep
	for bug-patch@gnu.org; Fri, 05 May 2017 05:29:54 -0400
Received: by mail-yw0-x247.google.com with SMTP id k11so323298ywb.2
	for <bug-patch@gnu.org>; Fri, 05 May 2017 02:29:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=stormagic.com; s=stormagic;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to; 
	bh=PB68lLo1kUj7xGnqQLvpf5w3PCrfJzgA0ydlohczsSs=;
	b=VT0575P3H1jYvtxiMSdnEo5vo5ocVUTCVntG00Hjw7X0rwYORO6lF3R9LphPyWEXpe
	rg6hkXJ7U6GvYuwzPA0l4rM3ToNXXv1XILnPkgeTqLnj6QA1VBOd2AxfizHUBdqkt03x
	byF+xH09Hov7QtJT19KmnCTjcCqVMJGhGX3Qs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to;
	bh=PB68lLo1kUj7xGnqQLvpf5w3PCrfJzgA0ydlohczsSs=;
	b=heVLbUfEendEE2bD9rFl/AuUbMAKup2NXkHxzayLKkrAV5WOnb/W6rKJShMfIAfkfM
	iThCF6bf9R0e/0rO4W3VQNXmhyxtplKw79SjIRDvQrbY9GBK9KTjTB9+CHL7b2JFtXpC
	1LghfWRsxbPRlpAxJS0ajPiZ0oAIf2n/rZKomBd9Cw//sA7Q5ArFCgYLTXber2vC2dDm
	yGLY7DGecYv2WAb5E12krW7EjY+SKorTCyDzJKZ4RbiMVzSGcSgdlydHVlr0IG93gpDj
	ia6F3TjFTVunhPqyXcC1zlzl5cjMmoWRHorVHsMTBhpX6AF54nTF5pjO9irnB6sjwvF/
	x9Hw==
X-Gm-Message-State: AN3rC/5pVEzM011duZOml5zgXVids++vu3EMTp46oUPTRNISH8POKT1c
	sG5yXqNf2XFzS8bvM0CSSLTq3Jw0J+g6RDQ=
X-Received: by 10.37.180.18 with SMTP id n18mr7800117ybj.116.1493976593496;
	Fri, 05 May 2017 02:29:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.125.131 with HTTP; Fri, 5 May 2017 02:29:33 -0700 (PDT)
In-Reply-To: <CAPrKAMehaHv2T==gBPT5FRPWdXFxvX52ZEopH6Qk+OCEriazwA@mail.gmail.com>
References: <CAPrKAMehaHv2T==gBPT5FRPWdXFxvX52ZEopH6Qk+OCEriazwA@mail.gmail.com>
From: Barry Davis <barry_davis@stormagic.com>
Date: Fri, 5 May 2017 10:29:33 +0100
Message-ID: <CAPrKAMfuz=iTN18qdvQqJuw=6Om=FBvTRbGWz2c_BSDmSYNSGA@mail.gmail.com>
To: bug-patch@gnu.org
Content-Type: multipart/alternative; boundary=f403045e6aa228be68054ec388ce
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4002:c05::247
Subject: Re: [bug-patch] Patch abort while patching the linux kernel
X-BeenThere: bug-patch@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Bug reports, suggestions,
	general discussion for GNU patch." <bug-patch.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-patch>,
	<mailto:bug-patch-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-patch/>
List-Post: <mailto:bug-patch@gnu.org>
List-Help: <mailto:bug-patch-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-patch>,
	<mailto:bug-patch-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 05 May 2017 09:29:58 -0000

--f403045e6aa228be68054ec388ce
Content-Type: text/plain; charset=UTF-8

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 <barry_davis@stormagic.com> 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:~$
>
>
>

--f403045e6aa228be68054ec388ce
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I narrowed the issue down to patching a file that ends wit=
hout a new line, followed by patching another file.<div><br></div><div>The =
following trimmed down linux-4.4.66 patch exhibits this behaviour:</div><di=
v><br></div><blockquote style=3D"margin:0px 0px 0px 40px;border:none;paddin=
g:0px"><div><div><font face=3D"monospace, monospace">--- a/drivers/gpu/drm/=
drm_modes.c</font></div></div><div><div><font face=3D"monospace, monospace"=
>+++ b/drivers/gpu/drm/drm_modes.c</font></div></div><div><div><font face=
=3D"monospace, monospace">@@ -1487,6 +1494,8 @@ int drm_mode_convert_umode(=
struct drm_display_mode *out,</font></div></div><div><div><font face=3D"mon=
ospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (out-&gt;status !=3D MODE=
_OK)</font></div></div><div><div><font face=3D"monospace, monospace">=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out;</font></div></d=
iv><div><div><font face=3D"monospace, monospace"><br></font></div></div><di=
v><div><font face=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=A0 drm_mode_=
set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);</font></div></div><div><div><fon=
t face=3D"monospace, monospace">+</font></div></div><div><div><font face=3D=
"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D 0;</font></div><=
/div><div><div><font face=3D"monospace, monospace"><br></font></div></div><=
div><div><font face=3D"monospace, monospace">=C2=A0out:</font></div></div><=
div><div><font face=3D"monospace, monospace">--- a/drivers/gpu/drm/drm_prim=
e.c</font></div></div><div><div><font face=3D"monospace, monospace">+++ b/d=
rivers/gpu/drm/drm_prime.c</font></div></div><div><div><font face=3D"monosp=
ace, monospace">@@ -339,14 +339,17 @@ static const struct dma_buf_ops drm_g=
em_prime_dmabuf_ops =3D =C2=A0{</font></div></div><div><div><font face=3D"m=
onospace, monospace">=C2=A0 * using the PRIME helpers.</font></div></div><d=
iv><div><font face=3D"monospace, monospace">=C2=A0 */</font></div></div><di=
v><div><font face=3D"monospace, monospace">=C2=A0struct dma_buf *drm_gem_pr=
ime_export(struct drm_device *dev,</font></div></div><div><div><font face=
=3D"monospace, monospace">- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0struct drm_gem_object *obj, int flags)</font></div></div><div><div><f=
ont face=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0struct drm_gem_object *obj,</font></div></div><div><div><font =
face=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0int flags)</font></div></div><div><div><font face=3D"monospace, m=
onospace">=C2=A0{</font></div></div><div><div><font face=3D"monospace, mono=
space">- =C2=A0 =C2=A0 =C2=A0 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);</font><=
/div></div><div><div><font face=3D"monospace, monospace">-</font></div></di=
v><div><div><font face=3D"monospace, monospace">- =C2=A0 =C2=A0 =C2=A0 exp_=
info.ops =3D &amp;drm_gem_prime_dmabuf_ops;</font></div></div><div><div><fo=
nt face=3D"monospace, monospace">- =C2=A0 =C2=A0 =C2=A0 exp_info.size =3D o=
bj-&gt;size;</font></div></div><div><div><font face=3D"monospace, monospace=
">- =C2=A0 =C2=A0 =C2=A0 exp_info.flags =3D flags;</font></div></div><div><=
div><font face=3D"monospace, monospace">- =C2=A0 =C2=A0 =C2=A0 exp_info.pri=
v =3D obj;</font></div></div><div><div><font face=3D"monospace, monospace">=
+ =C2=A0 =C2=A0 =C2=A0 struct dma_buf_export_info exp_info =3D {</font></di=
v></div><div><div><font face=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .exp_name =3D KBUILD_MODNAME, /* white lie =
for debug */</font></div></div><div><div><font face=3D"monospace, monospace=
">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .owner =3D dev-&gt;dri=
ver-&gt;fops-&gt;owner,</font></div></div><div><div><font face=3D"monospace=
, monospace">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .ops =3D &a=
mp;drm_gem_prime_dmabuf_ops,</font></div></div><div><div><font face=3D"mono=
space, monospace">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .size =
=3D obj-&gt;size,</font></div></div><div><div><font face=3D"monospace, mono=
space">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .flags =3D flags,=
</font></div></div><div><div><font face=3D"monospace, monospace">+ =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .priv =3D obj,</font></div></div>=
<div><div><font face=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=A0 };</fo=
nt></div></div><div><div><font face=3D"monospace, monospace"><br></font></d=
iv></div><div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 if (dev-&gt;driver-&gt;gem_prime_res_obj)</font></div></div><div><d=
iv><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 exp_info.resv =3D dev-&gt;driver-&gt;gem_prime_res_obj=
(obj);</font></div></div></blockquote><div><div><br></div><div>I&#39;ve man=
aged to fix the issue with the following patch to patch-2.7.5:</div></div><=
div><blockquote style=3D"margin:0px 0px 0px 40px;border:none;padding:0px"><=
div><div><font face=3D"monospace, monospace">--- patch-2.7.5/src/patch.c =
=C2=A0 =C2=A0 2015-03-07 00:34:20.000000000 +0000</font></div><div><font fa=
ce=3D"monospace, monospace">+++ patch-2.7.5/src/patch.c =C2=A0 =C2=A0 2017-=
05-04 16:50:29.356159495 +0100</font></div><div><font face=3D"monospace, mo=
nospace">@@ -50,7 +50,7 @@</font></div><div><font face=3D"monospace, monosp=
ace">=C2=A0static void init_output (struct outstate *);</font></div><div><f=
ont face=3D"monospace, monospace">=C2=A0static FILE *open_outfile (char con=
st *);</font></div><div><font face=3D"monospace, monospace">=C2=A0static vo=
id init_reject (char const *);</font></div><div><font face=3D"monospace, mo=
nospace">-static void reinitialize_almost_everything (void);</font></div><d=
iv><font face=3D"monospace, monospace">+static void reinitialize_almost_eve=
rything (struct outstate *);</font></div><div><font face=3D"monospace, mono=
space">=C2=A0static void remove_if_needed (char const *, bool *);</font></d=
iv><div><font face=3D"monospace, monospace">=C2=A0static void usage (FILE *=
, int) __attribute__((noreturn));</font></div><div><font face=3D"monospace,=
 monospace"><br></font></div><div><font face=3D"monospace, monospace">@@ -1=
90,7 +190,7 @@</font></div><div><font face=3D"monospace, monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 open_patch_file (patchname);</font></div><div><font fa=
ce=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 there_is_another_pa=
tch (! (inname || posixly_correct), &amp;file_type)</font></div><div><font =
face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 || apply_e=
mpty_patch;</font></div><div><font face=3D"monospace, monospace">- =C2=A0 =
=C2=A0 =C2=A0 reinitialize_almost_everything(),</font></div><div><font face=
=3D"monospace, monospace">+ =C2=A0 =C2=A0 =C2=A0 reinitialize_almost_everyt=
hing(&amp;outstate),</font></div><div><font face=3D"monospace, monospace">=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 skip_reject_file =3D false,</font></div>=
<div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 apply_empty_patch =3D false</font></div><div><font face=3D"monospace, mono=
space">=C2=A0 =C2=A0 =C2=A0) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0/* for each patch in patch file */</font></div><div=
><font face=3D"monospace, monospace">@@ -682,7 +682,7 @@</font></div><div><=
font face=3D"monospace, monospace">=C2=A0/* Prepare to find the next patch =
to do in the patch file. */</font></div><div><font face=3D"monospace, monos=
pace"><br></font></div><div><font face=3D"monospace, monospace">=C2=A0stati=
c void</font></div><div><font face=3D"monospace, monospace">-reinitialize_a=
lmost_everything (void)</font></div><div><font face=3D"monospace, monospace=
">+reinitialize_almost_everything (struct outstate *outstate)</font></div><=
div><font face=3D"monospace, monospace">=C2=A0{</font></div><div><font face=
=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0re_patch();</font></div><div>=
<font face=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0re_input();</font><=
/div><div><font face=3D"monospace, monospace">@@ -707,6 +707,9 @@</font></d=
iv><div><font face=3D"monospace, monospace"><br></font></div><div><font fac=
e=3D"monospace, monospace">=C2=A0 =C2=A0 =C2=A0reverse =3D reverse_flag_spe=
cified;</font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 =
=C2=A0skip_rest_of_patch =3D false;</font></div><div><font face=3D"monospac=
e, monospace">+</font></div><div><font face=3D"monospace, monospace">+ =C2=
=A0 =C2=A0outstate-&gt;after_newline =3D true;</font></div><div><font face=
=3D"monospace, monospace">+ =C2=A0 =C2=A0outstate-&gt;zero_output =3D true;=
</font></div><div><font face=3D"monospace, monospace">=C2=A0}</font></div><=
div><font face=3D"monospace, monospace"><br></font></div><div><font face=3D=
"monospace, monospace">=C2=A0static char const shortopts[] =3D &quot;bB:cd:=
D:eEfF:g:i:l&quot;</font></div></div></blockquote><div><br></div>Resetting =
zero_output might not be necessary, but after_newline needs to be reset whe=
n we move on to patching the next file.</div><div><br></div><div>Best regar=
ds</div><div>Barry Davis<br><blockquote style=3D"margin:0px 0px 0px 40px;bo=
rder:none;padding:0px"><div><div><br></div></div></blockquote></div><div><b=
r></div><div><br></div></div><div class=3D"gmail_extra"><br><div class=3D"g=
mail_quote">On 4 May 2017 at 14:44, Barry Davis <span dir=3D"ltr">&lt;<a hr=
ef=3D"mailto:barry_davis@stormagic.com" target=3D"_blank">barry_davis@storm=
agic.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div>I&#39;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 fi=
le. This has worked fine for ages until I hit this issue with a specific pa=
tch file.<br></div><div><br></div><div><div>The issue occurs when applying =
the linux-4.4.66 patch to linux-4.4.</div><div>I get the same issue using a=
ll versions of patch I&#39;ve tried including v2.5.4 and the latest v2.7.5.=
</div></div><div><br></div><div>To help you reproduce:<br></div><div>wget <=
a href=3D"https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz" ta=
rget=3D"_blank">https://cdn.kernel.org/pub/<wbr>linux/kernel/v4.x/linux-4.4=
.<wbr>tar.xz</a><br></div><div>wget <a href=3D"https://cdn.kernel.org/pub/l=
inux/kernel/v4.x/patch-4.4.66.xz" target=3D"_blank">https://cdn.kernel.org/=
pub/<wbr>linux/kernel/v4.x/patch-4.4.<wbr>66.xz</a><br></div><div>tar xvf o=
pensource/packages/linux-4.4.<wbr>tar.xz<br></div><div><div>xzcat patch-4.4=
.66.xz &gt; patch-4.4.66</div></div><div><br></div><div><div>bdavis@ubuntuv=
sabuild:~$ cat /etc/lsb-release</div><div>DISTRIB_ID=3DUbuntu</div><div>DIS=
TRIB_RELEASE=3D16.04</div><div>DISTRIB_CODENAME=3Dxenial</div><div>DISTRIB_=
DESCRIPTION=3D&quot;Ubuntu 16.04.2 LTS&quot;</div></div><div><br></div><div=
><div>bdavis@ubuntuvsabuild:~$ patch --version</div><div>GNU patch 2.7.5</d=
iv></div><div><br></div><div>bdavis@ubuntuvsabuild:~$ patch -d linux-4.4 -N=
p1 -i ../patch-4.4.66 -o tmp --reject-file=3Dpatch-4.4.66.rej<br></div><div=
><div>patching file tmp (read from Documentation/ABI/testing/<wbr>sysfs-bus=
-iio-proximity-<wbr>as3935)</div><div>patching file tmp (read from Document=
ation/ABI/testing/<wbr>sysfs-bus-usb)</div><div>patching file tmp (read fro=
m Documentation/Makefile)</div></div><div>&lt;snip&gt;</div><div><div>patch=
ing file tmp (read from drivers/gpu/drm/drm_irq.c)</div><div>patching file =
tmp (read from drivers/gpu/drm/drm_modes.c)</div><div>patching file tmp (re=
ad from drivers/gpu/drm/drm_prime.c)</div><div>patch: patch.c:1419: apply_h=
unk: Assertion `outstate-&gt;after_newline&#39; failed.</div><div>Aborted (=
core dumped)</div><div>bdavis@ubuntuvsabuild:~$</div></div><div><br></div><=
div><br></div></div>
</blockquote></div><br></div>

--f403045e6aa228be68054ec388ce--


