Skip to content

expand_pattern: match glob patterns against the whole name - #624

Open
rpinho wants to merge 1 commit into
latchbio:mainfrom
rpinho:fix-glob-fullmatch
Open

rpinho wants to merge 1 commit into
latchbio:mainfrom
rpinho:fix-glob-fullmatch

Conversation

@rpinho

@rpinho rpinho commented Nov 14, 2026

Copy link
Copy Markdown

There's a bug in expand_pattern: it uses re.match, which only anchors at the start, so *.fq also matches a.fq.gz, a.fq.bak and notes.fq.txt.

latch cp, latch mv and latch rm expand patterns through it. Without --verbose, rm only asks "Remove N file/dir(s)?", so latch rm 'latch:///dir/*.fq' can remove the .fq.gz files too without listing them.

This uses re.fullmatch.

Test: tests/test_glob_expand_pattern.py fails on main and passes here. Full suite (without tests/test_ls.py, which needs a token): 70 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

re.match only anchored at the start, so *.fq also matched a.fq.gz,
and latch cp/mv/rm acted on those files too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N
@rpinho

rpinho commented Nov 17, 2026

Copy link
Copy Markdown
Author

Let me know if you have any thoughts on this one.

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.

1 participant