← Back to issue list

Successfully pack charm with incorrect charm.py file permission

View original Github issue

Metadata

Project
charmcraft
Number
#1931
Type
issue
State
open
Author
yhaliaw
Labels
Created
Updated
Closed

Current evaluation

charmcraft pack succeeds even when src/charm.py lacks the execute bit, producing a charm that fails at deploy with 'Permission denied'. Requested a warning/error or auto-fix at pack time. No maintainer activity; an entrypoint linter now exists but only runs via charmcraft analyze, not pack.

Suggested action: needs triage

Reason: No labels, no comments, no assignee, and last activity 381 days ago, so it has never been triaged. The problem is still real: charm_builder.py never chmods the entrypoint, and the Entrypoint linter (linters.py:542, 'The entrypoint file is not executable') only runs through charmcraft analyze, not as part of pack, so the requested pack-time warning/error is unimplemented. Not close_stale because the behavior is still reproducible and relevant.

Impact: 45 Quick Win: 29.25 Staleness: 72 Complexity: 35 Confidence: 62 Support Request: 10

Issue body

### Bug Description Packing the charm with `src/charm.py` without execute permission will result in produced charm to fail with `unit.content-cache/0.install /var/lib/juju/agents/unit-content-cache-0/charm/dispatch: 3: exec: ./src/charm.py: Permission denied` when deployed with juju. charmcraft should either warn/error out or fix the file permission for `src/charm.py` when packing the charm. ### To Reproduce - Start with any working charm. - Set the `src/charm.py` to without execute permission, e.g., `chmod -x src/charm.py`. - Pack the charm with `charmcraft pack`, then deploy with `juju deploy {PATH_TO_CHARM_PACKED}`. ### Environment Host: Ubuntu 22.04 LTS Charm: deployed on LXD container and machine on 22.04 ### charmcraft.yaml ```yaml This issue is not related to the charmcraft.yaml ``` ### Relevant log output ```shell The error when juju deploy: `unit.content-cache/0.install /var/lib/juju/agents/unit-content-cache-0/charm/dispatch: 3: exec: ./src/charm.py: Permission denied` ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 29.25
Staleness: 72
Complexity: 35
Confidence: 62
Support Request: 10
needs triage charmcraft pack succeeds even when src/charm.py lacks the execute bit, producing a charm that fails at deploy with 'Permission denied'. Requested a warning/error or auto-fix at pack time. No maintainer activity; an entrypoint linter now exists but only runs via charmcraft analyze, not pack.
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 25
Confidence: 85
Support Request: 10
needs triage Charmcraft packs charms with src/charm.py lacking execute permission, causing deployment failures. Untriaged, no maintainer response, inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 70
Support Request: 5
close stale charmcraft packs charms without preserving or fixing execute permissions on src/charm.py, causing deployment failures. The report has been inactive for over a year with no maintainer response or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 20
Confidence: 85
Support Request: 10
needs triage Charmcraft fails to enforce execute permissions on src/charm.py during packing, causing Juju deployment failures. Issue remains untriaged with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
Support Request: 0
needs triage charmcraft silently packs charms with src/charm.py lacking execute permissions, causing deployment failures. Should warn, error, or auto-fix permissions. Open, untriaged, inactive for 300 days.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#907 `charmcraft pack` does not handle updating a file's execution permissions without a `charmcraft clean` charmcraft open charmcraft pack ignores local file permission changes (e.g., chmod +x on src/charm.py) until a full charmcraft clean, causing confusing lint errors. Maintainer reproduced and filed upstream craft-parts#311; still unfixed.
80%
#2402 Odd error when packing charmcraft closed A typo in charmcraft caused a chown command to fail with a permission string. The author identified it should be chmod. The issue was closed, confirming the bug was fixed in charmcraft to resolve the packing error.
75%
#497 charmcraft Pack is not Working charmcraft closed Resolved via user environment fix. The permission error stemmed from running charmcraft as root with root-owned files. Switching to a regular user, adding them to the lxd group, and correcting ownership allowed pack to succeed. No code changes required.
75%
#922 Unable to pack charms on a GCP instance charmcraft closed Closed as not a Charmcraft bug. The error stems from a pip and setuptools version mismatch. Maintainers provided a workaround: adding setuptools to charm-python-packages in charmcraft.yaml to force an update and resolve the build failure.
73%
#1930 `charmcraft pack -o` fails: `FileNotFoundError` charmcraft closed A FileNotFoundError with charmcraft pack -o was abandoned and closed without resolution. No fix was implemented, and a recent comment confirms the bug persists.
72%
#2233 charmcraft should complain if the charm contains a bundle charmcraft open Request for charmcraft pack to warn or fail when a charm root contains a bundle.yaml, since juju then deploys the bundle instead of the charm. No labels, no maintainer response; validation still absent from current pack code.
72%
#1747 Failed to run the build script for part 'charm' charmcraft closed Build script failure during charmcraft pack was resolved. The issue was closed after the maintainer acknowledged the report and merged the fix in PR #1751.
72%
#879 pack command succeeds without copying charm charmcraft closed Closed. The pack command failure stems from outdated setuptools and pip in the charm tool, tracked externally, and charmcraft failing to detect build errors, already resolved in version 2.1.
71%
#1530 Changing charmcraft.yaml doesn't update the resulting charm's metadata.yaml charmcraft open Bug: editing charmcraft.yaml then re-running `charmcraft pack` does not update the resulting charm's metadata.yaml. Filed by a maintainer (lengau); last comment (2024-09-09) says it's unclear if still reproducible. Related open craft-application#821 describes the same 'Already packed' skip behavior.
71%
#551 [charmcraft 1.3]: Cannot pack a charm with Jinja2 as dependency charmcraft closed Charmcraft 1.3 failed to pack charms with Jinja2 due to dependency issues. Closed with a setuptools workaround. Resolved via PR #553, which adds a charm-python-packages property to pre-install dependencies before requirements.
71%