GNU bug report logs -
#35078
Possible bug in the date command, to do with %p
Previous Next
Reported by: Nicholas Joll <najoll <at> posteo.net>
Date: Tue, 2 Apr 2019 08:50:02 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35078 in the body.
You can then email your comments to 35078 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
help-debbugs <at> gnu.org
:
bug#35078
; Package
date
.
(Tue, 02 Apr 2019 08:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicholas Joll <najoll <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
help-debbugs <at> gnu.org
.
Your message had a Version: pseudo-header with an invalid package
version:
GNU coreutils 8.28
please either use found or fixed to the control server with a correct
version, or reply to this report indicating the correct version so the
maintainer (or someone else) can correct it for you.
(Tue, 02 Apr 2019 08:50:02 GMT) Full text and rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Package: date
Version: GNU coreutils 8.28
The manual for 'date' includes this:
%p locale's equivalent of either AM or PM; blank if not known
%P like %p, but lower case
But on my system:
$ date +%p
am
$ date +%P
am
That is: it seems impossible to get a capitalised 'AM' or 'PM'.
Might this be a problem with my locale? Here is how my locale is set:
$ locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE=en_GB.UTF-8
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=
My OS: (GNU-)Linux Mint 19.1 x64 Cinnamon
Yours,
Nicholas
[0x63EC0B0B39DEE1CD.asc (application/pgp-keys, attachment)]
Information forwarded
to
help-debbugs <at> gnu.org
:
bug#35078
; Package
date
.
(Tue, 02 Apr 2019 16:49:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 35078 <at> debbugs.gnu.org (full text, mbox):
tags 35078 notabug
close 35078
stop
Hello,
On 2019-04-02 2:14 a.m., Nicholas Joll wrote:
> The manual for 'date' includes this:
> %p locale's equivalent of either AM or PM; blank if not known
> %P like %p, but lower case
>
> But on my system:
>
> $ date +%p
> am
> $ date +%P
> am
>
> That is: it seems impossible to get a capitalised 'AM' or 'PM'.
>
> Might this be a problem with my locale? Here is how my locale is set:
>
> $ locale
> LANG=en_GB.UTF-8
Exactly as you suspected: it is due to your locale.
Note the wording:
"locale's *equivalent* of either AM or PM"
So not the exact strings AM or PM, but what your locate uses.
In C/POSIX, these are indeed upper/lower case:
$ LC_ALL=C date +"%p %P"
AM am
Same for Canada:
$ LC_ALL=en_CA.UTF-8 date +"%p %P"
AM am
But not for Great Britain:
$ LC_ALL=en_GB.UTF-8 date +"%p %P"
am am
Also note that these are blank in many other locales:
$ LC_ALL=ru_RU.utf8 date +"=%p=%P="
===
I'm making this as "not a bug", but discussion can continue by
replying to this thread.
-assaf
Added tag(s) notabug.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Apr 2019 16:49:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
35078 <at> debbugs.gnu.org and Nicholas Joll <najoll <at> posteo.net>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Apr 2019 16:49:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
help-debbugs <at> gnu.org
:
bug#35078
; Package
date
.
(Wed, 03 Apr 2019 02:37:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 35078 <at> debbugs.gnu.org (full text, mbox):
Dear Assaf (and all)
> I'm making this as "not a bug", but discussion can continue by
replying to this thread.
> -assaf
Thank you Assaf for your lucid explanation and for your invitation to
discussion.
I imagine that this matter arises fairly frequently. For, the behaviour
here is not what one expects (at least not what the
less-than-fully-informed user expects).
One might think there is no real problem: though lowercase 'am'/'pm'
looks somewhat odd, and is not what the user expects when using '%P', it
is easy programmatically to convert lowercase to uppercase. Yet, some
people will use the program 'Conky' to display the time, and (to my
knowledge) Conky cannot do the string conversion.
I have two suggestions. (1) Amend the manual such that it says something
like the following.
%P like %p, but lower case (or uppercase if uppercase is all
that the locale provides)
(2) Add (and document) a new option that works thusly:
%PP locale's implementation of AM/PM (or blank if the locale has
no such implementation), forced into uppercase
1 is somewhat important. The conjunction of 1 and 2 would be ideal. Or
so it seems to me.
Nicholas
Information forwarded
to
help-debbugs <at> gnu.org
:
bug#35078
; Package
date
.
(Wed, 03 Apr 2019 03:09:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 35078 <at> debbugs.gnu.org (full text, mbox):
On 4/2/19 3:22 PM, Nicholas Joll wrote:
> I have two suggestions. (1) Amend the manual such that it says something
> like the following.
>
> %P like %p, but lower case (or uppercase if uppercase is all
> that the locale provides)
>
> (2) Add (and document) a new option that works thusly:
>
> %PP locale's implementation of AM/PM (or blank if the locale has
> no such implementation), forced into uppercase
We can't spell it %PP (that would be parsed as "%P" "P"), but we could
take a leaf from %:z (and even %:::z) if we wanted to use : as a flag to
force particular capitalizations. Of course, even toupper()/tolower()
are locale-dependent, so it's still hard to say what could really be
forced if we added particular variants for overriding a locale's
preferred case.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
bug reassigned from package 'date' to 'coreutils'.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 03 Apr 2019 18:45:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#35078
; Package
coreutils
.
(Wed, 03 Apr 2019 20:10:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 35078 <at> debbugs.gnu.org (full text, mbox):
Dear all
The following relevant thing has been brought to my attention (by a
Conky developer):
$ man strftime | grep Convert
^ Convert alphabetic characters in result string to
uppercase.
i.e., strftime, which is, I believe, a C function included in the C
'time' library, has an option (which one can use in Conky, actually) to
convert output to all uppercase - thus achieving what I desired. 'Date'
could implement something similar.
Yours
Nicholas
On 03/04/2019 04:08, Eric Blake wrote:
> On 4/2/19 3:22 PM, Nicholas Joll wrote:
>
>> I have two suggestions. (1) Amend the manual such that it says something
>> like the following.
>>
>> %P like %p, but lower case (or uppercase if uppercase is all
>> that the locale provides)
>>
>> (2) Add (and document) a new option that works thusly:
>>
>> %PP locale's implementation of AM/PM (or blank if the locale has
>> no such implementation), forced into uppercase
> We can't spell it %PP (that would be parsed as "%P" "P"), but we could
> take a leaf from %:z (and even %:::z) if we wanted to use : as a flag to
> force particular capitalizations. Of course, even toupper()/tolower()
> are locale-dependent, so it's still hard to say what could really be
> forced if we added particular variants for overriding a locale's
> preferred case.
>
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 02 May 2019 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 354 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.