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

RE: [EXTERNAL] Re: git apply fails with 'error: git apply: failed to read: No such file or directory'

From
PVPremek Vysoky <premek.vysoky@microsoft.com>
Date
Jun 24, 2023, 10:28 UTC
Message-ID
<AM7PR83MB041804AFB4F0F8E850C51039EA20A@AM7PR83MB0418.EURPRD83.prod.outlook.com>
In-Reply-To
<fff79e55-cf35-b5ca-6208-dfa7234be33d@gmail.com>
Hi Phillip,

Thanks for the fast response! And thanks for the improvement if you decide to make this more obvious. I must have used an older git version earlier as I was able to process even 3GB patches easily.

Too bad there is no override for this.. (we're working on a .NET monorepo - https://github.com/dotnet/dotnet - so one of a kind, and we hit these limits at times)

Cheers, Premek

-----Original Message-----
From: Phillip Wood <phillip.wood123@gmail.com> 
Sent: Saturday, June 24, 2023 12:09 PM
To: Premek Vysoky <Premek.Vysoky@microsoft.com>; git@vger.kernel.org
Subject: [EXTERNAL] Re: git apply fails with 'error: git apply: failed to read: No such file or directory'
Hi Premek
Thanks for taking the time to report this issue
On 23/06/2023 13:42, Premek Vysoky wrote:
Show 19 quoted lines
> What did you do before the bug happened? (Steps to reproduce your 
> issue) git clone 
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> ub.com%2Fdotnet%2Fllvm-project&data=05%7C01%7CPremek.Vysoky%40microsof
> t.com%7Ca9684566250842b65be608db749b030b%7C72f988bf86f141af91ab2d7cd01
> 1db47%7C1%7C0%7C638231981398613951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4
> wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7
> C&sdata=prrT8WKHGtvll2XG%2FKSrxSOplev6eLjjeBGu%2FRQzOMg%3D&reserved=0
> git -C llvm-project diff --patch --binary --output ../llvm.patch 4b825dc642cb6eb9a060e54bf8d69288fbee4904..30e9e6bc2e9f04e0a75daf4b8088ee91f66069da -- ':(glob)**/*' ':(exclude,glob)**/*.dll' ':(exclude,glob)**/*.Dll' ':(exclude,glob)**/*.exe' ':(exclude,glob)**/*.pdb' ':(exclude,glob)**/*.mdb' ':(exclude,glob)**/*.zip' ':(exclude,glob)**/*.nupkg'
> mkdir foo
> git -C foo init
> git -C foo apply --cached --ignore-space-change ../llvm.patch
>
> What did you expect to happen? (Expected behavior) Patch should be 
> created and applied to another folder
>
> What happened instead? (Actual behavior) git apply fails with 'error: 
> git apply: failed to read: No such file or directory'
> (and returns 128)
This stems from commit f1c0e3946e (apply: reject patches larger than ~1 GiB, 2022-10-25). Unfortunately it does not provide a very helpful error message. I'll submit a patch later to fix that in the next few days.
Best Wishes
Phillip
Show 39 quoted lines
> What's different between what you expected and what actually happened?
> There is no error. I tried -v, --reject etc but wasn't able to get any details.
>
> Anything else you want to add:
> This happens in both Windows and Linux environments.
>
> I tried analyzing file handlers via procmon.exe and could not see anything. git reads the whole patch and then shuts down. No indication of a file it is trying to open.
>
> I tried excluding more files from the patch and then I was able to create/apply the patch, like so:
>
> git -C llvm-project diff --patch --binary --output ../llvm.patch 4b825dc642cb6eb9a060e54bf8d69288fbee4904..30e9e6bc2e9f04e0a75daf4b8088ee91f66069da -- ':(glob)**/*' ':(exclude,glob)**/*.dll' ':(exclude,glob)**/*.Dll' ':(exclude,glob)**/*.exe' ':(exclude,glob)**/*.pdb' ':(exclude,glob)**/*.mdb' ':(exclude,glob)**/*.zip' ':(exclude,glob)**/*.nupkg' ':(exclude,glob)bolt' ':(exclude,glob)clang/docs' ':(exclude,glob)clang/www' ':(exclude,glob)flang' ':(exclude,glob)libclc' ':(exclude,glob)lldb' ':(exclude,glob)llvm/docs' ':(exclude,glob)mlir' ':(exclude,glob)openmp' ':(exclude,glob)polly' ':(exclude,glob)pstl' ':(exclude,glob)third-party' ':(exclude,glob)**/tests/**'
>
> But if I do the opposite and create a patch with only the previously excluded files, I'd expect that it breaks. But this works as well!
>
> git -C llvm-project diff --patch --binary --output ../llvm.patch 4b825dc642cb6eb9a060e54bf8d69288fbee4904..30e9e6bc2e9f04e0a75daf4b8088ee91f66069da -- ':(glob)bolt' ':(glob)clang/docs' ':(glob)clang/www' ':(glob)flang' ':(glob)libclc' ':(glob)lldb' ':(glob)llvm/docs' ':(glob)mlir' ':(glob)openmp' ':(glob)polly' ':(glob)pstl' ':(glob)third-party' ':(glob)**/tests/**' ':(exclude,glob)**/*.dll' ':(exclude,glob)**/*.Dll' ':(exclude,glob)**/*.exe' ':(exclude,glob)**/*.pdb' ':(exclude,glob)**/*.mdb' ':(exclude,glob)**/*.zip' ':(exclude,glob)**/*.nupkg'
>
> Only when they are together, git fails. Size of the patch is 1GB but I've had 3GB patches apply successfully before.
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.41.0.windows.1
> cpu: x86_64
> built from commit: ff94e79c4724635915dbb3d4ba38f6bb91528260
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 22621
> compiler info: gnuc: 13.1
> libc info: no libc information available $SHELL (typically, 
> interactive shell): <unset>
>
>
> [Enabled Hooks]
> not run from a git repository - no hooks to show
Previous: Phillip WoodNext: Phillip Wood
Message 3 of 4 in “git apply fails with 'error: git apply: failed to read: No such file or directory'”
  1. Premek VysokyJun 23, 2023
  2. Phillip WoodJun 24, 2023
  3. Premek VysokyJun 24, 2023
  4. Phillip WoodJun 24, 2023

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.