Bug 211598

Summary: date(1) default format in en_US locale breaks compatibility with 10.3
Product: Base System Reporter: Mark.Martinec
Component: standardsAssignee: freebsd-standards (Nobody) <standards>
Status: Closed FIXED    
Severity: Affects Some People CC: ache
Priority: ---    
Version: 11.0-BETA3   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
date(1) compatibility matrix none

Description Mark.Martinec 2016-08-05 14:41:57 UTC
Created attachment 173319 [details]
date(1) compatibility matrix

============
(1) 11.0-BETA3 breaks compatibility with 10.3 and other OS,
    and violates posix [1](see below, and item (3))

$ LC_ALL=en_US.UTF-8 date

FreeBSD 11.0-BETA3 :  (wrong)
  Friday, August  5, 2016 at 03:20:25 PM CEST

FreeBSD 10.3-RELEASE-p6 :  (ok)
  Fri Aug  5 15:15:11 CEST 2016

OSX version 10.9.5 :  (ok)
  Fri Aug  5 14:57:14 CEST 2016

Fedora Linux 4.6.4-301.fc24.x86_64 :  (ok)
  Fri Aug  5 15:10:40 CEST 2016

Debian 8.0 / Linux 4.4.16-v7+ :  (ok)
  Fri Aug  5 15:25:49 CEST 2016


============
(2) missing day of the week name in es_ES locale

$ LC_ALL=es_ES.UTF-8 date

FreeBSD 11.0-BETA3 :
   5 de agosto de 2016, 15:20:25 CEST

FreeBSD 10.3-RELEASE-p6 :
  viernes,  5 de agosto de 2016, 15:15:11 CEST


============
(3) 11.0 and 10.3 violate Posix [1](see below), which states:

  When no formatting operand is specified, the output in
  the POSIX locale shall be equivalent to specifying:
  date "+%a %b %e %H:%M:%S %Z %Y"


FreeBSD 11.0-BETA3 :

  $ LC_ALL=fr_FR.UTF-8 date
  vendredi  5 août 2016 15:20:25 CEST

  $ LC_ALL=fr_FR.UTF-8 date '+%a %b %e %H:%M:%S %Z %Y'
  ven. août  5 15:20:25 CEST 2016


FreeBSD 10.3-RELEASE-p6 :

  $ LC_ALL=fr_FR.UTF-8 date
  ven  5 aoû 2016 15:15:11 CEST

  $ LC_ALL=fr_FR.UTF-8 date '+%a %b %e %H:%M:%S %Z %Y'
  ven aoû  5 15:15:11 CEST 2016


OSX version 10.9.5 is similar to FreeBSD 10.3.


Fedora Linux 4.6.4-301.fc24.x86_64 does it right
for most (but not all) locales:

  $ LC_ALL=es_ES.UTF-8 date
  vie ago  5 15:10:40 CEST 2016

  $ LC_ALL=es_ES.UTF-8 date '+%a %b %e %H:%M:%S %Z %Y'
  vie ago  5 15:10:40 CEST 2016


Debian 8.0 / Linux 4.4.16-v7+ does it right
for the locales that I have tested (but possibly same as Fedora):

  $ LC_ALL=es_ES.UTF-8 date
  vie ago  5 15:25:49 CEST 2016

  $ LC_ALL=es_ES.UTF-8 date +%a %b %e %H:%M:%S %Z %Y
  vie ago  5 15:25:49 CEST 2016


=======================
<ref>[1]</ref>

http://pubs.opengroup.org/onlinepubs/9699919799/
  The Open Group Base Specifications Issue 7
  IEEE Std 1003.1, 2013 Edition

When no formatting operand is specified, the output in
the POSIX locale shall be equivalent to specifying:
  date "+%a %b %e %H:%M:%S %Z %Y"

%a Locale's abbreviated weekday name.
%b Locale's abbreviated month name.
%e Day of the month as a decimal number [1,31] in a
   two-digit field with leading <space> character fill.
%Z Timezone name, or no characters if no timezone is determinable.

=======================

Attached is the full report.
Comment 1 Andrey A. Chernov freebsd_committer freebsd_triage 2016-08-05 15:25:17 UTC
POSIX cares of its own locale (POSIX or C) only, all other locales are free to do anything.