← Back to issue list

Organize does not raise error if source file does not exist

View original Github issue

Metadata

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

Current evaluation

A missing exact-path organize source is still silently skipped: the current glob loop has no zero-match error, allowing rocks to build without required files.

Suggested action: keep open

Reason: The maintainer explicitly identified the empty glob iterator as accidental, and current organize_files() still has no check for src_count == 0. The report provides a concrete reproducer and pinpoints the validation gap; tests should distinguish missing literal sources from intentionally unmatched wildcard patterns.

Evaluated by: mr-cal-bot

Impact: 52 Quick Win: 31 Complexity: 32 Confidence: 95 Actionability: 88

Issue body

### Bug Description While building a rock for Synapse charm, there is a configuration file that should be dumped in a specific directory with a specific name by using the "organize" keyword. Its name was changed in the repository but not in the rockcraft.yaml. This went unnoticed until deploying the charm because the rock was successfully built but the file was not there. ### To Reproduce This is an example of the part that was expected to raise an error since the source file in "organize" does not exist. not-found-login_ubuntu.py is a file that does not exist. ``` synapse-conf: plugin: dump source: attributemaps organize: not-found-login_ubuntu.py: /usr/local/attributemaps/login_ubuntu.py ``` ### part yaml ```shell # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. name: synapse summary: Synapse rock description: Synapse OCI image for the Synapse charm version: "1.0" base: ubuntu:22.04 build-base: ubuntu:22.04 license: Apache-2.0 platforms: amd64: parts: synapse: build-packages: - build-essential - curl - git - libffi-dev - libssl-dev - pkg-config - libjpeg-dev - libpq-dev - libwebp-dev - libxml++2.6-dev - libxslt1-dev - openssl - zlib1g-dev - libicu-dev - python3-dev - python3-pip - python3-setuptools stage-packages: - bash - coreutils - curl - gosu - libffi-dev - libjpeg-turbo8 - libpq5 - libwebp7 - xmlsec1 - libjemalloc2 - libicu70 - libssl-dev - openssl - python3 plugin: nil source: https://github.com/matrix-org/synapse/ source-type: git source-tag: v1.85.2 override-build: | craftctl default export RUSTUP_HOME=/rust export CARGO_HOME=/cargo export PATH=/cargo/bin:/rust/bin:$PATH export CARGO_NET_GIT_FETCH_WITH_CLI=false mkdir -p /rust /cargo /synapse /install curl -m 30 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal pip3 install -U pip setuptools pip3 install --root-user-action=ignore "poetry==1.3.2" cp pyproject.toml poetry.lock /synapse/ /usr/local/bin/poetry export --extras all -o /synapse/requirements.txt pip3 install --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt cp -r synapse /synapse/ cp -r rust /synapse/ cp pyproject.toml README.rst build_rust.py Cargo.toml Cargo.lock /synapse/ pip3 install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; cp docker/start.py $CRAFT_PART_INSTALL/ chmod 755 $CRAFT_PART_INSTALL/start.py sed -i 's/#!\/usr\/local\/bin\/python/#!\/usr\/bin\/python3/' $CRAFT_PART_INSTALL/start.py cp -r docker/conf $CRAFT_PART_INSTALL/ cp -r /usr/local $CRAFT_PART_INSTALL/usr/ cp -r /install/local/* $CRAFT_PART_INSTALL/usr/local/ mkdir -p $CRAFT_PART_INSTALL/usr/local/attributemaps chmod 755 $CRAFT_PART_INSTALL/usr/local/attributemaps synapse-conf: plugin: dump source: attributemaps organize: u1staging.py: /usr/local/attributemaps/u1staging.py ``` ### Relevant log output ```shell 2023-09-13T20:31:10.7322269Z 2023-09-13 20:31:05.623 Executed: build synapse 2023-09-13T20:31:10.7322656Z 2023-09-13 20:31:05.623 Executing parts lifecycle: build synapse-conf 2023-09-13T20:31:10.7323025Z 2023-09-13 20:31:05.623 Executing action 2023-09-13T20:31:10.7323789Z 2023-09-13 20:31:05.627 execute action synapse-conf:Action(part_name='synapse-conf', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None)) 2023-09-13T20:31:10.7324443Z 2023-09-13 20:31:05.628 load state file: /root/parts/synapse-conf/state/pull 2023-09-13T20:31:10.7324897Z 2023-09-13 20:31:05.635 remove directory /root/parts/synapse-conf/build 2023-09-13T20:31:10.7325894Z 2023-09-13 20:31:05.637 Executing PosixPath('/root/parts/synapse-conf/run/build.sh') 2023-09-13T20:31:10.7326621Z 2023-09-13 20:31:05.644 :: + cp --archive --link --no-dereference . /root/parts/synapse-conf/install 2023-09-13T20:31:10.7327037Z 2023-09-13 20:31:06.424 Executed: build synapse-conf 2023-09-13T20:31:10.7327436Z 2023-09-13 20:31:06.425 Executing parts lifecycle: stage pebble ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 52
Quick Win: 31
Complexity: 32
Confidence: 95
Actionability: 88
keep open A missing exact-path organize source is still silently skipped: the current glob loop has no zero-match error, allowing rocks to build without required files.
qwen/qwen3.6-35b-a3b
Impact: 50
Quick Win: 28
Complexity: 30
Confidence: 80
Actionability: 80
keep open craft-parts organize keyword silently ignores missing source files instead of raising an error.
qwen/qwen3.8-27b
Impact: 55
Quick Win: 33
Staleness: 62
Complexity: 40
Confidence: 80
Support Request: 5
keep open craft-parts organize silently succeeds when a non-glob source file does not exist, so a renamed/missing file in a rockcraft.yaml organize mapping is not caught at build time. Maintainer confirmed root cause (empty glob iterator) in 2023; no fix landed.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 32
Staleness: 70
Complexity: 35
Confidence: 80
Support Request: 5
keep open craft-parts 'organize' silently succeeds when a mapped source file does not exist, because the glob expansion yields an empty iterator and the loop is skipped. Maintainer confirmed root cause in 2023; no fix found in current code or history. Open, unlabelled, last activity 538 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 20
Confidence: 80
Support Request: 10
needs triage Bug report where craft-parts organize silently ignores missing source files instead of raising an error. Unlabeled and unresponded to by maintainers for over two years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 80
Support Request: 5
needs triage Bug report stating organize silently succeeds when source files are missing. Open for nearly three years with no maintainer labels or response, though a contributor identified the likely code cause.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1616459 organize keyword does not accept globs to organize into a target directory snapcraft (launchpad) closed Glob expansion for organize entries was added, resolving the inability to use globs when organizing source files; PR #784 was merged in commit 260671d1a.
70%