← Back to issue list

`dump` plugin is not idempotent

View original Github issue

Metadata

Project
craft-parts
Number
#1781
Type
issue
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

dump plugin fails to rebuild after partial failure due to cp not overwriting files; maintainer indicates PR #1782 should resolve this by cleaning install directories on non-update runs.

Suggested action: keep open

Reason: The issue is valid and clearly scoped with a reproducer test. Maintainer lengau explicitly noted that PR #1782 ("Clean the install directory on non-update runs") should make this bug irrelevant by making the dump plugin idempotent within a re-run context. The PR is still open with CI failures, so the fix is not yet merged.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 22 Complexity: 40 Confidence: 75 Actionability: 80

Issue body

### Bug Description This is a distillation of the `dump` plugin portion of https://github.com/canonical/charmcraft/issues/2969. It goes alongside https://github.com/canonical/craft-parts/issues/1780 If the `dump` plugin fails partway through, it will continue to error until explicitly cleaned, because the `cp` command used doesn't allow overwriting files. A case where this happens could be that the copy results in some sort of transient write error. ### To Reproduce An example test for this: ```python @pytest.mark.xfail( raises=errors.PluginBuildError, reason="https://github.com/canonical/charmcraft/issues/2969", strict=True, ) def test_dump_retry_build_after_failure(new_dir, partitions, install_dir): _parts_yaml = textwrap.dedent( """\ parts: foo: plugin: dump source: src override-build: | craftctl default if [ ! -f "$CRAFT_PART_INSTALL/failed_once" ]; then touch "$CRAFT_PART_INSTALL/failed_once" exit 1 fi """ ) parts = yaml.safe_load(_parts_yaml) source_dir = Path("src") source_dir.mkdir() Path(source_dir / "foobar.txt").touch() lf1 = craft_parts.LifecycleManager( parts, application_name="test_dump", cache_dir=new_dir, partitions=partitions ) with lf1.action_executor() as ctx: ctx.execute(Action("foo", Step.PULL)) with pytest.raises(craft_parts.errors.ScriptletRunError): ctx.execute(Action("foo", Step.BUILD)) lf2 = craft_parts.LifecycleManager( parts, application_name="test_dump", cache_dir=new_dir, partitions=partitions ) with lf2.action_executor() as ctx: ctx.execute(Action("foo", Step.BUILD)) ``` Here we would expect the second build to succeed, and in fact if you switch the plugin to `nil` it does exactly that. ### part yaml ```shell ``` ### Relevant log output ```shell n/a ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 45
Quick Win: 22
Complexity: 40
Confidence: 75
Actionability: 80
keep open dump plugin fails to rebuild after partial failure due to cp not overwriting files; maintainer indicates PR #1782 should resolve this by cleaning install directories on non-update runs.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 14
Complexity: 40
Confidence: 75
Actionability: 80
keep open The dump plugin is not idempotent: if a build fails partway, subsequent builds fail because cp doesn't overwrite existing files. Has a test case and maintainer discussion about the right fix.

Update history

Date Change
updated
updated
created

Related work

  • Likely Fixed By: canonical/craft-parts#1782 (confidence 80%)

    Maintainer lengau stated: "In theory #1782 should be sufficient to make this bug irrelevant (in that with that change the dump plugin becomes idempotent within the full context of a re-run)." PR is open with CI failures.

Related issues

No related issues found above the similarity threshold.