On 03/08/2026 11:44, Ricky Tigg wrote:
coreutils v. 9.11Hello. Permission bits in octal not displayed in four-digit format when invoked with 'stat -c %a' unlike it does with 'stat' alone. manual STAT(1) "The valid format sequences for files (without --file-system): %a permission bits in octal (see '#' and '0' printf flags)" note: command filtered $ stat /etc/{shadow,passwd} File: /etc/shadow Access: (0000/----------) Uid: (0/root) Gid: (0/root) File: /etc/passwd Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root) Four-digit permission bits in octal. $ stat -c '%a/%A %u/%U %g/%G %n' /etc/{shadow,passwd} | column -t 0/---------- 0/root 0/root /etc/shadow 644/-rw-r--r-- 0/root 0/root /etc/passwd Not four-digit permission bits in octal. In the worse case it is not even three-digit permission bits in octal. Expected: Permission bits in octal displayed in four-digit format when invoked with 'stat -c %a' like it does with 'stat' alone.
Well we give configurability when using format chars, through the mentioned '0' and '#' flags. See: https://github.com/coreutils/coreutils/commit/a0c5313d6 E.g.: $ stat -c '%a %04a %#a %#03a' /etc/shadow . 0 0000 0 000 711 0711 0711 0711 I'm not sure it's worth changing the default at this stage. Padraig
