GNU bug report logs - #34608
date +%+4C is unimplemented, contrary to POSIX

Previous Next

Package: coreutils;

Reported by: Eric Blake <eblake <at> redhat.com>

Date: Thu, 21 Feb 2019 17:11:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 34608 in the body.
You can then email your comments to 34608 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#34608; Package coreutils. (Thu, 21 Feb 2019 17:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eric Blake <eblake <at> redhat.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 21 Feb 2019 17:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: bug-coreutils <at> gnu.org
Subject: date +%+4C is unimplemented, contrary to POSIX
Date: Thu, 21 Feb 2019 11:10:06 -0600
POSIX requires the '+' flag in %C to output padding with leading 0, and
additionally to add a +/- indicator if the minimum field width is larger
than 2 bytes.  Thus:

date -d 0001-01-01 +.%+4C.

should produce ".+000.", but currently it produces ".%+4C." because the
+ flag is unimplemented.

See also http://austingroupbugs.net/view.php?id=1184

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




Information forwarded to bug-coreutils <at> gnu.org:
bug#34608; Package coreutils. (Fri, 22 Feb 2019 03:38:01 GMT) Full text and rfc822 format available.

Message #8 received at 34608 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eric Blake <eblake <at> redhat.com>
Cc: 34608 <at> debbugs.gnu.org
Subject: Re: bug#34608: date +%+4C is unimplemented, contrary to POSIX
Date: Thu, 21 Feb 2019 19:37:46 -0800
Eric Blake wrote:

> date -d 0001-01-01 +.%+4C.
> 
> should produce ".+000.", but currently it produces ".%+4C." because the
> + flag is unimplemented.
> 
> See also http://austingroupbugs.net/view.php?id=1184

Surely this bug should be reported against strftime, not against 'date'. POSIX 
does require that strftime behave that way, but it does not place a similar 
requirement on 'date'.




Information forwarded to bug-coreutils <at> gnu.org:
bug#34608; Package coreutils. (Fri, 22 Feb 2019 03:41:01 GMT) Full text and rfc822 format available.

Message #11 received at 34608 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 34608 <at> debbugs.gnu.org
Subject: Re: bug#34608: date +%+4C is unimplemented, contrary to POSIX
Date: Thu, 21 Feb 2019 21:40:18 -0600
On 2/21/19 9:37 PM, Paul Eggert wrote:
> Eric Blake wrote:
> 
>> date -d 0001-01-01 +.%+4C.
>>
>> should produce ".+000.", but currently it produces ".%+4C." because the
>> + flag is unimplemented.
>>
>> See also http://austingroupbugs.net/view.php?id=1184
> 
> Surely this bug should be reported against strftime, not against 'date'.
> POSIX does require that strftime behave that way, but it does not place
> a similar requirement on 'date'.
> 

That used to be true, but now POSIX wants date to behave as if it uses
strftime:

http://austingroupbugs.net/view.php?id=466


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




Information forwarded to bug-coreutils <at> gnu.org:
bug#34608; Package coreutils. (Fri, 22 Feb 2019 04:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 34608 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eric Blake <eblake <at> redhat.com>
Cc: 34608 <at> debbugs.gnu.org
Subject: Re: bug#34608: date +%+4C is unimplemented, contrary to POSIX
Date: Thu, 21 Feb 2019 20:01:21 -0800
Eric Blake wrote:
> That used to be true, but now POSIX wants date to behave as if it uses
> strftime:
> 
> http://austingroupbugs.net/view.php?id=466

Ah, I didn't know that. Is there a list of recent changes to the POSIX spec for 
strftime somewhere? I can look to see which of them have made their way into 
Gnulib nstrftime.




Information forwarded to bug-coreutils <at> gnu.org:
bug#34608; Package coreutils. (Fri, 22 Feb 2019 15:22:01 GMT) Full text and rfc822 format available.

Message #17 received at 34608 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 34608 <at> debbugs.gnu.org
Subject: Re: bug#34608: date +%+4C is unimplemented, contrary to POSIX
Date: Fri, 22 Feb 2019 09:20:53 -0600
On 2/21/19 10:01 PM, Paul Eggert wrote:
> Eric Blake wrote:
>> That used to be true, but now POSIX wants date to behave as if it uses
>> strftime:
>>
>> http://austingroupbugs.net/view.php?id=466
> 
> Ah, I didn't know that. Is there a list of recent changes to the POSIX
> spec for strftime somewhere? I can look to see which of them have made
> their way into Gnulib nstrftime.

The best I can do is search austingroupbugs.net for all bugs containing
strftime, which pulls up a current total of 25 issues. Some are still
open or marked as rejected, some are editorial only, and some already
were applied in 2008, so the actual list of more recent changes is
smaller.  But reading through them, I think this is a fair summary:

1184: %C padding (for years below 1000, when minimum width is not
specified, it must be treated as width 2 with 0 padding)

1166: Need %OB (similar to %Ob) for nominative vs. genitive month names

954: %s for seconds since Epoch

739 (still not resolved): Whether %F implies plain %C or %+4C

772 (still open): Specifying %:::z and friends, but still at odds with
Finland wanting a way to express UTC+3 instead of UTC+03

472: details on %+C

466: date(1) should behave as if it uses strftime(3)

258: Need %Ob for nominative vs. genitive month names

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 25 Feb 2019 08:29:02 GMT) Full text and rfc822 format available.

Notification sent to Eric Blake <eblake <at> redhat.com>:
bug acknowledged by developer. (Mon, 25 Feb 2019 08:29:02 GMT) Full text and rfc822 format available.

Message #22 received at 34608-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eric Blake <eblake <at> redhat.com>
Cc: 34608-done <at> debbugs.gnu.org
Subject: Re: bug#34608: date +%+4C is unimplemented, contrary to POSIX
Date: Mon, 25 Feb 2019 00:27:47 -0800
[Message part 1 (text/plain, inline)]
Eric Blake wrote:

> The best I can do is search austingroupbugs.net for all bugs containing
> strftime, which pulls up a current total of 25 issues.

Thanks for doing that. I read through those issues, and the only one that seems 
relevant (i.e., resolved by austingroup but not in Gnulib) is the business with 
the + conversion specification flag. I installed this Gnulib patch to implement 
the flag:

https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=188d87b05190690d6f8b0577ec65ef221a711d08

Then I installed the attached coreutils patches to propagate the Gnulib patch 
into coreutils, and I am marking this coreutils bug as done.

glibc strftime should also support the + conversion specification flag. I filed 
a bug report for that here:

https://sourceware.org/bugzilla/show_bug.cgi?id=24264
[0001-build-update-gnulib-submodule-to-latest.patch (text/x-patch, attachment)]
[0002-date-conversion-specification-flag.patch (text/x-patch, attachment)]
[0003-doc-fix-typo-in-previous-patch.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Mar 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.