← Back to issue list

Charmcraft cannot build or pack from tmp dirs created with tempfile.mkdtemp

View original Github issue

Metadata

Project
charmcraft
Number
#380
Type
issue
State
closed
Author
mmanciop
Labels
Created
Updated
Closed

Current evaluation

Fixed. Charmcraft failed to pack from tempfile.mkdtemp directories due to snap confinement mount namespace restrictions. The issue was resolved when Charmcraft transitioned to classic confinement in v1.0.0, eliminating the path resolution problem.

Suggested action:

No scores available.

Issue body

When creating a charm from a directory created via `tempfile.mkdtemp`, `charmcraft` fails with: ```sh $ charmcraft pack -p /tmp/appcraft-cnb-charmhi8ovz95 Charm directory was not found: '/tmp/appcraft-cnb-charmhi8ovz95' (full execution logs in <snip>/snap/charmcraft/common/charmcraft-log-b4sdcl06) ``` Needless to say, the directory and all the expected files are in fact there, confirmed via a `find /tmp/appcraft-cnb-charmhi8ovz95`: ```sh $ find /tmp/appcraft-cnb-charmhi8ovz95 /tmp/appcraft-cnb-charm-p9h_yd6x /tmp/appcraft-cnb-charm-p9h_yd6x/NOTICE /tmp/appcraft-cnb-charm-p9h_yd6x/metadata.yaml /tmp/appcraft-cnb-charm-p9h_yd6x/src /tmp/appcraft-cnb-charm-p9h_yd6x/src/charm.py /tmp/appcraft-cnb-charm-p9h_yd6x/src/config.json /tmp/appcraft-cnb-charm-p9h_yd6x/LICENSE /tmp/appcraft-cnb-charm-p9h_yd6x/actions.yaml /tmp/appcraft-cnb-charm-p9h_yd6x/requirements.txt ``` When making a `mv /tmp/appcraft-cnb-charmhi8ovz95 ~/appcraft-cnb-charmhi8ovz95`, followed by a `charmcraft pack -p ~/appcraft-cnb-charmhi8ovz95`, it all works as expected.

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6 Fixed. Charmcraft failed to pack from tempfile.mkdtemp directories due to snap confinement mount namespace restrictions. The issue was resolved when Charmcraft transitioned to classic confinement in v1.0.0, eliminating the path resolution problem.
qwen/qwen3.6-35b-a3b Resolved by switching Charmcraft to classic confinement in v1.0.0, eliminating snap mount namespace restrictions that broke temp directory access.
qwen/qwen3.6-35b-a3b Fixed by migrating Charmcraft to classic confinement in v1.0.0. Snap confinement isolated tempfile dirs via mount namespaces, causing path failures. Classic mode removes this restriction.
qwen3.6-35b-a3b-mtp-q6 Fixed in v1.0.0 by migrating Charmcraft to classic snap confinement, resolving the mount namespace issue that blocked packing from tempfile.mkdtemp directories.
qwen3.6-35b-a3b-mtp-q6 Resolved in v1.0.0 by migrating Charmcraft to classic snap confinement, eliminating the mount namespace restriction that blocked packing from tempfile.mkdtemp directories.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#184 Charmcraft crash when snap is used in /tmp directory charmcraft closed Charmcraft crashed with a permission error when run from /tmp due to strict snap confinement. The issue was resolved by switching to classic confinement mode, which removed the restriction. Closed as fixed.
77%
#388 Charmcraft pack cannot run in a CI? charmcraft closed CI build failures were resolved by switching to the charmcraft classic snap on the edge channel, bypassing strict confinement restrictions. The issue was closed after the user confirmed the workaround fixed the build process.
70%