Skip to content

Fix audit findings in mv, touch, rmdir, mktemp#29

Open
kelp wants to merge 1 commit intomainfrom
fix/audit-mv-touch-rmdir-mktemp
Open

Fix audit findings in mv, touch, rmdir, mktemp#29
kelp wants to merge 1 commit intomainfrom
fix/audit-mv-touch-rmdir-mktemp

Conversation

@kelp
Copy link
Copy Markdown
Owner

@kelp kelp commented Mar 31, 2026

Summary

  • mv: Hardlink same-file move (same inode, different paths) now unlinks the source and exits 0 instead of erroring
  • touch: -h/--no-dereference implies -c (no create) so nonexistent files are not created when the intent is to operate on a symlink
  • rmdir: Verbose message prints before the removal attempt so --ignore-fail-on-non-empty no longer suppresses -v output
  • mktemp: Templates with implicit suffixes (e.g., myapp.XXXXXXtxt, test.XXXXXX.log) are now accepted by finding the last run of 3+ consecutive X's

Test plan

  • just it-util mv -- 110 passed, 1 skipped, 0 failed
  • just it-util touch -- 120 passed, 0 failed
  • just it-util rmdir -- 46 passed, 0 failed
  • just it-util mktemp -- implicit suffix tests pass (5 pre-existing failures in bare-template/cwd and -t/slash tests are unrelated)
  • zig build test -- all unit tests pass

mv: hardlink same-file move now unlinks source and exits 0
touch: -h/--no-dereference implies -c (no create)
rmdir: -v prints before removal so --ignore-fail-on-non-empty
  does not suppress verbose output
mktemp: support implicit suffix after X's in template
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