Repository navigation
fix: preserve literal backslashes in quoted user directories - #614
Merged
gaborbernat merged 2 commits intoOct 11, 2026
Merged
Conversation
pre-commit.ci cannot find python3.15 and fails before running any hooks. Use python3 so hook environments use an installed interpreter. Document the different backslash handling in xdg-user-dir and cover mixed escapes.
gaborbernat
force-pushed
the
fix-user-dirs-literal-backslashes
branch
from
October 10, 2026 22:40
20e55ea to
7587176
Compare
gaborbernat
enabled auto-merge (squash)
October 10, 2026 22:51
gaborbernat
approved these changes
Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change, a double-quoted
user-dirs.dirsentry such asXDG_DOCUMENTS_DIR="/data/a\q"resolved to/data/aq. Shell double quotes preserve\q, so the directory name changed.Unescape only
$, backticks, double quotes, and backslashes. Keep$HOMEprefix expansion and bare-value handling. Thexdg-user-dirutility still removes a backslash before an ordinary character in a hand-written entry;\\gives the same result in both readers. The Unix docs explain this difference.Regression cases cover ordinary, special, and mixed escapes with absolute and
$HOMEpaths. Linux checks pass on Python 3.11 and 3.15, along with tox type, fix, and docs. Changed-line coverage is 100%. pre-commit.ci passes after usingpython3for hook environments.