Discussion:
Strange problem with date(1) using the -d option calculating the wrong day of the week
Scott Burns
2014-06-25 20:00:06 UTC
Permalink
Having an odd problem on a new 6.1.4 machine with the date(1) command using
the "-d" parameter. It is resolving a +"%a" to the wrong day of the week on
one server but not the older 5.1.2 machine.

==============================================
NetBSD/amd64 - 5.1.2 - Old server
==============================================

% uname -a
NetBSD ncti106.ncti.com 5.1.2 NetBSD 5.1.2 (GENERIC) #0: Thu Feb 2 12:12:28
UTC
2012
***@b7.netbsd.org:/home/builds/ab/netbsd-5-1-2-RELEASE/amd64/201202021
012Z-obj/home/builds/ab/netbsd-5-1-2-RELEASE/src/sys/arch/amd64/compile/GENE
RIC
amd64

% ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 34 Nov 6 2010 /etc/localtime ->
/usr/share/zoneinfo/Canada/Eastern

% date
Wed Jun 25 15:48:02 EDT 2014

% date -d "07/01/2014" +"%a"

Tue <- Calculates the DOW as a Tuesday - ***CORRECT***

==============================================
NetBSD/amd64 - 6.1.4 - New install
==============================================
# uname -a
NetBSD ncti103.ncti.com 6.1.4 NetBSD 6.1.4 (GENERIC) amd64

# ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 34 May 16 12:23 /etc/localtime ->
/usr/share/zoneinfo/Canada/Eastern

# date
Wed Jun 25 15:48:27 EDT 2014

# date -d "07/01/2014" +"%a"
Mon - Calculates the DOW as a Monday - ***INCORRECT***

I have looked at Jan 7th 2014 and it is also a Tues so it is not a parameter
order of the date issue. Nothing obvious in query-pr.

Any thoughts?

Scott.
Christos Zoulas
2014-06-25 23:09:11 UTC
Permalink
Post by Scott Burns
Having an odd problem on a new 6.1.4 machine with the date(1) command using
the "-d" parameter. It is resolving a +"%a" to the wrong day of the week on
one server but not the older 5.1.2 machine.
==============================================
NetBSD/amd64 - 5.1.2 - Old server
==============================================
% uname -a
NetBSD ncti106.ncti.com 5.1.2 NetBSD 5.1.2 (GENERIC) #0: Thu Feb 2 12:12:28
UTC
2012
012Z-obj/home/builds/ab/netbsd-5-1-2-RELEASE/src/sys/arch/amd64/compile/GENE
RIC
amd64
% ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 34 Nov 6 2010 /etc/localtime ->
/usr/share/zoneinfo/Canada/Eastern
% date
Wed Jun 25 15:48:02 EDT 2014
% date -d "07/01/2014" +"%a"
Tue <- Calculates the DOW as a Tuesday - ***CORRECT***
==============================================
NetBSD/amd64 - 6.1.4 - New install
==============================================
# uname -a
NetBSD ncti103.ncti.com 6.1.4 NetBSD 6.1.4 (GENERIC) amd64
# ls -l /etc/localtime
lrwxr-xr-x 1 root wheel 34 May 16 12:23 /etc/localtime ->
/usr/share/zoneinfo/Canada/Eastern
# date
Wed Jun 25 15:48:27 EDT 2014
# date -d "07/01/2014" +"%a"
Mon - Calculates the DOW as a Monday - ***INCORRECT***
I have looked at Jan 7th 2014 and it is also a Tues so it is not a parameter
order of the date issue. Nothing obvious in query-pr.
Hmm, it is correct on current too. -6 is broken for some reason.
Please file a PR

christos
Christos Zoulas
2014-06-26 02:09:00 UTC
Permalink
Post by Christos Zoulas
Hmm, it is correct on current too. -6 is broken for some reason.
Please file a PR
This is a pullup of parsedate.y (libutil) that has been partially released to 6.
It should eventually be fixed completely on 6 (thanks to mlestlv for digging
this out)

christos

Continue reading on narkive:
Loading...