← Back to issue list

Pulling local sources is rather broken

View original Launchpad issue

Metadata

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

Current evaluation

Local source pull bug fixed by ubuntu-core/snapcraft PR #377 (commit eb6ad38ab "Correct local source pulling", merged as 8b4a18d9b), which inverts the isdir/rmdir checks so symlinked local sources are removed rather than raising.

Resolution: closed resolved

Reason: Maintainer ~sergiusens linked the fix in the closing comment: https://github.com/ubuntu-core/snapcraft/pull/377/files, from branch bugfix/1558446/pull-local. Commit eb6ad38ab "Correct local source pulling" was merged via merge commit 8b4a18d9b "Merge pull request #377 from sergiusens/bugfix/1558446/pull-local", directly matching this Launchpad bug number.

Evaluated by: mr-cal-bot

No scores available.

Issue body

When pulling a local source we check if there's a dir there, most likely created by the plugin handler, and we os.rmdir it; else we do a os.remove. The problem is that the call to isdir upon the symlink will be true and os.rmdir will fail so we invert this.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Local source pull bug fixed by ubuntu-core/snapcraft PR #377 (commit eb6ad38ab "Correct local source pulling", merged as 8b4a18d9b), which inverts the isdir/rmdir checks so symlinked local sources are removed rather than raising.
stealth/space-bunny-alpha — closed resolved Local-source pulling was fixed in merged PR canonical/snapcraft#377 by making cleanup symlink-aware and preventing os.rmdir failures.
stealth/space-bunny-alpha — closed resolved Fixed local-source pulling by correcting symlink/directory detection so os.rmdir is not applied to symlinks; recorded as fixed in snapcraft#1558446.
qwen/qwen3.6-35b-a3b — — Fixed a local source pull failure caused by os.path.isdir returning true for symlinks, which made os.rmdir fail. The directory check was inverted to correctly handle symlinks and regular files.
qwen/qwen3.6-35b-a3b — — Fixed by inverting the directory check logic. The original code failed when pulling local sources because os.path.isdir returned true for symlinks, causing os.rmdir to error. The updated check correctly handles symlinks.

Update history

Date Change
created

Related work

  • Likely Fixed By: canonical/snapcraft#377 (confidence 97%)

    PR #377 from sergiusens (branch bugfix/1558446/pull-local), cited by the author in the closing comment; merged as 8b4a18d9b containing fix commit eb6ad38ab.

Related issues

Issue Project State Summary Similarity
#377 Correct local source pulling snapcraft merged Merged PR #377 corrected symlink-aware local source checks, preventing cleanup failures and allowing local sources to be pulled twice without an "is a symlink" error.
80%
#1538250 The local source pull is not fully covered by unittests snapcraft (launchpad) closed Maintainer ~elopio's own test-debt bug for the uncovered branch in local source pulling (duplicated os.remove logic) was closed after ubuntu-core/snapcraft PR #262 refactored the pull and added full unit-test coverage; merged as 3d0e49c4c.
75%
#1791773 Local source change detection doesn't filter out snap/.snapcraft directory snapcraft (launchpad) closed Local-source change detection now excludes the snap/.snapcraft directory; the fix was merged in canonical/snapcraft#2256 as commit abbc92427.
72%
#2256 local source: don't include .snapcraft directory snapcraft merged Merged #2256 (commit abbc92427), fixing LP #1791773 by excluding .snapcraft from local-source copies and stale-part checks.
72%
#1659653 Symlinks to directories in local sources aren't pulled as symlinks snapcraft (launchpad) closed Merged PR #1081 (commit baeec1045) fixed local source handling to preserve directory symlinks instead of replacing them with directories.
72%
#622 Hard-link local sources instead of symlinking them. snapcraft merged Merged in canonical/snapcraft#622 (a07fa0faa), replacing local-source symlinks with hard links and falling back to copies, fixing LP #1590108.
71%
#1816397 Modifying snapcraft.yaml with parts using local sources get dirty snapcraft (launchpad) closed Fixed in PR snapcore/snapcraft#2475 (53f96dc71): local-source dirty checks now ignore snap-directory changes, preventing manifest-only edits from rebuilding parts.
71%
#961 sources: refactor local source into module. snapcraft merged Merged PR snapcore/snapcraft#961 by kyrofa extracted the Local source into sources/_local.py, merged as commit ec4b8f341. Part of the wider sources refactor series (#957, #962-#970) for LP #1648906.
70%