Organize has different move behavior when using wildcard
Metadata
Current evaluation
Wildcard organize keys still preserve a matched directory name while explicit keys merge its contents; the reproducible report has no maintainer triage or discussion.
Suggested action: needs triage
Reason: The metadata shows no labels, comments, or maintainer response, so this report has not been triaged. It provides exact mappings, outputs, and code locations; current craft-parts code still deliberately distinguishes explicit directory moves from glob matches, but the reporter's valid compatibility concern requires a maintainer decision.
Evaluated by: mr-cal-bot
Impact:
38
Quick Win:
7
Complexity:
70
Confidence:
89
Actionability:
65
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
38
Quick Win:
7
Complexity:
70
Confidence:
89
Actionability:
65
|
needs triage | Wildcard organize keys still preserve a matched directory name while explicit keys merge its contents; the reproducible report has no maintainer triage or discussion. | |
| stealth/space-bunny-alpha |
Impact:
43
Quick Win:
13
Complexity:
65
Confidence:
89
Actionability:
85
|
needs triage | Organize copies literal-directory contents but moves wildcard-matched directories, causing unexpected nesting and collisions; no version-independent content move is demonstrated, and the issue has no maintainer triage. | |
| qwen/qwen3.8-27b |
Impact:
40
Quick Win:
12
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. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Related To:
snapcraft#784
(confidence 94%)
Commit 260671d1a, titled "Support globbing for organize (#784)", introduced wildcard support and is the likely origin of this behavior.
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 | Wildcard organize mappings can produce a misleading "foo already exists" collision for multiple matches without a trailing slash; the report remains open with a likely glob-support fix candidate. |