git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] Error while trying to git apply a patch; works with patch -p1

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Oct 4, 2018, 21:45 UTC
Message-ID
<20181004214533.GS23446@localhost>
In-Reply-To
<CAPxccB1VnDV5BjkcFcoPVmegJSg6iN_tD3o0e9G2XKXaM_=4KA@mail.gmail.com>
On Thu, Oct 04, 2018 at 06:01:11PM -0300, Eneas Queiroz wrote:
Show 40 quoted lines
> 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'?
Show 8 quoted lines
> 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
Previous: Eneas QueirozNext: Eneas Queiroz
Message 2 of 4 in “[BUG] Error while trying to git apply a patch; works with patch -p1”
  1. Eneas QueirozOct 4, 2018
  2. SZEDER GáborOct 4, 2018
  3. Eneas QueirozOct 5, 2018
  4. SZEDER GáborOct 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.