uutils/coreutils

stat: %N fails with new line

Closed

#9,925 opened on Dec 30, 2025

 (1 comment) (1 reaction) (0 assignees)Rust (1,976 forks)batch import
U - statgood first issue

Repository metrics

Stars
 (23,854 stars)
PR merge metrics
 (Avg merge 5d 23h) (239 merged PRs in 30d)

Description

touch $'/tmp/test\nnewline'

FORMAT='{"name":"%N"}'

# GNU stat (correct)
/usr/bin/stat -c "$FORMAT" $'/tmp/test\nnewline'
# Output: {"name":"'/tmp/test'$'\n''newline'"}

# uutils stat (broken)
./target/debug/coreutils stat -c "$FORMAT" $'/tmp/test\nnewline'
# Output: {"name":"'/tmp/test
# newline'"}

rm -f $'/tmp/test\nnewline'
{"name":"'/tmp/test'$'\n''newline'"}
{"name":"'/tmp/test
newline'"}

Contributor guide