Bug 234663

Summary: calendar(1): Parsing of MonSecond in January 2019 is wrong
Product: Base System Reporter: Katsuyuki Miyoshi <katsubsd>
Component: binAssignee: Oleksandr Tymoshenko <gonzo>
Status: Closed DUPLICATE    
Severity: Affects Only Me CC: gonzo
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch parsedaymonth() none

Description Katsuyuki Miyoshi 2019-01-06 14:21:09 UTC
====================================
% grep Adults /usr/share/calendar/calendar.holiday
01/MonSecond    Adults Day in Japan
====================================

"Adults Day in Japan" is the second Monday in January.

====================================
% calendar -A 30 -t 1.1.2019 -f /usr/share/calendar/calendar.holiday|grep Adults
Jan  7* Adults Day in Japan
====================================

This is incorrect.

====================================
% cal
    January 2019
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
====================================

The correct result is

"Jan 14* Adults Day in Japan".

It is correct to try it with "01/TueSecond  Test Day"

====================================
% calendar -A 30 -t 1.1.2019 -f TestDayfile
Jan  8* Test Day
====================================

Only Monday is wrong. And on February Thursday is wrong.
It seems that the day before the first day of the month is being counted in the first week.

Thanks.
Comment 1 Katsuyuki Miyoshi 2019-01-08 05:21:18 UTC
Created attachment 200902 [details]
patch parsedaymonth()

This is a simple fix.
Comment 2 Katsuyuki Miyoshi 2019-01-08 05:35:41 UTC
(In reply to Katsuyuki Miyoshi from comment #1)
Sorry, this is usr.bin/calendar/parsedata.c.
Comment 3 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2020-04-03 02:03:19 UTC
Hello,

thanks for reporting this issue. Fix has been committed as r359585. Closing it as a duplicate of the older bug #201062

*** This bug has been marked as a duplicate of bug 201062 ***