git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [BUG] Error while trying to git apply a patch; works with patch -p1
@ 2018-10-04 21:01 Eneas Queiroz
  2018-10-04 21:45 ` SZEDER Gábor
  0 siblings, 1 reply; 4+ messages in thread
From: Eneas Queiroz @ 2018-10-04 21:01 UTC (permalink / raw)
  To: git

I've sent this to the list 2 days ago, but I can't find it in the list
archives, so I'm sending it again without files attached.  I apologize
if this is a duplicate. One should be able to reproduce this with the
current PR files, but if not, I can provide them.

I've hit a strange error while trying to apply a patch from github
here: https://github.com/openwrt/openwrt/pull/965

965.patch:452: trailing whitespace.

965.patch:559: space before tab in indent.
             -o $(SHLIBNAME_FULL) \
965.patch:560: space before tab in indent.
             $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
965.patch:564: space before tab in indent.
        -o $(SHLIBNAME_FULL) \
965.patch:2334: trailing whitespace.

error: package/libs/openssl/patches/100-Configure-afalg-support.patch:
No such file or directory
error: package/libs/openssl/patches/110-openwrt_targets.patch: No such
file or directory
error: package/libs/openssl/patches/120-fix_link_segfault.patch: No
such file or directory
error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:
No such file or directory
error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:
No such file or directory

If you get the patch file from
https://github.com/openwrt/openwrt/pull/965.patch and apply it with
git apply, it fails.  If I apply the same file with patch -p1, it
works fine.  I've tried it with git 2.16.4 and 2.19, and they both
fail with the same error, and at least 2 more people have confirmed
it.

git apply fails even when using git format-patch -13 --stdout as a
source, so it is not github doing something weird.

The file is a series of 13 patches.  If I split the series after the
3rd patch, it works.
Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.

I'm not subscribed to the list, so please CC me.

Cheers,

Eneas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Error while trying to git apply a patch; works with patch -p1
  2018-10-04 21:01 [BUG] Error while trying to git apply a patch; works with patch -p1 Eneas Queiroz
@ 2018-10-04 21:45 ` SZEDER Gábor
  2018-10-05 12:17   ` Eneas Queiroz
  0 siblings, 1 reply; 4+ messages in thread
From: SZEDER Gábor @ 2018-10-04 21:45 UTC (permalink / raw)
  To: Eneas Queiroz; +Cc: git

On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:
> I've sent this to the list 2 days ago, but I can't find it in the list
> archives, so I'm sending it again without files attached.  I apologize
> if this is a duplicate. One should be able to reproduce this with the
> current PR files, but if not, I can provide them.
> 
> I've hit a strange error while trying to apply a patch from github
> here: https://github.com/openwrt/openwrt/pull/965
> 
> 965.patch:452: trailing whitespace.
> 
> 965.patch:559: space before tab in indent.
>              -o $(SHLIBNAME_FULL) \
> 965.patch:560: space before tab in indent.
>              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
> 965.patch:564: space before tab in indent.
>         -o $(SHLIBNAME_FULL) \
> 965.patch:2334: trailing whitespace.
> 
> error: package/libs/openssl/patches/100-Configure-afalg-support.patch:
> No such file or directory
> error: package/libs/openssl/patches/110-openwrt_targets.patch: No such
> file or directory
> error: package/libs/openssl/patches/120-fix_link_segfault.patch: No
> such file or directory
> error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:
> No such file or directory
> error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:
> No such file or directory
> 
> If you get the patch file from
> https://github.com/openwrt/openwrt/pull/965.patch and apply it with
> git apply, it fails.  If I apply the same file with patch -p1, it
> works fine.  I've tried it with git 2.16.4 and 2.19, and they both
> fail with the same error, and at least 2 more people have confirmed
> it.
> 
> git apply fails even when using git format-patch -13 --stdout as a
> source, so it is not github doing something weird.
> 
> The file is a series of 13 patches.  If I split the series after the

So this is no _a_ patch, then, but a mailbox of patches.  'git apply'
is supposed to apply a single a patch; apparently 'patch' is more
lenient.

Have you tried 'git am'?

> 3rd patch, it works.
> Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.
> 
> I'm not subscribed to the list, so please CC me.
> 
> Cheers,
> 
> Eneas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Error while trying to git apply a patch; works with patch -p1
  2018-10-04 21:45 ` SZEDER Gábor
@ 2018-10-05 12:17   ` Eneas Queiroz
  2018-10-05 13:16     ` SZEDER Gábor
  0 siblings, 1 reply; 4+ messages in thread
From: Eneas Queiroz @ 2018-10-05 12:17 UTC (permalink / raw)
  To: szeder.dev; +Cc: git

Em qui, 4 de out de 2018 às 18:45, SZEDER Gábor <szeder.dev@gmail.com> escreveu:
>
> On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:
> > I've sent this to the list 2 days ago, but I can't find it in the list
> > archives, so I'm sending it again without files attached.  I apologize
> > if this is a duplicate. One should be able to reproduce this with the
> > current PR files, but if not, I can provide them.
> >
> > I've hit a strange error while trying to apply a patch from github
> > here: https://github.com/openwrt/openwrt/pull/965
> >
> > 965.patch:452: trailing whitespace.
> >
> > 965.patch:559: space before tab in indent.
> >              -o $(SHLIBNAME_FULL) \
> > 965.patch:560: space before tab in indent.
> >              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
> > 965.patch:564: space before tab in indent.
> >         -o $(SHLIBNAME_FULL) \
> > 965.patch:2334: trailing whitespace.
> >
> > error: package/libs/openssl/patches/100-Configure-afalg-support.patch:
> > No such file or directory
> > error: package/libs/openssl/patches/110-openwrt_targets.patch: No such
> > file or directory
> > error: package/libs/openssl/patches/120-fix_link_segfault.patch: No
> > such file or directory
> > error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:
> > No such file or directory
> > error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:
> > No such file or directory
> >
> > If you get the patch file from
> > https://github.com/openwrt/openwrt/pull/965.patch and apply it with
> > git apply, it fails.  If I apply the same file with patch -p1, it
> > works fine.  I've tried it with git 2.16.4 and 2.19, and they both
> > fail with the same error, and at least 2 more people have confirmed
> > it.
> >
> > git apply fails even when using git format-patch -13 --stdout as a
> > source, so it is not github doing something weird.
> >
> > The file is a series of 13 patches.  If I split the series after the
>
> So this is no _a_ patch, then, but a mailbox of patches.  'git apply'
> is supposed to apply a single a patch; apparently 'patch' is more
> lenient.
>
> Have you tried 'git am'?
>
> > 3rd patch, it works.
> > Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.
> >
> > I'm not subscribed to the list, so please CC me.
> >
> > Cheers,
> >
> > Eneas

Thanks for the reply.  Is that expected behavior?  git apply seems to
work in most similar cases.

git am works fine--although it complains a lot about whitespace errors
when patching *.patch output files.

I know they're just warnings, but perhaps git apply/am should suppress
them when creating/patching a *.patch file, since context lines in
'*.patch' files all start with a space.

Cheers,

Eneas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Error while trying to git apply a patch; works with patch -p1
  2018-10-05 12:17   ` Eneas Queiroz
@ 2018-10-05 13:16     ` SZEDER Gábor
  0 siblings, 0 replies; 4+ messages in thread
From: SZEDER Gábor @ 2018-10-05 13:16 UTC (permalink / raw)
  To: Eneas Queiroz; +Cc: git

On Fri, Oct 05, 2018 at 09:17:54AM -0300, Eneas Queiroz wrote:
> Em qui, 4 de out de 2018 às 18:45, SZEDER Gábor <szeder.dev@gmail.com> escreveu:
> >
> > On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:
> > > I've sent this to the list 2 days ago, but I can't find it in the list
> > > archives, so I'm sending it again without files attached.  I apologize
> > > if this is a duplicate. One should be able to reproduce this with the
> > > current PR files, but if not, I can provide them.
> > >
> > > I've hit a strange error while trying to apply a patch from github
> > > here: https://github.com/openwrt/openwrt/pull/965
> > >
> > > 965.patch:452: trailing whitespace.
> > >
> > > 965.patch:559: space before tab in indent.
> > >              -o $(SHLIBNAME_FULL) \
> > > 965.patch:560: space before tab in indent.
> > >              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
> > > 965.patch:564: space before tab in indent.
> > >         -o $(SHLIBNAME_FULL) \
> > > 965.patch:2334: trailing whitespace.
> > >
> > > error: package/libs/openssl/patches/100-Configure-afalg-support.patch:
> > > No such file or directory
> > > error: package/libs/openssl/patches/110-openwrt_targets.patch: No such
> > > file or directory
> > > error: package/libs/openssl/patches/120-fix_link_segfault.patch: No
> > > such file or directory
> > > error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:
> > > No such file or directory
> > > error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:
> > > No such file or directory
> > >
> > > If you get the patch file from
> > > https://github.com/openwrt/openwrt/pull/965.patch and apply it with
> > > git apply, it fails.  If I apply the same file with patch -p1, it
> > > works fine.  I've tried it with git 2.16.4 and 2.19, and they both
> > > fail with the same error, and at least 2 more people have confirmed
> > > it.
> > >
> > > git apply fails even when using git format-patch -13 --stdout as a
> > > source, so it is not github doing something weird.
> > >
> > > The file is a series of 13 patches.  If I split the series after the
> >
> > So this is no _a_ patch, then, but a mailbox of patches.  'git apply'
> > is supposed to apply a single a patch; apparently 'patch' is more
> > lenient.
> >
> > Have you tried 'git am'?
> >
> > > 3rd patch, it works.
> > > Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.
> > >
> > > I'm not subscribed to the list, so please CC me.
> > >
> > > Cheers,
> > >
> > > Eneas
> 
> Thanks for the reply.  Is that expected behavior?  git apply seems to
> work in most similar cases.

Oh, I'm surprised by that; but I rarely use 'git apply' directly, as I
apply even single patches with 'git am'.

> git am works fine--although it complains a lot about whitespace errors
> when patching *.patch output files.
> 
> I know they're just warnings, but perhaps git apply/am should suppress
> them when creating/patching a *.patch file, since context lines in
> '*.patch' files all start with a space.

'git am' and 'git apply' don't know or care about filetypes, and
neither does the rest of Git for that matter, unless you explicitly
tell them to.  With a proper .gitattributes entry you can tell them to
ignore all or only specific types of whitespace errors in '*.patch'
files, e.g.:

  *.patch -whitespace

or

  *.patch whitespace=-space-before-tab,-blank-at-eol


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-05 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 21:01 [BUG] Error while trying to git apply a patch; works with patch -p1 Eneas Queiroz
2018-10-04 21:45 ` SZEDER Gábor
2018-10-05 12:17   ` Eneas Queiroz
2018-10-05 13:16     ` SZEDER Gábor

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).