← Back to issue list

Python plugin tries to chmod symlinks to system files

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1676684
Type
issue
State
open
Author
~mrjogo
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action: close stale

Reason: The issue is 3444 days old with zero comments and no maintainer interaction. The code it references (snapcraft/plugins/python.py with _fix_permissions and _replicate_owner_mode) no longer exists — grep finds no matches for either symbol in the current tree, and the python plugin is now a thin wrapper around craft-parts' PythonPlugin (snapcraft/parts/plugins/python_plugin.py). The original problem is no longer reproducible in the current architecture, so the issue is no longer applicable.

Impact: 30 Quick Win: 18.0 Staleness: 95 Complexity: 40 Confidence: 70 Support Request: 0

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
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18.0
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 20
Confidence: 90
Support Request: 5
close stale Python plugin crashes when chmod-ing symlinks to root-owned system files during snap builds. Triggered by stage-packages like python-dev. Unassigned, no comments, inactive for years. Needs triage and a fix to safely handle symlinks.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.