Skip to content

Unescape backslashes in literal path-table text - #1651

Merged
thekevinbot merged 4 commits into
mainfrom
bot/1599-glob-escapes-1104
Nov 5, 2026
Merged

thekevinbot merged 4 commits into
mainfrom
bot/1599-glob-escapes-1104

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1599

A \ in the literal text of a glob now quotes the next character, as bash does:

  • in the directories ahead of the first wildcard, for the walk root and the reported path (./do\cs/*.md, ./my\ dir/*.md, ./do\cs/api.md, ./\do\cs), and in a Unix absolute or config-anchor prefix (/var/lo\g/*.log);
  • in a spelled leading dot (./\.env, ./*/\.draft.md);
  • in a wildcard-free word's .gitignore exemption (./a\.log, ./{a\.log,b}).

The matcher now sets globset's backslash_escape explicitly, so \ escapes on Windows too (it was a literal \ that never matched a /-separated path). A \ in a Windows drive-letter or UNC prefix still separates. New docs/reference/glob.md conformance rows, each checked against bash -O globstar -O nullglob.

Red

Red tests pushed first in 65082c5f: packages/rust/tests/path_table_escapes_cli_e2e.rs (CLI e2e) and packages/rust/tests/path_table_escapes.rs (integration). Red run: https://github.com/thekevinscott/dirsql/actions/runs/41943079000/job/126968458420 (all three integration tests fail with left: [], expected docs/api.md, .env, a.log).

E2E Verification

  • cargo test --workspace --features cli: pass (includes the new CLI e2e and glob_conformance).
  • Python (uv run maturin develop --release, cargo build --release -p dirsql --features cli): testing-conventions e2e attest 'uv run python -m pytest tests/e2e/query_contract_test.py tests/e2e/glob_speed_dotfiles_test.py tests/e2e/glob_speed_gitignore_test.py -x -q': 13 passed.
  • TypeScript (pnpm build): testing-conventions e2e attest 'pnpm exec vitest run --dir tests/e2e query-contract': 9 passed.
  • By hand with the release binary: every repro in Unescape backslashes in literal glob text before walking and ignore checks #1599 matches bash (modulo the documented directory-name and files-only divergences).

Changelog / Migrations

  • Changelog fragment added under packages/rust/changelog.d/
  • Migration fragment with the same slug added under packages/rust/migrations.d/

@thekevinbot
thekevinbot merged commit 0eb54c8 into main Nov 5, 2026
90 checks passed
@thekevinbot
thekevinbot deleted the bot/1599-glob-escapes-1104 branch November 5, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unescape backslashes in literal glob text before walking and ignore checks

1 participant