Leftover files affecting consecutive runs of "rockcraft pack"
Metadata
Current evaluation
Failed pack leaves part-install files that break the next pack; a triage update asks whether the supported rockcraft clean reset resolves the hard-link failure.
Suggested action: keep open
Reason: The report provides an exact configuration and deterministic sequence: an expected organize collision followed by cp failing with "File exists", while renaming the rock creates a fresh work tree. The recent triage comment identifies rockcraft clean as the supported reset and requests a retest, but no confirmation or resolving change is recorded.
Evaluated by: mr-cal-bot
Impact:
42
Quick Win:
17
Complexity:
52
Confidence:
82
Actionability:
84
Issue body
I have the following directory structure:
```
$ tree .
.
├── files
│ ├── a.txt
│ └── b.txt
└── rockcraft.yaml
```
And in `rockcraft.yaml` I want to organize those two text files, but I make a typo and point both to `etc/newfiles/a.txt`:
```
name: leftover
summary: Permissions
description: Permissions
license: Apache-2.0
version: "0.0.1"
base: ubuntu:22.04
parts:
default-config:
plugin: dump
source: files
organize:
a.txt: etc/newfiles/a.txt
b.txt: etc/newfiles/a.txt
stage:
- etc/newfiles/a.txt
- etc/newfiles/b.txt
```
`rockcraft pack` then expectedly fails:
```
$ rockcraft -v pack
(...)
:: + cp --archive --link --no-dereference . /root/parts/default-config/install
Failed to organize part 'default-config': trying to organize file 'b.txt' to 'etc/newfiles/a.txt', but 'etc/newfiles/a.txt' already exists.
Traceback (most recent call last):
File "/snap/rockcraft/x1/lib/python3.8/site-packages/rockcraft/parts.py", line 92, in run
aex.execute(action, stdout=stream, stderr=stream)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 301, in execute
self._executor.execute(actions, stdout=stdout, stderr=stderr)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 126, in execute
self._run_action(act, stdout=stdout, stderr=stderr)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 189, in _run_action
handler.run_action(action, stdout=stdout, stderr=stderr)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 160, in run_action
state = handler(step_info, stdout=stdout, stderr=stderr)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 320, in _run_build
self._organize(overwrite=update)
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 833, in _organize
organize_files(
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/organize.py", line 82, in organize_files
raise errors.FileOrganizeError(
craft_parts.errors.FileOrganizeError: Failed to organize part 'default-config': trying to organize file 'b.txt' to 'etc/newfiles/a.txt', but 'etc/newfiles/a.txt' already exists.
```
However, if I fix the `organize` section and re-run `rockcraft -v pack`, I get another error:
```
:: + cp --archive --link --no-dereference . /root/parts/default-config/install
:: cp: cannot create hard link '/root/parts/default-config/install/./b.txt' to './b.txt': File exists
Failed to run the build script for part 'default-config'.
Traceback (most recent call last):
File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/step_handler.py", line 134, in _builtin_build
subprocess.run(
File "/snap/rockcraft/x1/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/parts/default-config/run/build.sh']' returned non-zero exit status 1.
```
If I make a "big" change like renaming the rock from `leftover` to `leftover2`, the packing finishes successfully. Thanks!
(cc @cmatsuoka)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
42
Quick Win:
17
Complexity:
52
Confidence:
82
Actionability:
84
|
keep open | Failed pack leaves part-install files that break the next pack; a triage update asks whether the supported rockcraft clean reset resolves the hard-link failure. | |
| qwen/qwen3.6-35b-a3b |
Impact:
40
Quick Win:
16
Complexity:
20
Confidence:
60
Actionability:
50
|
keep open | Leftover files from failed rockcraft pack runs cause subsequent runs to fail with 'File exists' errors; maintainer requested re-test with rockcraft clean | |
| qwen/qwen3.8-27b |
Impact:
50
Quick Win:
18
Staleness:
40
Complexity:
65
Confidence:
65
Support Request:
30
|
keep open | Rockcraft pack fails on second run after fixing an organize typo: leftover install-dir files cause a cp hard-link 'File exists' error. Maintainer asked reporter to re-test with rockcraft clean between runs; awaiting response. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
70
Complexity:
40
Confidence:
80
Support Request:
85
|
close not a bug | Reporter encountered build failures from leftover files after fixing a typo in rockcraft.yaml. Maintainer triaged, identified as expected behavior, and directed user to run rockcraft clean between runs. Awaiting re-test. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
15
Confidence:
85
Support Request:
90
|
close not a bug | Leftover build artifacts from a failed run cause consecutive rockcraft pack failures. Maintainer clarifies this is expected behavior and points to rockcraft clean as the documented workflow to reset state. |
Update history
No update history recorded yet.
Related work
-
Related To:
rockcraft#188
(confidence 93%)
Also reports persistent state breaking consecutive pack runs and says clean restores success, though its overlay-created user/group trigger differs.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #188 Consecutive runs of rockcraft pack fail | rockcraft | open | A second rockcraft pack fails when an overlay script creates a fixed group or user because prior state persists; rockcraft clean restores success. The issue remains open and untriaged. |