question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Windows] tar: Refusing to overwrite archive

See original GitHub issue

image

We’re hitting an issue when untar’ing a cached LLVM build on Windows:

llvm/lld/test/ELF/Inputs/aarch64-copy2.s: Refusing to overwrite archive
tar.exe: Error exit delayed from previous errors.

I’m reporting two bugs:

  1. The above error. I don’t know what’s special about this file. This part of the workflow works when we don’t hit in the cache. (This is a new workflow which I’m still debugging.)

  2. As a result of this warning, the cache-hit output variable isn’t being set but the cache has been at least partially restored, resulting in an error in the rebuild step. The intuitive behavior in case of this error is to fail in the cache step. Alternatively, don’t fail, don’t set cache-hit, but clean up the (partially) restored files. This second option would be tricky since in this case it’s overwriting the source files and adding the build outputs.

Here’s the relevant excerpt of the workflow:

      # Try to fetch LLVM from the cache.
      - name: Cache LLVM
        id: cache-llvm
        uses: actions/cache@v2
        with:
          path: llvm
          key: ${{ runner.os }}-llvm-rel-${{ steps.get-llvm-hash.outputs.hash }}

      # Build LLVM if we didn't hit in the cache. Even though we build it in
      # the previous job, there is a low chance that it'll have been evicted by
      # the time we get here.
      - name: Rebuild and Install LLVM
        if: steps.cache-llvm.outputs.cache-hit != 'true'
        shell: pwsh
        run: |
          mkdir llvm/build
          ...

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
akien-mgacommented, Jan 11, 2022

I confirm that I’m running into a similar issue today: https://github.com/godotengine/godot/runs/4778125249?check_suite_focus=true

Received 88080384 of 990229141 (8.9%), 83.9 MBs/sec
Received 213909504 of 990229141 (21.6%), 101.6 MBs/sec
Received 360710144 of 990229141 (36.4%), 114.4 MBs/sec
Received 444596224 of 990229141 (44.9%), 105.7 MBs/sec
Received 545259520 of 990229141 (55.1%), 103.7 MBs/sec
Received 675282944 of 990229141 (68.2%), 107.1 MBs/sec
Received 792723456 of 990229141 (80.1%), 107.8 MBs/sec
Received 947912704 of 990229141 (95.7%), 112.7 MBs/sec
Received 990229141 of 990229141 (100.0%), 90.3 MBs/sec
Cache Size: ~944 MB (990229141 B)
/usr/local/bin/gtar --use-compress-program zstd -d -xf /Users/runner/work/_temp/6a55a559-2ae9-4bd4-b526-8f0ac001b803/cache.tzst -P -C /Users/runner/work/godot/godot --delay-directory-restore
/*stdin*\ : Decoding error (36) : Corrupted block detected 
/usr/local/bin/gtar: Unexpected EOF in archive
/usr/local/bin/gtar: Unexpected EOF in archive
/usr/local/bin/gtar: Error is not recoverable: exiting now
Warning: Tar failed with error: The process '/usr/local/bin/gtar' failed with exit code 2

There’s an unrecoverable error but the partially unarchived cache is still used, and the build fails due to a truncated file, which in turns makes all PR builds fail similarly.

/Applications/Xcode_13.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: object: editor/libeditor.osx.opt.tools.64.a(style_box_editor_plugin.osx.opt.tools.64.o) truncated or malformed object (LC_SEGMENT_64 command 0 fileoff field plus filesize field extends past the end of the file)

(This on the macOS running, I guess the issue is not Windows specific.)

I would expect that failing to restore the cache leads to a clean build (and upload of a fixed cache).

Edit: To clarify, my cache restore error is not the same as @teqdruid’s, but the outcome is the same: the cache is partially restored but the step still passes, and this partial but damaged cache is used and breaks the build step.

0reactions
tangosixcommented, Mar 1, 2022

I am running into this same issue as well. cache is corrupted and truncates the packages causing build errors:

2022-03-01T04:15:41.6017000Z with:
2022-03-01T04:15:41.6017291Z   path: Library
2022-03-01T04:15:41.6017746Z   key: Library-e713e337fb93a96305fcf8866b66bd4e81333a7182968cf4635d8ae330ac62d7-2
2022-03-01T04:15:41.6018354Z   restore-keys: Library-

2022-03-01T04:15:41.6018681Z ##[endgroup]
2022-03-01T04:15:43.0884792Z Received 54525952 of 2317542429 (2.4%), 51.9 MBs/sec
2022-03-01T04:15:44.0904435Z Received 260046848 of 2317542429 (11.2%), 123.8 MBs/sec
2022-03-01T04:15:45.0912702Z Received 478150656 of 2317542429 (20.6%), 151.8 MBs/sec
2022-03-01T04:15:46.0919199Z Received 687865856 of 2317542429 (29.7%), 163.8 MBs/sec
2022-03-01T04:15:47.0915408Z Received 901775360 of 2317542429 (38.9%), 171.9 MBs/sec
2022-03-01T04:15:48.0920924Z Received 1098907648 of 2317542429 (47.4%), 174.6 MBs/sec
2022-03-01T04:15:49.0915204Z Received 1300234240 of 2317542429 (56.1%), 177.0 MBs/sec
2022-03-01T04:15:50.0924768Z Received 1455423488 of 2317542429 (62.8%), 173.4 MBs/sec
2022-03-01T04:15:51.0931969Z Received 1560281088 of 2317542429 (67.3%), 165.2 MBs/sec
2022-03-01T04:15:52.0926845Z Received 1665138688 of 2317542429 (71.8%), 158.7 MBs/sec
2022-03-01T04:15:53.0926233Z Received 1795162112 of 2317542429 (77.5%), 155.6 MBs/sec
2022-03-01T04:15:54.0928338Z Received 1950351360 of 2317542429 (84.2%), 154.9 MBs/sec
2022-03-01T04:15:55.0929776Z Received 2092957696 of 2317542429 (90.3%), 153.5 MBs/sec
2022-03-01T04:16:01.9444992Z Received 2147483647 of 2317542429 (92.7%), 103.1 MBs/sec
2022-03-01T04:16:02.9445600Z Received 2239758335 of 2317542429 (96.6%), 102.4 MBs/sec
2022-03-01T04:16:03.7189476Z Received 2317542429 of 2317542429 (100.0%), 102.2 MBs/sec
2022-03-01T04:16:03.7207319Z Cache Size: ~2210 MB (2317542429 B)
2022-03-01T04:16:04.2796330Z [command]/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/23bf9439-7c0b-4748-ac3f-d01f106bdf48/cache.tzst -P -C /home/runner/work/AtkWgn-ScrapGuilds/AtkWgn-ScrapGuilds
2022-03-01T04:16:14.1251647Z /*stdin*\ : Decoding error (36) : Corrupted block detected 
2022-03-01T04:16:14.1257229Z /usr/bin/tar: Unexpected EOF in archive
2022-03-01T04:16:14.1257901Z /usr/bin/tar: Unexpected EOF in archive
2022-03-01T04:16:14.1258389Z /usr/bin/tar: Error is not recoverable: exiting now
2022-03-01T04:16:14.4122329Z [warning]Tar failed with error: The process '/usr/bin/tar' failed with exit code 2

This is on a linux runner.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid overwriting existing files while using tar command?
alias tar=tar --backup=simple This will append a ~ to the file it is about to overwrite. So when you create the archive it...
Read more >
Options Controlling the Overwriting of Existing Files - GNU.org
To be more aggressive about altering existing files, use the ' --overwrite ' option. It causes tar to overwrite existing files and to...
Read more >
Overwriting files when extracting from a tar archive - Ask Ubuntu
See this answer. If you archive has one top level folder you can use --strip-components 1 , to remove first folder from full...
Read more >
Tar failing to extract specific files - Super User
As a workaround, you could install WSL and a Linux distribution on Windows and unpack the files in there. See Windows Subsystem for...
Read more >
Does tar extraction overwrite existing files? - Hosting - SitePoint
tar -xvf command will overwrite the files. Suppose if you use “-k” then it will keep your old files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found