← 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

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

Suggested action: close not a bug

Reason: The docs (added in #1374) now explicitly state that override-build commands 'don't respect the source-subdir value and are executed on the source's root directory.' The attempted code fix (#442) was reverted, confirming this is by design. The user's workaround of cd-ing into the subdir is the correct approach.

Impact: 25 Quick Win: 20.0 Staleness: 45 Complexity: 20 Confidence: 85 Support Request: 75

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
qwen/qwen3.8-27b
Impact: 25
Quick Win: 20.0
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 40
Confidence: 75
Support Request: 10
needs triage source-subdir causes override-build to fail with file not found errors as the working directory is not set to the subdirectory. Confirmed across plugins. Workaround requires manual directory changes. Internal ticket CRAFT-2956 created. Awaiting triage.

Update history

Date Change
updated

Related work

  • Related To: craft-parts#1374 (confidence 90%)

    Docs commit clarifying that override-build commands do not respect source-subdir, confirming the behavior is intentional

  • Related To: craft-parts#442 (confidence 85%)

    Attempted fix for subdir in pull and build steps that was subsequently reverted, confirming the original behavior is by design

Related issues

Issue Project State Summary Similarity
#967 `source-subdir` Not Working With `override-build` rockcraft closed Closed without a code fix due to backward compatibility concerns, as correcting the behavior would break existing workarounds. Documentation updates will clarify the current limitation.
84%