bug#81542: ['stat' command] Permission bits in octal not displayed in four-digit format when invoked with 'stat -c %a'

Ricky Tigg <[email protected]> Mon, 3 Aug 2026 13:44:06 +0300
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <CAM_8-Cjk0hbU-26EzzgWuTh0mimruik47i2pSepf3RhJq8ac5w@mail.gmail.com>
coreutils v. 9.11

Hello. 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.