← Back to issue list

Using `source-subdir` results in `No such file or directory`

View original Github issue

Metadata

Project
craft-parts
Number
#427
Type
issue
State
open
Author
sed-i
Labels
—
Created
Updated
Closed
—

Current evaluation

Documented behavior: source-subdir sets the plugin build location, but override-build runs from the build root; callers must cd into the subdirectory themselves.

Suggested action: close not a bug

Reason: Current craft_parts/parts.py states that source-subdir does not affect commands in override-build, while step_handler.py runs plugin commands from part_build_subdir and part_handler.py runs override-build from part_build_dir. Git history shows the earlier #442 fix was reverted in dcbc4747 and #1374 later clarified this relationship, so the reported failure is expected and the cd workaround is appropriate.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 19 Complexity: 45 Confidence: 94 Actionability: 90

Issue body

I am using rockcraft with the python plugin ([PR](https://github.com/canonical/kubeflow-rocks/pull/2)). This works: ```yaml source: https://github.com/SeldonIO/seldon-core # ... override-build: | craftctl default install -D -m755 servers/xgboostserver/xgboostserver/XGBoostServer.py ${CRAFT_PART_INSTALL}/opt/XGBoostServer.py ``` But this doesn't: ```yaml source: https://github.com/SeldonIO/seldon-core source-subdir: servers/xgboostserver # ... override-build: | craftctl default install -D -m755 xgboostserver/XGBoostServer.py ${CRAFT_PART_INSTALL}/opt/XGBoostServer.py ``` ``` 2023-04-27 05:56:12.564 :: 2023-04-27 09:56:08.894 :: + install -D -m755 xgboostserver/XGBoostServer.py /root/parts/xgboostserver/install/opt/XGBoostServer.py 2023-04-27 05:56:12.564 :: 2023-04-27 09:56:08.895 :: install: cannot stat 'xgboostserver/XGBoostServer.py': No such file or directory 2023-04-27 05:56:12.564 :: 2023-04-27 09:56:09.013 'override-build' in part 'xgboostserver' failed with code 1. ``` @tigarmo suggested this may be from a bad interaction between `source-subdir` and `override-build` ([code](https://github.com/canonical/craft-parts/blob/main/craft_parts/executor/part_handler.py#L312)).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 19
Complexity: 45
Confidence: 94
Actionability: 90
close not a bug Documented behavior: source-subdir sets the plugin build location, but override-build runs from the build root; callers must cd into the subdirectory themselves.
stealth/space-bunny-alpha
Impact: 30
Quick Win: 13
Complexity: 48
Confidence: 96
Actionability: 86
close not a bug Open report: source-subdir does not relocate explicit override-build commands; current code and documentation treat this as intended, requiring users to enter the selected subtree.
qwen/qwen3.6-35b-a3b
Impact: 10
Quick Win: 8
Complexity: 10
Confidence: 95
Actionability: 90
close not a bug source-subdir not respected in override-build; user found workaround of cd-ing into subdir
qwen/qwen3.8-27b
Impact: 25
Quick Win: 20
Staleness: 45
Complexity: 20
Confidence: 85
Support Request: 75
close not a bug source-subdir not respected in override-build commands; behavior now documented as intended in #1374, attempted fix #442 was reverted; user must cd into subdir manually in override-build
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 45
Confidence: 75
Support Request: 5
needs triage Bug report regarding source-subdir causing file-not-found errors during override-build. Unlabelled, inactive for over three years, with an internal Jira ticket but no maintainer resolution or follow-up.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 55
Confidence: 85
Support Request: 10
needs triage Using source-subdir causes file not found errors during override-build. Reported ~3 years ago with no maintainer labels or resolution. Requires triage.

Update history

Date Change
updated

Related work

  • Related To: canonical/craft-parts#1374 (confidence 98%)

    Documentation change explicitly clarified the relationship between source-subdir and override-build.

  • Related To: canonical/craft-parts#442 (confidence 96%)

    Earlier executor change attempted to fix subdir handling in pull and build, but git history records its revert.

Related issues

Issue Project State Summary Similarity
#967 `source-subdir` Not Working With `override-build` rockcraft closed No code fix was made: legacy source-subdir behavior with override-build was retained for compatibility; craft-parts#1374 documents the limitation.
74%
#1596554 Help documentation for source-subdir is out of date snapcraft (launchpad) closed Updated source-subdir help text to explain that all source is copied and the plugin builddir points to the selected subdirectory in PR #1177 (commit 06275c2b6).
71%