← Back to issue list

State service doesn't catch permission errors in XDG_RUNTIME_DIR

View original Github issue

Metadata

Project
craft-application
Number
#869
Type
issue
State
open
Author
mr-cal
Labels
Type: Bug
Created
Updated
Closed

Current evaluation

State service crashes with an internal error when XDG_RUNTIME_DIR is not writable, since _create_state_dir only catches FileExistsError. Should raise a user-friendly error or fall back to the home temp dir. Unfixed at HEAD; no comments in over a year.

Suggested action: keep open

Reason: The bug is still present at HEAD: _create_state_dir (state.py) only catches FileExistsError, so a PermissionError from mkdir on XDG_RUNTIME_DIR still surfaces as an internal error, and the /tmp-based fallback to util.get_home_temporary_directory() does not cover permission failures. It is a well-scoped, labelled (Type: Bug) report from a maintainer with concrete repro sources (Treeherder log, Matrix thread), so it should stay open despite 374 days of inactivity; it is not stale-closable because the problem is still reproducible.

Impact: 45 Quick Win: 31.5 Staleness: 75 Complexity: 30 Confidence: 78 Support Request: 5

Issue body

### What needs to get done If access to XDG_RUNTIME_DIR fails with a permission error, the state service should either raise a user-friendly error and recommend using CRAFT_STATE_DIR or fall back to `util.get_home_temporary_directory()`. ### Why it needs to get done Craft application raises an internal error when it fails to create a directory here: https://github.com/canonical/craft-application/blob/e0438e9b1d7db5cbe64c4b48ea92603becf011e4/craft_application/services/state.py#L298-L300 source: - https://treeherder.mozilla.org/logviewer?job_id=523533578&repo=autoland&task=GPQD26JzTRmaea_iieaqpA.0&lineNumber=233457 - https://matrix.to/#/!GGqzbFAUQprdPgYYCM:ubuntu.com/$zsIwY7Ln07TlXoNsY_WY-eQSSAXitSBqWga4ZMOwViM?via=ubuntu.com&via=matrix.org&via=kde.org

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 31.5
Staleness: 75
Complexity: 30
Confidence: 78
Support Request: 5
keep open State service crashes with an internal error when XDG_RUNTIME_DIR is not writable, since _create_state_dir only catches FileExistsError. Should raise a user-friendly error or fall back to the home temp dir. Unfixed at HEAD; no comments in over a year.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 25
Confidence: 85
Support Request: 10
needs triage Unhandled permission errors in XDG_RUNTIME_DIR cause internal crashes in the state service. Suggests adding a fallback to CRAFT_STATE_DIR or a home temp directory. Currently untriaged with zero maintainer comments after 333 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
Support Request: 5
close stale State service crashes on XDG_RUNTIME_DIR permission errors instead of falling back or showing a friendly error. Issue has been inactive for over a year with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 20
Confidence: 80
Support Request: 5
needs triage State service throws an internal error on XDG_RUNTIME_DIR permission failures. Should catch the error, recommend CRAFT_STATE_DIR, or fall back to the home temp directory. Open, unassigned, awaiting implementation.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-application#838 (confidence 70%)

    Merged PR 'fix(StateService): add g+rwx to the state dir' fixed a different state-dir permission case (LXD root needing group access), not the XDG_RUNTIME_DIR access failure in this issue.

Related issues

No related issues found above the similarity threshold.