{"thread":{"id":"49485","subject":"[BUG] Error while trying to git apply a patch; works with patch -p1","startedAt":"2018-10-04T21:01:27Z","lastAt":"2018-10-05T13:16:08Z","messageCount":4,"participants":["Eneas Queiroz","SZEDER Gábor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"359634","messageId":"CAPxccB1VnDV5BjkcFcoPVmegJSg6iN_tD3o0e9G2XKXaM_=4KA@mail.gmail.com","threadId":"49485","inReplyTo":null,"subject":"[BUG] Error while trying to git apply a patch; works with patch -p1","fromName":"Eneas Queiroz","fromEmail":"cotequeiroz@gmail.com","sentAt":"2018-10-04T21:01:11Z","receivedAt":"2018-10-04T21:01:27Z","isPatch":false,"sender":{"key":"cotequeiroz@gmail.com","avatar":null},"body":"I've sent this to the list 2 days ago, but I can't find it in the list\narchives, so I'm sending it again without files attached.  I apologize\nif this is a duplicate. One should be able to reproduce this with the\ncurrent PR files, but if not, I can provide them.\n\nI've hit a strange error while trying to apply a patch from github\nhere: https://github.com/openwrt/openwrt/pull/965\n\n965.patch:452: trailing whitespace.\n\n965.patch:559: space before tab in indent.\n             -o $(SHLIBNAME_FULL) \\\n965.patch:560: space before tab in indent.\n             $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \\\n965.patch:564: space before tab in indent.\n        -o $(SHLIBNAME_FULL) \\\n965.patch:2334: trailing whitespace.\n\nerror: package/libs/openssl/patches/100-Configure-afalg-support.patch:\nNo such file or directory\nerror: package/libs/openssl/patches/110-openwrt_targets.patch: No such\nfile or directory\nerror: package/libs/openssl/patches/120-fix_link_segfault.patch: No\nsuch file or directory\nerror: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:\nNo such file or directory\nerror: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:\nNo such file or directory\n\nIf you get the patch file from\nhttps://github.com/openwrt/openwrt/pull/965.patch and apply it with\ngit apply, it fails.  If I apply the same file with patch -p1, it\nworks fine.  I've tried it with git 2.16.4 and 2.19, and they both\nfail with the same error, and at least 2 more people have confirmed\nit.\n\ngit apply fails even when using git format-patch -13 --stdout as a\nsource, so it is not github doing something weird.\n\nThe file is a series of 13 patches.  If I split the series after the\n3rd patch, it works.\nAlso, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.\n\nI'm not subscribed to the list, so please CC me.\n\nCheers,\n\nEneas\n"},{"id":"359637","messageId":"20181004214533.GS23446@localhost","threadId":"49485","inReplyTo":"CAPxccB1VnDV5BjkcFcoPVmegJSg6iN_tD3o0e9G2XKXaM_=4KA@mail.gmail.com","subject":"Re: [BUG] Error while trying to git apply a patch; works with patch -p1","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-10-04T21:45:33Z","receivedAt":"2018-10-04T21:45:39Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:\n> I've sent this to the list 2 days ago, but I can't find it in the list\n> archives, so I'm sending it again without files attached.  I apologize\n> if this is a duplicate. One should be able to reproduce this with the\n> current PR files, but if not, I can provide them.\n> \n> I've hit a strange error while trying to apply a patch from github\n> here: https://github.com/openwrt/openwrt/pull/965\n> \n> 965.patch:452: trailing whitespace.\n> \n> 965.patch:559: space before tab in indent.\n>              -o $(SHLIBNAME_FULL) \\\n> 965.patch:560: space before tab in indent.\n>              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \\\n> 965.patch:564: space before tab in indent.\n>         -o $(SHLIBNAME_FULL) \\\n> 965.patch:2334: trailing whitespace.\n> \n> error: package/libs/openssl/patches/100-Configure-afalg-support.patch:\n> No such file or directory\n> error: package/libs/openssl/patches/110-openwrt_targets.patch: No such\n> file or directory\n> error: package/libs/openssl/patches/120-fix_link_segfault.patch: No\n> such file or directory\n> error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:\n> No such file or directory\n> error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:\n> No such file or directory\n> \n> If you get the patch file from\n> https://github.com/openwrt/openwrt/pull/965.patch and apply it with\n> git apply, it fails.  If I apply the same file with patch -p1, it\n> works fine.  I've tried it with git 2.16.4 and 2.19, and they both\n> fail with the same error, and at least 2 more people have confirmed\n> it.\n> \n> git apply fails even when using git format-patch -13 --stdout as a\n> source, so it is not github doing something weird.\n> \n> The file is a series of 13 patches.  If I split the series after the\n\nSo this is no _a_ patch, then, but a mailbox of patches.  'git apply'\nis supposed to apply a single a patch; apparently 'patch' is more\nlenient.\n\nHave you tried 'git am'?\n\n> 3rd patch, it works.\n> Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.\n> \n> I'm not subscribed to the list, so please CC me.\n> \n> Cheers,\n> \n> Eneas\n"},{"id":"359669","messageId":"CAPxccB2B2Cq=CQZ3D8rmvqc63pUV3f1hc_Ngt5nWStR-getpjA@mail.gmail.com","threadId":"49485","inReplyTo":"20181004214533.GS23446@localhost","subject":"Re: [BUG] Error while trying to git apply a patch; works with patch -p1","fromName":"Eneas Queiroz","fromEmail":"cotequeiroz@gmail.com","sentAt":"2018-10-05T12:17:54Z","receivedAt":"2018-10-05T12:18:08Z","isPatch":false,"sender":{"key":"cotequeiroz@gmail.com","avatar":null},"body":"Em qui, 4 de out de 2018 às 18:45, SZEDER Gábor <szeder.dev@gmail.com> escreveu:\n>\n> On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:\n> > I've sent this to the list 2 days ago, but I can't find it in the list\n> > archives, so I'm sending it again without files attached.  I apologize\n> > if this is a duplicate. One should be able to reproduce this with the\n> > current PR files, but if not, I can provide them.\n> >\n> > I've hit a strange error while trying to apply a patch from github\n> > here: https://github.com/openwrt/openwrt/pull/965\n> >\n> > 965.patch:452: trailing whitespace.\n> >\n> > 965.patch:559: space before tab in indent.\n> >              -o $(SHLIBNAME_FULL) \\\n> > 965.patch:560: space before tab in indent.\n> >              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \\\n> > 965.patch:564: space before tab in indent.\n> >         -o $(SHLIBNAME_FULL) \\\n> > 965.patch:2334: trailing whitespace.\n> >\n> > error: package/libs/openssl/patches/100-Configure-afalg-support.patch:\n> > No such file or directory\n> > error: package/libs/openssl/patches/110-openwrt_targets.patch: No such\n> > file or directory\n> > error: package/libs/openssl/patches/120-fix_link_segfault.patch: No\n> > such file or directory\n> > error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:\n> > No such file or directory\n> > error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:\n> > No such file or directory\n> >\n> > If you get the patch file from\n> > https://github.com/openwrt/openwrt/pull/965.patch and apply it with\n> > git apply, it fails.  If I apply the same file with patch -p1, it\n> > works fine.  I've tried it with git 2.16.4 and 2.19, and they both\n> > fail with the same error, and at least 2 more people have confirmed\n> > it.\n> >\n> > git apply fails even when using git format-patch -13 --stdout as a\n> > source, so it is not github doing something weird.\n> >\n> > The file is a series of 13 patches.  If I split the series after the\n>\n> So this is no _a_ patch, then, but a mailbox of patches.  'git apply'\n> is supposed to apply a single a patch; apparently 'patch' is more\n> lenient.\n>\n> Have you tried 'git am'?\n>\n> > 3rd patch, it works.\n> > Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.\n> >\n> > I'm not subscribed to the list, so please CC me.\n> >\n> > Cheers,\n> >\n> > Eneas\n\nThanks for the reply.  Is that expected behavior?  git apply seems to\nwork in most similar cases.\n\ngit am works fine--although it complains a lot about whitespace errors\nwhen patching *.patch output files.\n\nI know they're just warnings, but perhaps git apply/am should suppress\nthem when creating/patching a *.patch file, since context lines in\n'*.patch' files all start with a space.\n\nCheers,\n\nEneas\n"},{"id":"359685","messageId":"20181005131602.GU23446@localhost","threadId":"49485","inReplyTo":"CAPxccB2B2Cq=CQZ3D8rmvqc63pUV3f1hc_Ngt5nWStR-getpjA@mail.gmail.com","subject":"Re: [BUG] Error while trying to git apply a patch; works with patch -p1","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-10-05T13:16:02Z","receivedAt":"2018-10-05T13:16:08Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Oct 05, 2018 at 09:17:54AM -0300, Eneas Queiroz wrote:\n> Em qui, 4 de out de 2018 às 18:45, SZEDER Gábor <szeder.dev@gmail.com> escreveu:\n> >\n> > On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:\n> > > I've sent this to the list 2 days ago, but I can't find it in the list\n> > > archives, so I'm sending it again without files attached.  I apologize\n> > > if this is a duplicate. One should be able to reproduce this with the\n> > > current PR files, but if not, I can provide them.\n> > >\n> > > I've hit a strange error while trying to apply a patch from github\n> > > here: https://github.com/openwrt/openwrt/pull/965\n> > >\n> > > 965.patch:452: trailing whitespace.\n> > >\n> > > 965.patch:559: space before tab in indent.\n> > >              -o $(SHLIBNAME_FULL) \\\n> > > 965.patch:560: space before tab in indent.\n> > >              $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \\\n> > > 965.patch:564: space before tab in indent.\n> > >         -o $(SHLIBNAME_FULL) \\\n> > > 965.patch:2334: trailing whitespace.\n> > >\n> > > error: package/libs/openssl/patches/100-Configure-afalg-support.patch:\n> > > No such file or directory\n> > > error: package/libs/openssl/patches/110-openwrt_targets.patch: No such\n> > > file or directory\n> > > error: package/libs/openssl/patches/120-fix_link_segfault.patch: No\n> > > such file or directory\n> > > error: package/libs/openssl/patches/1.1.0/100-Configure-afalg-support.patch:\n> > > No such file or directory\n> > > error: package/libs/openssl/patches/1.1.0/110-openwrt_targets.patch:\n> > > No such file or directory\n> > >\n> > > If you get the patch file from\n> > > https://github.com/openwrt/openwrt/pull/965.patch and apply it with\n> > > git apply, it fails.  If I apply the same file with patch -p1, it\n> > > works fine.  I've tried it with git 2.16.4 and 2.19, and they both\n> > > fail with the same error, and at least 2 more people have confirmed\n> > > it.\n> > >\n> > > git apply fails even when using git format-patch -13 --stdout as a\n> > > source, so it is not github doing something weird.\n> > >\n> > > The file is a series of 13 patches.  If I split the series after the\n> >\n> > So this is no _a_ patch, then, but a mailbox of patches.  'git apply'\n> > is supposed to apply a single a patch; apparently 'patch' is more\n> > lenient.\n> >\n> > Have you tried 'git am'?\n> >\n> > > 3rd patch, it works.\n> > > Also, if I use https://github.com/openwrt/openwrt/pull/965.diff, it also works.\n> > >\n> > > I'm not subscribed to the list, so please CC me.\n> > >\n> > > Cheers,\n> > >\n> > > Eneas\n> \n> Thanks for the reply.  Is that expected behavior?  git apply seems to\n> work in most similar cases.\n\nOh, I'm surprised by that; but I rarely use 'git apply' directly, as I\napply even single patches with 'git am'.\n\n> git am works fine--although it complains a lot about whitespace errors\n> when patching *.patch output files.\n> \n> I know they're just warnings, but perhaps git apply/am should suppress\n> them when creating/patching a *.patch file, since context lines in\n> '*.patch' files all start with a space.\n\n'git am' and 'git apply' don't know or care about filetypes, and\nneither does the rest of Git for that matter, unless you explicitly\ntell them to.  With a proper .gitattributes entry you can tell them to\nignore all or only specific types of whitespace errors in '*.patch'\nfiles, e.g.:\n\n  *.patch -whitespace\n\nor\n\n  *.patch whitespace=-space-before-tab,-blank-at-eol\n\n"}]}