canonical / canonical/craft-application
State service doesn't catch permission errors in XDG_RUNTIME_DIR
- Dominant language
- Python
- Stars
- 14
- Forks
- 29
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 12
Description
### 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
Contributor guide
Research direction
Start in craft_application/services/state.py around lines 298-300, where creation of the XDG_RUNTIME_DIR directory raises the internal error. Reproduce the permission-error path and inspect how CRAFT_STATE_DIR and util.get_home_temporary_directory() are exposed. Done means permission failures produce a user-friendly recommendation or use the fallback behavior described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100