uutils/coreutils

stat: %N fails with new line

Open

#9925 opened on Dec 30, 2025

View on GitHub
 (1 comment) (1 reaction) (0 assignees)Rust (23,246 stars) (1,852 forks)batch import
U - statgood first issue

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