Bug in GNU Date 2.0.11

Anthony Valentine <[email protected]>
Newsgroups gmane.comp.gnu.sh-utils.bugs
Message-ID <[email protected]>
Hello. 

It looks like I have found a bug in GNU date 2.0.11 (which appears to be
the latest version). 

[root@mis3 /home/amv]# date --version 
date (GNU sh-utils) 2.0.11 


The bug occurs with the '-d' switch when asked for the 'last
[weekday]'.  I have played with it a bit and it seems to only happen
during this week (week of 4/7/02).  

Here are some examples:
[root@mis3 /home/amv]# date
Sun Apr  7 07:57:31 AKDT 2002

[root@mis3 ~]$ date -d 'last friday' +%A 
Thursday 
[root@mis3 ~]$ date -d 'last thursday' +%A 
Wednesday 
[root@mis3 ~]$ date -d 'last wednesday' +%A 
Tuesday 

[root@mis3 /home/amv]# date -s "Sun Apr  9 07:57:31 2002" 
Tue Apr  9 07:57:31 AKDT 2002 
[root@mis3 /home/amv]# date -d 'last friday' +%A 
Thursday 
[root@mis3 /home/amv]# date -d 'last thursday' +%A 
Wednesday 
[root@mis3 /home/amv]# date -d 'last wednesday' +%A 
Tuesday 

[root@mis3 /home/amv]# date -s "Tue Apr 10 07:57:31 2002" 
Wed Apr 10 07:57:31 AKDT 2002 
[root@mis3 /home/amv]# date -d 'last friday' +%A 
Thursday 

[root@mis3 /home/amv]# date -s "Sat Apr 13 07:57:31 2002" 
Sat Apr 13 07:57:31 AKDT 2002 
[root@mis3 /home/amv]# date -d 'last friday' +%A 
Friday 

[root@mis3 /home/amv]# date -s "Sat Apr 01 07:57:31 2002" 
Sat Apr 13 07:57:31 AKDT 2002 
[root@mis3 /home/amv]# date -d 'last friday' +%A 
Friday

So, if I change the date outside of this week, it works, otherwise it
reports the day before the correct day.

I can reproduce the problem on a GNU/Linux system (RedHat 7.2) and an
AIX system.

Hopefully I have given you enough info, but if not, please do not
hesitate to contact me.  I can be reached at [email protected]

Thanks!

Anthony Valentine
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.