snapcraft changes permissions of some files
Metadata
Current evaluation
Rejected as not a snapcraft bug. Unexpected file permission changes were traced to coreutils or the core-base build process. The author closed the issue and referenced core-base PR 421 for the fix.
Suggested action: —
No scores available.
Issue body
### Check existing issues
- [x] I've verified that this bug isn't described by any existing issues.
### Bug description
When building core26 (https://github.com/canonical/core-base), some files acquire unexpectedly execution permissions, for instance:
```
/usr/lib/systemd/system/systemd-networkd*
/usr/lib/systemd/system/sshd-keygen.service
/usr/lib/systemd/system/getty@.service
/usr/lib/systemd/system/cloud-*
```
When debugging, if I stopped the build in the last step of `snapcraft.yaml` ("exit 1" in the last command) the permissions of the files in the container were ok. However, if I built until the end the permissions inside the snap are wrong, and when I looked inside the container `/root/prime/usr/lib/systemd/system/systemd-networkd.service` was 0o755 too.
Not sure if related to https://github.com/canonical/snapcraft/issues/4658
### Steps to reproduce
```
git clone https://github.com/canonical/core-base
snapcraft pack
sudo unsquashfs -d sq core26_*.snap
ls -l sq/usr/lib/systemd/system/systemd-networkd*
```
### Environment
snapcraft 8.14.4 (rev 17288) on Ubuntu 24.04.
### snapcraft.yaml
```yaml
https://github.com/canonical/core-base/blob/main/snapcraft.yaml
```
### Log output
```shell
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Rejected as not a snapcraft bug. Unexpected file permission changes were traced to coreutils or the core-base build process. The author closed the issue and referenced core-base PR 421 for the fix. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as not a snapcraft bug. The author traced the unexpected execution permissions to coreutils or the core-base project rather than snapcraft itself. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as not a snapcraft bug. The author determined the unexpected file permission changes originate from coreutils, not snapcraft, and referenced a related core-base pull request for further investigation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed by the author as not a snapcraft bug. Unexpected permission changes were traced to coreutils or the core-base build process. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed as not a snapcraft bug. The author determined the unexpected file permission changes originate from coreutils, not snapcraft, and referenced core-base PR #421 for context. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1741753 Snapcraft clean fails on root-owned files | snapcraft (launchpad) | closed | Closed without resolution. snapcraft clean failed with a PermissionError when removing root-owned files from the build directory. No fix or discussion was provided. | |
| #1871109 snapcraft should check file creation permissions and warn/error out instead of generating a non-functional snap | snapcraft (launchpad) | closed | Closed without resolution. The requested permission checks were not implemented, and the issue remains abandoned. | |
| #1990551 snapcraft 7 never drops permissions while doing builds invoked with sudo | snapcraft (launchpad) | closed | Closed without resolution due to inactivity. The report identifies a snapcraft 7 regression where sudo builds retain root privileges instead of dropping them, unlike snapcraft 6. No fix or discussion occurred. |