Skip to content

POSIX character classes match in globs, as bash - #1280

Merged
thekevinscott merged 9 commits into
mainfrom
claude/1267-posix-classes
Oct 5, 2026
Merged

thekevinscott merged 9 commits into
mainfrom
claude/1267-posix-classes

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1267

POSIX character classes inside brackets now match as bash does, on path-tables and on config [[table]] glob / ignore. globset has no [:name:] syntax, so a bracket holding one is rewritten into plain ranges before compiling: [[:digit:]] → [0-9].

  • All bash classes: alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit; negation with ! or ^.
  • Bash quirks matched: an unknown class contributes nothing, - after a class is literal, a range ending in a class ([x-[:digit:]]) matches nothing.
  • A bracket never matches / (./pc[[:punct:]]*.md does not reach pc/).
  • Classes cover ASCII. The bracket still matches one whole UTF-8 character: caf[![:digit:]].md matches café.md, caf[[:digit:]].md does not. Divergence from bash in a UTF-8 locale: a non-ASCII letter such as é is not in [[:alpha:]]/[[:alnum:]] here, though bash counts it.

Compared against bash -O globstar -O nullglob (dotglob off) on a /tmp fixture across 15 patterns ([[:digit:]], [[:upper:]]*, [![:digit:]], [[:punct:]]* with \ ] - ! ^ names, [^[:alnum:]]*, **/[[:digit:]].md, [[:foo:]1], [x-[:digit:]], ...). Identical except for directory rows (files-only divergence).

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass
  • TypeScript SDK e2e: pass
  • Rust core e2e (if applicable): pass
  • packages/python/e2e-attestations/<branch>.json receipt written if packages/python changed (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written if packages/ts changed (just e2e-attest-ts)
  • Command(s) run: just e2e-attest-python, just e2e-attest-ts, cargo test --workspace --features cli
  • Result summary: python 40 passed; ts 18 passed; rust workspace all green (rerun after merging main).

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package
  • Migration fragment with the same slug added under <root>/<pkg>/migrations.d/ for each changed package

…sses

# Conflicts:
#	packages/rust/src/matcher.rs
#	packages/rust/src/scanner.rs
#	packages/rust/tests/path_table_globs.rs
@thekevinscott
thekevinscott merged commit 2492253 into main Oct 5, 2026
83 checks passed
@thekevinscott
thekevinscott deleted the claude/1267-posix-classes branch October 5, 2026 19:32
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.

POSIX character classes ('[[:digit:]]') match nothing; bash supports them

2 participants