Python plugin tries to chmod symlinks to system files
Metadata
Current evaluation
Python permission-fix logic followed absolute system-file symlinks and broke builds with development stage packages; the affected legacy implementation has since been removed.
Suggested action: close resolved
Reason: The traceback identifies `_fix_permissions()` calling `os.chmod()` through a staged symlink, and multiple commenters reproduced failures with different development packages. Commit 40136ea9b removed `_fix_permissions` when core18 support was removed, and the current Python plugin no longer contains the affected logic.
Evaluated by: mr-cal-bot
Impact:
45
Quick Win:
30
Complexity:
18
Confidence:
96
Actionability:
82
Issue body
If python-dev (and perhaps other packages?) is listed as a stage-package in a Python part or before, building the Python part fails.
Example snapcraft.yaml:
name: python-test
version: "0.0.0"
summary: Testing Python
description: Testing Python
confinement: strict
parts:
pystuff:
plugin: python
python-version: python2
python-packages:
- pyyaml
stage-packages:
- python-dev
Results in the following:
$ snapcraft --debug
...
Successfully installed PyYAML-3.12
Traceback (most recent call last):
File "/usr/bin/snapcraft", line 31, in <module>
snapcraft.main.main()
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 244, in main
return run(args, project_options)
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 303, in run
lifecycle.snap(project_options, args['<directory>'], args['--output'])
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 365, in snap
snap = execute('prime', project_options)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 117, in execute
_Executor(config, project_options).run(step, part_names)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 210, in run
self._run_step(step, part, part_names)
File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 246, in _run_step
getattr(part, step)()
File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 397, in build
self.code.build()
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 317, in build
self._fix_permissions()
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 306, in _fix_permissions
_replicate_owner_mode(os.path.join(root, filename))
File "/usr/lib/python3/dist-packages/snapcraft/plugins/python.py", line 479, in _replicate_owner_mode
os.chmod(path, new_mode)
PermissionError: [Errno 1] Operation not permitted: '/home/mrjogo/python-test/parts/pystuff/install/usr/lib/x86_64-linux-gnu/libnss_nisplus.so'
This is because libnss_nisplus.so is a symlink to /lib/x86_64-linux-gnu/libnss_nisplus.so.2, which is owned by root. This becomes an issue when a previous part staged python-dev.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
45
Quick Win:
30
Complexity:
18
Confidence:
96
Actionability:
82
|
close resolved | Python permission-fix logic followed absolute system-file symlinks and broke builds with development stage packages; the affected legacy implementation has since been removed. | |
| stealth/space-bunny-alpha |
Impact:
18
Quick Win:
15
Complexity:
12
Confidence:
95
Actionability:
92
|
close resolved | Legacy Python-part builds could abort while chmod followed package symlinks to root-owned system files; the affected core18 plugin path has since been removed. | |
| qwen/qwen3.6-35b-a3b |
Impact:
10
Quick Win:
1
Complexity:
10
Confidence:
85
Actionability:
10
|
close resolved | Python plugin _fix_permissions crashes when chmod-ing symlinks to system files. The referenced plugin code (snapcraft/plugins/python.py) no longer exists in the current codebase after major architectural refactoring. | |
| qwen/qwen3.8-27b |
Impact:
30
Quick Win:
18
Staleness:
95
Complexity:
40
Confidence:
70
Support Request:
0
|
close stale | Old snapcraft python plugin (pre-rewrite) crashed with PermissionError when _fix_permissions tried to chmod root-owned symlinks to system files after a prior part staged python-dev. The plugin has since been fully rewritten as a thin wrapper around craft-parts; the offending _fix_permissions/_replicate_owner_mode code no longer exists in the repo. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
30
Confidence:
90
Support Request:
10
|
close stale | Snapcraft Python plugin fails with PermissionError when chmod-ing symlinks to system files after staging python-dev. Unaddressed for over 9 years with no maintainer interaction. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
15
Confidence:
90
Support Request:
10
|
close stale | Bug in legacy snapcraft Python plugin where chmod fails on symlinks to system files when python-dev is staged. Issue is over 9 years old with no activity. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
40
Confidence:
92
Support Request:
10
|
close stale | Snapcraft Python plugin crashes when chmod-ing symlinks to system files. No maintainer response in 9 years. Project has significantly evolved since report. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
No related issues found above the similarity threshold.