← Back to issue list

Catkin plugin: empty segment added to PYTHONPATH

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1714333
Type
issue
State
closed
Author
~kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by snapcraft PR #1522, merged as commit a2440c986 ("catkin plugin: only append PYTHONPATH if set"), which makes the Catkin plugin append the existing PYTHONPATH only when it is set, avoiding an empty path segment.

Resolution: closed resolved

Reason: Maintainer ~kyrofa closed the issue pointing to https://github.com/snapcore/snapcraft/pull/1522, which merged as commit a2440c986 "catkin plugin: only append PYTHONPATH if set" (plus added environment-output test coverage).

Evaluated by: mr-cal-bot

No scores available.

Issue body

The Catkin plugin puts something along the following lines into the environment: export PYTHONPATH=foo:$PYTHONPATH Which apparently is a bad thing, because if $PYTHONPATH is empty, that puts an empty segment on the PYTHONPATH which Python interprets as `.`, thus adding the current working directory to it. There are some modules that walk the PYTHONPATH (e.g. pkg_resources), and the current working directory is often inaccessible to the snap in confinement. No idea why Python works this way, but then again, I feel that way a lot toward Python. This needs to be fixed in the Catkin plugin to only append the current PYTHONPATH if it's actually set.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by snapcraft PR #1522, merged as commit a2440c986 ("catkin plugin: only append PYTHONPATH if set"), which makes the Catkin plugin append the existing PYTHONPATH only when it is set, avoiding an empty path segment.
stealth/space-bunny-alpha — closed resolved Catkin now appends the existing PYTHONPATH only when set; fixed by merged canonical/snapcraft#1522 via commit a2440c986.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/snapcraft#1522 (commit a2440c986): the Catkin plugin now appends PYTHONPATH only when set, preventing an empty segment from exposing the working directory.
qwen/qwen3.6-35b-a3b — — The Catkin plugin incorrectly added an empty PYTHONPATH segment when unset, breaking snap confinement. Closed without comments or a tracked fix, likely abandoned or resolved in a later release.
qwen/qwen3.6-35b-a3b — — Abandoned. The Catkin plugin incorrectly appends an empty PYTHONPATH segment when unset, adding the current directory and breaking snap confinement. The issue was closed without a fix or pull request.

Update history

Date Change
created

Related work

  • Likely Fixed By: canonical/snapcraft#1522 (confidence 98%)

    Merged PR titled "catkin plugin: only append PYTHONPATH if set", landing as commit a2440c986; the closing comment cites it as the fix.

  • Related To: canonical/snapcraft#324 (confidence 35%)

    Earlier catkin/PYTHONPATH work merged as commit 0adb5cc16 (commit c845aefdd 'catkin plugin: do not overwrite the PYTHONPATH'), same area of the plugin's env handling.

Related issues

Issue Project State Summary Similarity
#1522 catkin plugin: only append PYTHONPATH if set snapcraft merged Merged in commit a2440c986: the Catkin plugin now appends PYTHONPATH only when set, preventing empty path segments; environment-output coverage was added.
82%
#324 catkin plugin: do not overwrite the PYTHONPATH snapcraft merged Merged PR #324 fixed the catkin plugin to preserve setup.sh’s PYTHONPATH instead of overwriting it, resolving LP #1544790.
76%
#232 Catkin plugin: Use in-snap python instead of OS-provided. snapcraft merged Merged PR #232 (fe9ca74c9), fixing Catkin on Xenial by using /usr/bin/env Python shebangs and PATH-resolved Python in 10.ros.sh.
71%
#1548406 Catkin plugin: Can't handle rosdep resolving to nothing snapcraft (launchpad) closed Fixed by canonical/snapcraft#331, merged as commit 1c1119ce3; Catkin now treats empty rosdep output as no dependencies instead of an error.
71%
#1354 catkin plugin: fix pythonpath for catkin_find snapcraft closed Closed unmerged after inactivity; its linked catkin-underlay failure was later fixed by merged PR #1526 in commit ae9fd598f.
71%
#331 Catkin plugin: Handle rosdep empty and multiple dependencies. snapcraft merged PR #331 merged into snapcraft master as commit 1c1119ce3 (merge e3a2b9d03). It refactored the Catkin plugin's rosdep dependency resolution to handle empty output and multiple packages per line, fixing LP bugs #1548406 and #1548404.
70%