Skip to content

Fix mkdir symbolic mode parsing and -p -m leaf-only#23

Open
kelp wants to merge 1 commit intomainfrom
fix-mkdir-symbolic-mode-and-leaf-only
Open

Fix mkdir symbolic mode parsing and -p -m leaf-only#23
kelp wants to merge 1 commit intomainfrom
fix-mkdir-symbolic-mode-and-leaf-only

Conversation

@kelp
Copy link
Copy Markdown
Owner

@kelp kelp commented Mar 31, 2026

Summary

  • Add symbolic mode support (u=rwx, go=rx, a+rx, go-w, etc.) to mkdir's parseMode function. Previously only octal modes were accepted.
  • Fix -p -m to apply the specified mode only to the leaf directory, matching GNU mkdir behavior. Intermediate directories now get default permissions (umask-based).
  • Update unit tests and integration tests to match GNU semantics.

Test plan

  • just it-util mkdir passes all 106 tests with 0 failures
  • zig build test passes all unit tests
  • Symbolic modes verified: u=rwx,go=rx (755), a+rx (555), go-w (noop from 0)
  • Leaf-only mode verified: -p -m 700 sets 700 on leaf, default on intermediates

Add symbolic mode support (u=rwx, go=rx, a+rx, etc.) to
mkdir's parseMode function. Previously only octal modes
were accepted, causing failures for GNU-style symbolic
mode strings.

Fix -p -m to apply the specified mode only to the leaf
directory, matching GNU mkdir behavior. Intermediate
directories now get default permissions (umask-based)
instead of the explicit mode.
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