What survived in each path#
The directory holds run.sh with mode 755 and link, a symlink to it.
| Path | run.sh | link |
|---|---|---|
tar cf, tar xf | 755 | A symlink |
Python zipfile, written and extracted by zipfile | 664 | A regular file, a copy of the target |
zip -r, unzip | 755 | A regular file with mode 755 |
zip -ry, unzip | 755 | A 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#
| Message | Likely cause | Check |
|---|---|---|
Permission denied running the script | Execute bit lost | ls -l on the file |
Permission denied, and the bit is set | A mount with noexec, or a directory without x | findmnt -T . |
required file not found | A carriage return in the first line | Line endings |
| Two copies of a library that should be one | A symlink became a file | find . -type l on both sides |
| A file present on one machine and not on the other | Names that differ only in case | find . | 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.