← Back to issue list

Using organize to move a folder to a child folder fails due to recursion

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1668555
Type
issue
State
open
Author
~jamesh
Labels
—
Created
Updated
Closed
—

Current evaluation

The historical organize recursion is addressed by self-move protection; organize now runs during build, resolving both reported behaviors in current code.

Suggested action: close resolved

Reason: Snapcraft commit be5982a1d (snapcraft#2047) moved organize into the build step, directly resolving the install-versus-stage discrepancy. Current craft-parts also skips self-organizations and prunes destinations nested beneath the source; craft-parts#1201 added explicit self-move handling and craft-parts#1370 hardened destination handling.

Evaluated by: mr-cal-bot

Impact: 50 Quick Win: 29 Complexity: 38 Confidence: 94 Actionability: 94

Issue body

I created a part in my snapcraft.yaml file with the following directive: plugin: dump source: src organize: .: lib/python3.6/site-packages The intention being to move all the source files to a subdirectory. However, in the process of reorganising the installed files, it was also trying to move lib/python3.6/site-packages under lib/python3.6/site-packages, and doing so recursively until it errors out when the file name gets too long. I could avoid the problem by changing the directive to the following, which I guess avoided the problem because the glob was expanded before trying to reorganise the tree. organize: '*': lib/python3.6/site-packages/

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 50
Quick Win: 29
Complexity: 38
Confidence: 94
Actionability: 94
close resolved The historical organize recursion is addressed by self-move protection; organize now runs during build, resolving both reported behaviors in current code.
stealth/space-bunny-alpha
Impact: 52
Quick Win: 25
Complexity: 42
Confidence: 91
Actionability: 82
close resolved The organize-key recursion was fixed by rejecting self-moves; the commenter’s separate build-versus-stage observation was addressed by organizing during build.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 39
Complexity: 30
Confidence: 80
Actionability: 80
keep open Bug in `organize` directive causing infinite recursion when moving a folder to a child folder. Valid bug report with clear description and workaround.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 18
Staleness: 95
Complexity: 40
Confidence: 40
Support Request: 15
needs triage 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.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 35
Confidence: 90
Support Request: 5
close stale Bug in snapcraft organize directive causes infinite recursion when moving files into a matching subdirectory. Unaddressed for over 9 years with no maintainer interaction or labels.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 40
Confidence: 85
Support Request: 10
close stale Snapcraft's organize directive causes infinite recursion when moving files to a newly created subdirectory. Untriaged, inactive for ~9 years, no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 45
Confidence: 85
Support Request: 15
close stale Infinite recursion bug when using the organize directive to move files to a subdirectory in snapcraft dump plugin. Unassessed and inactive for over nine years.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcraft#2047 (confidence 100%)

    Commit be5982a1d changed organize to run during build rather than stage, directly addressing the commenter's observation.

  • Likely Fixed By: craft-parts#1370 (confidence 84%)

    Commit 7fe7c84e hardened organize destination handling, while link_or_copy_tree now avoids descending into a destination nested under the source.

  • Likely Fixed By: craft-parts#1201 (confidence 82%)

    Commit ae1de9f6 added handling for organizing a path onto itself; current code performs a same-file check before copying.

Related issues

No related issues found above the similarity threshold.