Learning center

A script from the artifact is not executable

When files travel in a zip, execute permission and symbolic links depend on the tools at both ends. If either matters to the reproduction, put a tar file inside the transfer and send a manifest.

What survived in each path#

The directory holds run.sh with mode 755 and link, a symlink to it.

Pathrun.shlink
tar cf, tar xf755A symlink
Python zipfile, written and extracted by zipfile664A regular file, a copy of the target
zip -r, unzip755A regular file with mode 755
zip -ry, unzip755A symlink

In the second row, the archive did record 755. Reading the entry's attributes showed 0o100755, and extractall did not apply it. So "it is a zip" does not answer the question, and neither does listing the archive. The mode of extracted files also depends on the receiver's umask. Run with Python 3.12 on Linux.

For GitHub Actions, the upload-artifact README says: "File permissions are not maintained during zipped artifact upload. All directories will have 755 and all files will have 644." It recommends a tar file uploaded with archive: false.

Recognize it#

MessageLikely causeCheck
Permission denied running the scriptExecute bit lostls -l on the file
Permission denied, and the bit is setA mount with noexec, or a directory without xfindmnt -T .
required file not foundA carriage return in the first lineLine endings
Two copies of a library that should be oneA symlink became a filefind . -type l on both sides
A file present on one machine and not on the otherNames that differ only in casefind . | sort -f | uniq -di

sh run.sh works without the bit. That is a useful test and a poor fix, because the reproduction then runs under a different shell from the one named in its first line.

Send a manifest#

find . -type f ! -name MANIFEST -print0 | sort -z | xargs -0 sha256sum > MANIFEST
find . -printf '%p %M %y %l\n' | sort > MODES

On arrival:

sha256sum -c MANIFEST
find . -type f | wc -l; wc -l < MANIFEST

sha256sum -c checks the files it lists. In the fixture, an extra file in the directory did not make it fail: it printed run.sh: OK and exited 0. Compare the counts to see additions, and expect the manifests themselves in the difference. Contents do not include modes, so compare MODES too when a mode matters.

Decide#

If the reproduction is source code, send a commit; Git records the execute bit and symlinks. If it is a build output, use tar. If the receiver can only open zip files, make the first step explicit: chmod +x run.sh, and say which links were replaced by copies.

Worked example#

This example is fictional. A QA job downloads a CLI artifact and every test fails with Permission denied. The build job's own smoke test passed on the same commit. The modes differ: 755 before the upload and 644 after. The build team uploads a tar file instead. Two tests still fail, because the binary is linked against a library that exists only on the build image, and that was the real defect behind the first one.

Return to handing over evidence.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading