← Back to issue list

Organize has different move behavior when using wildcard

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1844801
Type
issue
State
open
Author
~merlijn-sebrechts
Labels
Created
Updated
Closed

Current evaluation

Snapcraft organize keyword moves directory contents for literal paths but the directory itself for glob/wildcard paths, causing confusing 'already exists' errors. No maintainer response in 7 years; behavior still present in craft-parts organize code. Needs triage.

Suggested action: needs triage

Reason: No labels, no comments, no maintainer interaction in ~7 years (2537 days), so it has never been triaged. The inconsistency is still visible in craft_parts/executor/organize.py, which uses link_or_copy_tree for non-globbed trees and different handling for globbed sources, so it is not obsolete. The reporter also asks how to move contents with a wildcard, making it partly a support question, but the underlying inconsistency is a real bug/behavioral inconsistency.

Impact: 40 Quick Win: 12.0 Staleness: 85 Complexity: 70 Confidence: 70 Support Request: 25

Issue body

This copies the _contents_ of `ClimateTrail-1.3-pc` to the root of the install folder.     organize:       'ClimateTrail-1.3-pc/' : './' This copies the directory `ClimateTrail-1.3-pc` _itself_ to the root of the install folder (and thus gives the error "ClimateTrail-1.3-pc already exists")     organize:       'ClimateTrail-*-pc/' : './' This happens because non-globbed directories are moved using `file_utils.link_or_copy_tree`, which copies _contents_ https://github.com/snapcore/snapcraft/blob/ae7ab338e4c5d49edb88b8ff78da6e98dc12881a/snapcraft/internal/pluginhandler/__init__.py#L1146 While globbed directories are moved using `shutil.move(src, dst)` which moves the directory _itself_ https://github.com/snapcore/snapcraft/blob/ae7ab338e4c5d49edb88b8ff78da6e98dc12881a/snapcraft/internal/pluginhandler/__init__.py#L1179 This inconsistency is quite confusing and made me lose a lot of time. I suspect changing this behavior will break a lot of existing snapcraft.yaml files, so that's not really an option. However, I'm completely lost as to how I should move the contents of `ClimateTrail-1.3-pc` to the root without specifying the version number. If I try     organize:       'ClimateTrail-*-pc/*' : './' I get the error `Destination path '/root/parts/climate-trail/install/./ClimateTrail.sh' already exists` and I have no idea why.. For reference, these are the contents of the directories: snapcraft-climate-trail # ls parts/climate-trail/build/ ClimateTrail-1.3a-pc snapcraft-climate-trail # ls parts/climate-trail/build/ClimateTrail-1.3a-pc/ ClimateTrail.py ClimateTrail.sh game lib renpy snapcraft-climate-trail # ls parts/climate-trail/install/ ClimateTrail-1.3a-pc ClimateTrail.sh etc lib usr

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 12.0
Staleness: 85
Complexity: 70
Confidence: 70
Support Request: 25
needs triage Snapcraft organize keyword moves directory contents for literal paths but the directory itself for glob/wildcard paths, causing confusing 'already exists' errors. No maintainer response in 7 years; behavior still present in craft-parts organize code. Needs triage.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 50
Confidence: 85
Support Request: 20
close stale Inconsistency in snapcraft's organize directive: non-globbed paths copy directory contents while globbed paths move the directory itself. Unresolved, no maintainer response, inactive for ~6.8 years.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 40
Confidence: 95
Support Request: 20
close stale Inconsistent behavior in Snapcraft's organize directive: literal paths copy directory contents, while wildcards move the directory itself. Reported as confusing and lacking a clear workaround. No activity in nearly 7 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 50
Confidence: 85
Support Request: 20
close stale Reports inconsistent directory handling in Snapcraft's organize step between literal paths and wildcards. Unaddressed for over six years with no maintainer feedback.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 55
Confidence: 85
Support Request: 15
close stale Inconsistent directory move behavior in snapcraft's organize directive when using wildcards versus literal paths. Issue is over 6 years old with no maintainer response or activity.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1663233 Confusing error message for "organize" when source refers to multiples items and destination doesn't end up with / snapcraft (launchpad) open Snapcraft 2.26 (2017) reports a misleading 'already exists' error when an organize glob matches multiple items and the destination lacks a trailing slash; reporter suggests auto-treating the destination as a directory. No maintainer response; code has since moved to craft-parts.
76%
#1668555 Using organize to move a folder to a child folder fails due to recursion snapcraft (launchpad) open Snapcraft organize directive causes infinite recursion when moving a folder into its own child path (e.g. '.': lib/python3.6/site-packages). Workaround via glob ('*') documented in issue. 9+ years old, zero comments, no labels, never triaged.
73%
#1669908 Provide visible yaml settings or document organize plugin behavior for directory merging snapcraft (launchpad) open Request to document or expose a snapcraft.yaml knob for the organize plugin's directory-merging behavior, after a cryptic 'path ./ already exists' error from shutil.move when using '*' keys. No labels, no maintainer response, 0 comments; last activity 47 days ago on a ~9.5-year-old issue.
72%
#553 Organize does not raise error if source file does not exist craft-parts open craft-parts organize silently succeeds when a non-glob source file does not exist, so a renamed/missing file in a rockcraft.yaml organize mapping is not caught at build time. Maintainer confirmed root cause (empty glob iterator) in 2023; no fix landed.
70%
#1794083 Updating build with organize can result in "destination path already exists" snapcraft (launchpad) closed Closed without resolution. Snapcraft's automatic rebuild fails when organize globs map to the same directory twice, causing a path conflict. No fix or follow-up was documented.
70%