← Back to issue list

Strange behaviour when organizing from an empty string

View original Github issue

Metadata

Project
craft-parts
Number
#1526
Type
issue
State
open
Author
lengau
Labels
Status: Triaged Type: Bug
Created
2026-03-31 14:59:21+00:00
Updated
2026-04-03 16:08:08+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description Files or directories seem to disappear if an organize key is an empty string. I can't find the pattern by which the file disappears, but pretty consistently there is at least one missing file/directory. They either don't make it into the install directory or are removed during the organize process. ### To Reproduce Consider the part YAML below. When used as-is, the expected behaviour occurs: ``` (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts prime INFO:craft_parts.executor.executor:Installing build-packages Execute: Pull a Execute: Overlay a Execute: Build a Execute: Stage a Execute: Prime a (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ tree prime prime ├── my-dir │   └── subdir-a │   └── file └── my-file 3 directories, 2 files ``` When organizing `'*'` to `''`, it works as expected as well: ``` (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts clean Clean all parts. (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts prime INFO:craft_parts.executor.executor:Installing build-packages Execute: Pull a Execute: Overlay a Execute: Build a Execute: Stage a Execute: Prime a (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ tree prime prime ├── my-dir │   └── subdir-a │   └── file └── my-file 3 directories, 2 files ``` However, when organizing from an empty string, a file goes missing: ``` (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts clean Clean all parts. (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts prime INFO:craft_parts.executor.executor:Installing build-packages Execute: Pull a Execute: Overlay a Execute: Build a Error: Failed to copy '/home/lengau/Work/Code/craft-parts/parts/a/install/my-file': no such file or directory. (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ tree parts/a/install/ parts/a/install/ └── my-dir └── subdir-a └── file 3 directories, 1 file ``` If you comment out the creation of `my-file`, then `my-dir/subdir-a/file` goes missing instead: ``` (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts clean Clean all parts. (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ python -m craft_parts prime INFO:craft_parts.executor.executor:Installing build-packages Execute: Pull a Execute: Overlay a Execute: Build a Error: Failed to copy '/home/lengau/Work/Code/craft-parts/parts/a/install/my-dir/subdir-a/file': no such file or directory. (craft-parts) lengau@ratel:~/Work/Code/craft-parts$ tree parts/a/install/ parts/a/install/ └── my-dir └── subdir-a 3 directories, 0 files ``` ### part yaml ```shell parts: a: plugin: nil override-build: | mkdir -p "${CRAFT_PART_INSTALL}/my-dir/subdir-a" touch "${CRAFT_PART_INSTALL}/my-file" touch "${CRAFT_PART_INSTALL}/my-dir/subdir-a/file" # organize: # '': '' ``` ### Relevant log output ```shell DEBUG:craft_parts.packages:get repository attribute: attr=configure, repository:<class 'craft_parts.packages.deb.Ubuntu'> DEBUG:craft_parts.utils.os_utils:is_snap: False, SNAP_NAME set to None DEBUG:craft_parts.sequencer:process a:1 DEBUG:craft_parts.sequencer:add action a:1(0) DEBUG:craft_parts.sequencer:process a:2 DEBUG:craft_parts.sequencer:add action a:2(0) DEBUG:craft_parts.sequencer:process a:3 DEBUG:craft_parts.sequencer:add action a:3(0) DEBUG:craft_parts.sequencer:process a:4 DEBUG:craft_parts.sequencer:add action a:4(0) DEBUG:craft_parts.sequencer:process a:5 DEBUG:craft_parts.sequencer:add action a:5(0) INFO:craft_parts.executor.executor:Installing build-packages DEBUG:craft_parts.packages:get repository attribute: attr=install_packages, repository:<class 'craft_parts.packages.deb.Ubuntu'> DEBUG:craft_parts.executor.executor:verify plugin environment for part 'a' DEBUG:craft_parts.packages:set repository attribute: attr=stage_packages_filters, value=None, repo:<class 'craft_parts.packages.deb.Ubuntu'> Execute: Pull a DEBUG:craft_parts.executor.executor:execute action a:Action(part_name='a', step=Step.PULL, action_type=ActionType.RUN, reason=None, project_vars=ProjectVarInfo(root={}), properties=ActionProperties(changed_files=None, changed_dirs=None)) Execute: Overlay a DEBUG:craft_parts.executor.executor:execute action a:Action(part_name='a', step=Step.OVERLAY, action_type=ActionType.RUN, reason=None, project_vars=ProjectVarInfo(root={}), properties=ActionProperties(changed_files=None, changed_dirs=None)) Execute: Build a DEBUG:craft_parts.executor.executor:execute action a:Action(part_name='a', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=ProjectVarInfo(root={}), properties=ActionProperties(changed_files=None, changed_dirs=None)) DEBUG:craft_parts.state_manager.states:load state file: /home/lengau/Work/Code/craft-parts/parts/a/state/pull DEBUG:craft_parts.packages:get repository attribute: attr=unpack_stage_packages, repository:<class 'craft_parts.packages.deb.Ubuntu'> DEBUG:craft_parts.executor.part_handler:remove directory /home/lengau/Work/Code/craft-parts/parts/a/build DEBUG:craft_parts.executor.step_handler:Executing PosixPath('/tmp/tmp___xqkav/scriptlet.sh') DEBUG:craft_parts.executor.part_handler:Run pre-organize callbacks Error: Failed to copy '/home/lengau/Work/Code/craft-parts/parts/a/install/my-file': no such file or directory. ```

Evaluation history

No evaluation history available.