Skip to content

v0.9.1

Choose a tag to compare

@severity1 severity1 released this 18 Apr 02:31
· 3 commits to main since this release
172bd77

Bug Fix

Fix glued shell-operator tokens leaking into dirty-files (#31)

extract_files_from_bash() used an exact-match check against shell operators, but shlex.split() does not split tokens that have operators glued to adjacent text. This caused garbage entries like /project/2>/dev/null and /project/echo to appear in dirty-files, triggering false Stop-hook memory-updater runs with nonsense file lists.

Affected forms (all now handled correctly):

  • Stderr redirect glued to path: rm foo.txt 2>/dev/null
  • Stdout redirect: rm foo.txt >log.txt, rm foo.txt >>log.txt
  • Semicolon glued to filename: rm foo.txt; rm bar.txt
  • Trailing semicolon: rm foo.txt;
  • All redirect prefixes: 1>, 2>, &>, <

Fix: replaced the membership test with two helpers:

  • is_shell_op(token) - detects pure operator tokens and prefix-attached redirects
  • process_token(token, files) - strips trailing semicolons, records the filename, and signals the loop to stop

Tests

  • 45 new parametrized unit tests in TestExtractFilesFromBash covering all redirect forms, chaining operators, multiple-file rm, git rm / mv / git mv / unlink, and degenerate inputs
  • Total: 207 tests passing (up from 162)

Full Changelog

v0.9.0...v0.9.1