Skip to content

mkdir: quote invalid modes in diagnostics - #13862

Open
0Whisperos wants to merge 1 commit into
uutils:mainfrom
0Whisperos:fix/mkdir-invalid-mode-quoting
Open

mkdir: quote invalid modes in diagnostics#13862
0Whisperos wants to merge 1 commit into
uutils:mainfrom
0Whisperos:fix/mkdir-invalid-mode-quoting

Conversation

@0Whisperos

Copy link
Copy Markdown
Contributor

Fixes #13834.

mkdir -m now handles invalid modes consistently across stderr environments:

  • When stderr is not a terminal (for example, in scripts or pipelines), it reports a GNU-compatible one-line diagnostic such as invalid mode 'a=\001'.
  • When stderr is a terminal, it preserves the rich mode diagnostic introduced in mkdir: point at the failing part of an invalid mode #13826 while escaping control characters in both the error message and the rendered command snippet. The highlighted span is adjusted after escaping.

This keeps non-printable mode characters visible instead of emitting them directly to stderr.

Tests cover both piped and terminal stderr for a=\x01.

Use C-style quoting for invalid mode errors when stderr is not a terminal. Escape control characters in rich mode diagnostics while preserving the highlighted span.
@github-actions

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 149.13 MB (+524 KB, +0.34%)

Significant per-binary changes:
  mkdir       1.09 MB ->    1.22 MB  (+128 KB, +11.43%)
  install     1.24 MB ->    1.36 MB  (+116 KB, +9.12%)
  mkfifo      1.09 MB ->    1.20 MB  (+116 KB, +10.43%)
  mknod       1.09 MB ->    1.21 MB  (+116 KB, +10.36%)

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/csplit/csplit-heap is now being skipped but was previously passing.

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.

minorbug(mv): when -m is \x01 it do not quote it like gnu

1 participant