Bizarre Issue With tar archive for MacOS build


I have a Github Action that builds a C++ command-line tool for both MacOS and Linux. The Linux build works fine, but recently the MacOS build has broken in a particularly weird way.

The last steps of my action are to create a .tar.gz file containing the command-line tool, which I can then upload to my Github Releases. The tar step on MacOS is now producing a gibberish file - it’s half the size expected, and contains nonsense. I have no idea why this is happening.

The most recent run of my Action is here: (I don’t know if others can see this?)

I have added an ls -lh to the step which makes the .tar.gz file. The relevant output on Linux is:

2020-11-24T23:56:33.3663933Z ##[group]Run mv ./build/Source/qi ./qi
2020-11-24T23:56:33.3664533Z e[36;1mmv ./build/Source/qi ./qie[0m
2020-11-24T23:56:33.3664988Z e[36;1mtar -czvf qi-linux.tar.gz qie[0m
2020-11-24T23:56:33.3665380Z e[36;1mls -lhe[0m
2020-11-24T23:56:33.3724546Z shell: /bin/bash --noprofile --norc -e -o pipefail {0}
2020-11-24T23:56:33.3725026Z env:
2020-11-24T23:56:33.3725405Z   BUILD_TYPE: Release
2020-11-24T23:56:33.3725863Z   VCPKG_PATH: /home/runner/work/QUIT/QUIT/vcpkg
2020-11-24T23:56:33.3726569Z   VCPKGRESPONSEFILE: /home/runner/work/QUIT/QUIT/.github/workflows/response_file.txt
2020-11-24T23:56:33.3728997Z   RUNVCPKG_VCPKG_ROOT: /home/runner/work/QUIT/QUIT/vcpkg
2020-11-24T23:56:33.3729542Z   VCPKG_ROOT: /home/runner/work/QUIT/QUIT/vcpkg
2020-11-24T23:56:33.3730028Z   AZP_CACHING_CONTENT_FORMAT: Files
2020-11-24T23:56:33.3730626Z   pythonLocation: /opt/hostedtoolcache/Python/3.7.9/x64
2020-11-24T23:56:33.3731122Z ##[endgroup]
2020-11-24T23:56:33.3943539Z qi
2020-11-24T23:56:34.6027256Z total 31M
2020-11-24T23:56:34.6038227Z drwxr-xr-x  6 runner docker 4.0K Nov 24 23:45 build
2020-11-24T23:56:34.6040447Z -rwxr-xr-x  1 runner docker  249 Nov 24 22:43
2020-11-24T23:56:34.6041790Z -rw-r--r--  1 runner docker 1.2K Nov 24 22:43
2020-11-24T23:56:34.6042808Z drwxr-xr-x  2 runner docker 4.0K Nov 24 22:43 CMake
2020-11-24T23:56:34.6043856Z -rw-r--r--  1 runner docker 1.6K Nov 24 22:43 CMakeLists.txt
2020-11-24T23:56:34.6045056Z -rw-r--r--  1 runner docker 4.8K Nov 24 22:43
2020-11-24T23:56:34.6046088Z -rw-r--r--  1 runner docker 3.3K Nov 24 22:43
2020-11-24T23:56:34.6047673Z drwxr-xr-x  2 runner docker 4.0K Nov 24 22:43 Docs
2020-11-24T23:56:34.6048781Z -rw-r--r--  1 runner docker   41 Nov 24 22:43 docs_requirements.txt
2020-11-24T23:56:34.6049883Z drwxr-xr-x  3 runner docker 4.0K Nov 24 22:43 External
2020-11-24T23:56:34.6050898Z -rw-r--r--  1 runner docker 9.3K Nov 24 22:43 index.rst
2020-11-24T23:56:34.6052011Z -rw-r--r--  1 runner docker  17K Nov 24 22:43 LICENSE.txt
2020-11-24T23:56:34.6052995Z drwxr-xr-x  2 runner docker 4.0K Nov 24 22:43 Paper
2020-11-24T23:56:34.6053981Z drwxr-xr-x  5 runner docker 4.0K Nov 24 23:55 Python
2020-11-24T23:56:34.6054917Z -rwxr-xr-x  1 runner docker  23M Nov 24 23:55 qi
2020-11-24T23:56:34.6055936Z -rw-r--r--  1 runner docker 7.4M Nov 24 23:56 qi-linux.tar.gz
2020-11-24T23:56:34.6056961Z -rw-r--r--  1 runner docker 3.1K Nov 24 22:43
2020-11-24T23:56:34.6058627Z drwxr-xr-x 14 runner docker 4.0K Nov 24 22:43 Source
2020-11-24T23:56:34.6059433Z drwxr-xr-x 12 runner docker 4.0K Nov 23 22:36 vcpkg
2020-11-24T23:56:34.6060141Z -rw-r--r--  1 runner docker  185 Nov 24 22:43 vcpkg.json

Note the file-size for qi-linux.tar.gz - approx 7 Mb. This file works fine.

Now the same log from MacOS:

2020-11-25T11:13:10.5894970Z ##[group]Run mv ./build/Source/qi ./qi
2020-11-25T11:13:10.5895640Z e[36;1mmv ./build/Source/qi ./qie[0m
2020-11-25T11:13:10.5896500Z e[36;1mwhich tare[0m
2020-11-25T11:13:10.5896980Z e[36;1mtar -czvf qi-macos.tar.gz qie[0m
2020-11-25T11:13:10.5897450Z e[36;1mls -lhe[0m
2020-11-25T11:13:10.6410410Z shell: /bin/bash --noprofile --norc -e -o pipefail {0}
2020-11-25T11:13:10.6410960Z env:
2020-11-25T11:13:10.6411360Z   BUILD_TYPE: Release
2020-11-25T11:13:10.6411910Z   VCPKG_PATH: /Users/runner/work/QUIT/QUIT/vcpkg
2020-11-25T11:13:10.6412660Z   VCPKGRESPONSEFILE: /Users/runner/work/QUIT/QUIT/.github/workflows/response_file.txt
2020-11-25T11:13:10.6413480Z   RUNVCPKG_VCPKG_ROOT: /Users/runner/work/QUIT/QUIT/vcpkg
2020-11-25T11:13:10.6414080Z   VCPKG_ROOT: /Users/runner/work/QUIT/QUIT/vcpkg
2020-11-25T11:13:10.6414640Z   AZP_CACHING_CONTENT_FORMAT: Files
2020-11-25T11:13:10.6415300Z   pythonLocation: /Users/runner/hostedtoolcache/Python/3.7.9/x64
2020-11-25T11:13:10.6415970Z ##[endgroup]
2020-11-25T11:13:10.7284010Z /usr/bin/tar
2020-11-25T11:13:11.2578810Z a qi
2020-11-25T11:13:11.2658410Z total 35560
2020-11-25T11:13:11.2660040Z -rw-r--r--   1 runner  staff   1.1K Nov 25 10:20
2020-11-25T11:13:11.2661110Z drwxr-xr-x   3 runner  staff    96B Nov 25 10:20 CMake
2020-11-25T11:13:11.2662150Z -rw-r--r--   1 runner  staff   1.6K Nov 25 10:20 CMakeLists.txt
2020-11-25T11:13:11.2663410Z -rw-r--r--   1 runner  staff   3.2K Nov 25 10:20
2020-11-25T11:13:11.2664430Z drwxr-xr-x  20 runner  staff   640B Nov 25 10:20 Docs
2020-11-25T11:13:11.2665360Z drwxr-xr-x   3 runner  staff    96B Nov 25 10:20 External
2020-11-25T11:13:11.2666340Z -rw-r--r--   1 runner  staff    16K Nov 25 10:20 LICENSE.txt
2020-11-25T11:13:11.2667280Z drwxr-xr-x   4 runner  staff   128B Nov 25 10:20 Paper
2020-11-25T11:13:11.2668240Z drwxr-xr-x   7 runner  staff   224B Nov 25 11:12 Python
2020-11-25T11:13:11.2669160Z -rw-r--r--   1 runner  staff   3.1K Nov 25 10:20
2020-11-25T11:13:11.2670170Z drwxr-xr-x  17 runner  staff   544B Nov 25 10:20 Source
2020-11-25T11:13:11.2671070Z drwxr-xr-x  12 runner  staff   384B Nov 25 11:07 build
2020-11-25T11:13:11.2672040Z -rwxr-xr-x   1 runner  staff   249B Nov 25 10:20
2020-11-25T11:13:11.2673000Z -rw-r--r--   1 runner  staff   4.7K Nov 25 10:20
2020-11-25T11:13:11.2674010Z -rw-r--r--   1 runner  staff    41B Nov 25 10:20 docs_requirements.txt
2020-11-25T11:13:11.2675030Z -rw-r--r--   1 runner  staff   9.3K Nov 25 10:20 index.rst
2020-11-25T11:13:11.2675930Z -rwxr-xr-x   1 runner  staff    22M Nov 25 11:12 qi
2020-11-25T11:13:11.2676910Z -rw-r--r--   1 runner  staff   3.4M Nov 25 11:13 qi-macos.tar.gz
2020-11-25T11:13:11.2677870Z drwxr-xr-x  31 runner  staff   992B Nov 25 10:20 vcpkg
2020-11-25T11:13:11.2678820Z -rw-r--r--   1 runner  staff   185B Nov 25 10:20 vcpkg.json

And we can see that qi-macos.tar.gz is only 3.4 Mb. Half the file has disappeared! In previous runs of my Action from the summer, and on my local Mac, the file-size is around 7 Mb as for Linux.

I am totally stumped by this. It looks like the output of tar is wrong, and I have no idea why that would be. Thanks in advance to anyone who has any help!


I have the same issue:
[cache] Executable exits with 126 after restoring on macOS · Issue #619 · actions/toolkit (

1 Like

It might be worth trying to install gnu-tar through Homebrew and see if that generates valid output: gnu-tar — Homebrew Formulae

1 Like

Thanks so much - I really thought I was going mad. This problem is bizarre.

I have got as far as establishing that running tar without compression exhibits the same problem - the archive is still half the size it should be. I will try gnu-tar as you suggest.

Installing GNU-tar as a workaround appears to have been successful. Thanks again for the suggestion.

How on earth is it possible for tar to be corrupted? This is probably the weirdest bug I have encountered in years.