← Back to issue list

bash gets built with a /bin/bash that is missing the executable bit

View original Github issue

Metadata

Project
snapcraft
Number
#5114
Type
issue
State
open
Author
basak
Labels
Created
2024-10-13 13:14:59+00:00
Updated
2024-10-16 16:41:10+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description If I stage the `bash` and `quilt` packages in a part in a classic snap, then the snap gets built with a `bin/bash` file that is not executable. Subsequent attempts to use it fail. ### To Reproduce On a fresh Noble VM: ``` sudo snap install --classic snapcraft # installs 8.4.3 (12823) mkdir -p demo/snap cat > demo/snap/snapcraft.yaml <<EOT name: demo version: 1 summary: demo description: demo confinement: classic grade: devel base: core24 apps: demo: command: usr/bin/bash parts: demo: build-attributes: [enable-patchelf] plugin: nil stage-packages: [bash, quilt] EOT cd demo snapcraft build --destructive-mode ``` Expected result: `parts/demo/install/bin/bash` is executable, and this passes through to the final snap (if you continue you should also see it in `prime/bin/bash` as executable, etc). Actual result: `parts/demo/install/bin/bash` is not executable and this passes through to the final snap. Then scripts that try to use it fail. ### Environment Ubuntu 24.04 cloud image, snapcraft in destructive mode. Snapcraft snap 8.4.3 (12823). ### snapcraft.yaml ```yaml name: demo version: 1 summary: demo description: demo confinement: classic grade: devel base: core24 apps: demo: command: usr/bin/bash parts: demo: build-attributes: [enable-patchelf] plugin: nil stage-packages: [bash, quilt] ``` ### Relevant log output ```shell 2024-10-13 13:12:26.879 Building demo 2024-10-13 13:12:26.893 execute action demo:Action(part_name='demo', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None)) 2024-10-13 13:12:26.894 load state file: /home/ubuntu/demo/parts/demo/state/pull 2024-10-13 13:12:28.158 fix artifacts: unpack_dir='/home/ubuntu/demo/parts/demo/install' 2024-10-13 13:12:28.175 fix symlink: path='/home/ubuntu/demo/parts/demo/install/usr/share/quilt/compat/bash', unpack_dir='/home/ubuntu/demo/parts/demo/install', root='/home/ubuntu/demo/parts/demo/install/usr/share/quilt/compat' 2024-10-13 13:12:28.207 fix symlink: target='/home/ubuntu/demo/parts/demo/install/bin/bash' 2024-10-13 13:12:28.207 Copying needed target link from the system: /usr/bin/bash 2024-10-13 13:12:30.039 remove directory /home/ubuntu/demo/parts/demo/build 2024-10-13 13:12:30.041 Executing PosixPath('/home/ubuntu/demo/parts/demo/run/build.sh') ``` ### Additional context The trace output suggests that snapcraft is doing something because `usr/share/quilt/compat/bash` is a symlink. If I drop `quilt` from `stage-packages`, then `bin/bash` isn't created. I found this when trying to move the git-ubuntu snap to core24. That's complex enough so I came up with a minimal reproducer. Workaround: I did this: ``` override-stage: | craftctl default chmod 755 bin/bash ```

Evaluation history

No evaluation history available.