Subject: coreutils: pr: date format is %F %R always, must be %b %e %H:%M %Y if LC_TIME=C

From: наб <[email-masked]>
Date: Tue, 25 Apr 2023 23:19:15 +0200

Package: coreutils
Version: 8.32-4+b1
Version: 9.1-1
Severity: normal

Dear Maintainer,

Quoth Issue 8 Draft 2.1 (unchanged for a long time),
XCU, pr, STDOUT:
-- >8 --
104141  In the POSIX locale, the <output of date> field, representing the date and time of last modification
104142  of the input file (or the current date and time if the input file is standard input), shall be
104143  equivalent to the output of the following command as it would appear if executed at the given
104144  time:
104145  date "+%b %e %H:%M %Y"
104146  without the trailing <newline>, if the page being written is from standard input. If the page
104147  being written is not from standard input, in the POSIX locale, the same format shall be used, but
104148  the time used shall be the modification time of the file corresponding to file instead of the current
104149  time. When the LC_TIME locale category is not set to the POSIX locale, a different format and
104150  order of presentation of this field may be used.
-- >8 --
RATIONALE:
-- >8 --
104203  The <output of date> field in the −l format is specified only for the POSIX locale. As noted, the
104204  format can be different in other locales. No mechanism for defining this is present in this volume
104205  of POSIX.1-202x, as the appropriate vehicle is a message catalog; that is, the format should be
104206  specified as a ``message’’.
-- >8 --
(the -l thing appears to be an error).

Why, then:
-- >8 --
$ echo  | pr -f

2023-04-25 23:16                                                  Page 1

$ echo  | LC_ALL=C pr -f

2023-04-25 23:16                                                  Page 1

$ echo  | LC_ALL=POSIX pr -f

2023-04-25 23:16                                                  Page 1

-- >8 --

This is just like who, except this works in coreutils who.

Best,
наб

-- System Information:
Debian Release: 12.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: amd64, i386

Kernel: Linux 6.1.0-2-amd64 (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages coreutils depends on:
ii  libacl1      2.3.1-3
ii  libattr1     1:2.5.1-4
ii  libc6        2.36-9
ii  libgmp10     2:6.2.1+dfsg1-1.1
ii  libselinux1  3.4-1+b5

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information