Created attachment 673229 [details] fix for "calendar-1.25-linux.patch" Description of problem: Sometimes calendar outputs a previous entry with today's date. I've noticed this for a while when run out of crontab; I'll get notification of yesterday's entry with today's date. For example, if there are two entries in .calendar: Jan 3 Today is Thursday January 3 Jan 4 Today is Friday January 4 Run calendar on Friday Jan 4, and the output will be: Jan 4 Today is Thursday January 3 Jan 4 Today is Friday January 4 The first entry is erroneous; the date is wrong. Version-Release number of selected component (if applicable): calendar-1.25-7.el6.x86_64 How reproducible: Upon further debugging with the source from the SRPM and gdb, I managed to reproduce this easily. It turns out the bug triggers any time calendar is executing the documented behaviour "On Fridays, events on Friday through Monday are displayed." Steps to Reproduce: 1. Create a calendar file ("~/testcal") with the entries: Jan 3 Test for Jan 3 Thu Jan 4 Test for Jan 4 Fri Jan 5 Test for Jan 5 Sat Jan 6 Test for Jan 6 Sun Jan 7 Test for Jan 7 Mon Jan 8 Test for Jan 8 Tue 2. Run calendar using the "test date" mode with different values for -t: $ calendar -f ~/testcal -t 20130103 Should display Jan 3 and Jan 4 $ calendar -f ~/testcal -t 20130104 Should display Jan 4 through to Jan 7 (Because Jan 4 is a Friday) Actual results: $ calendar -f ~/testcal -t 20130104 Jan 04 Test for Jan 3 Thu Jan 04 Test for Jan 4 Fri Jan 05 Test for Jan 5 Sat Jan 06 Test for Jan 6 Sun Jan 07 Test for Jan 7 Mon Notice how the first entry is "Jan 04 Test for Jan 3 Thu" ? Expected results: $ ./calendar -f ~/testcal -t 20130104 Jan 04 Test for Jan 4 Fri Jan 05 Test for Jan 5 Sat Jan 06 Test for Jan 6 Sun Jan 07 Test for Jan 7 Mon Additional info: Code inspection of the source indicates that this is a bug in the EPEL patches to the upstream source. Specifically, the file "calendar-1.25-linux.patch" contains the following change: --- calendar-1.25/day.c.orig 2008-04-12 14:22:17.000000000 -1000 +++ calendar-1.25/day.c 2009-02-12 15:41:08.000000000 -1000 @@ -301,7 +300,8 @@ isnow(char *endp, int bodun) /* adjust bodun rate */ if (bodun && !bodun_always) - bodun = !arc4random_uniform(3); + srandom(3); + bodun = random(); /* Easter or Easter depending days */ if (flags & F_SPECIAL) The fault is obvious; the new line "bodun = random();" is unconditionally executed! Wrapping those two new lines in their own block scope solves the problem. I've attached a patch to apply after "calendar-1.25-linux.patch" but the former could just be incorporated into the latter.
Wow, that's embarrassing. Thanks for the patch. I've submitted a new build with the change. Once it's done, I'll file a testing update for EPEL EL6. I also checked the Fedora branches that are still supported and the braces are present on the block. If you are the same Luke Mewburn that gave us lukemftp (or is tnftp), thanks. It's my preferred FTP client. I never have gotten around to adding a package for it to Fedora or EPEL, but one day.
calendar-1.25-8.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/calendar-1.25-8.el6
David: Yes, I'm the maintainer of tnftp (nee lukemftp). I'd use an EPEL package if you added one!
Package calendar-1.25-8.el6: * should fix your issue, * was pushed to the Fedora EPEL 6 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=epel-testing calendar-1.25-8.el6' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-EPEL-2013-0214/calendar-1.25-8.el6 then log in and leave karma (feedback).
calendar-1.25-8.el6 fixes the bug. I've left a comment on the link in comment 4.
Update has cooked for 14 days in testing, so it's clear for the stable updates collection now. I've pushed it to stable as it looks like both you and I have confirmed it works. Now on to tnftp...where is the best place to fetch upstream code for that? I use the code I find here: ftp://ftp.netbsd.org/pub/NetBSD/misc/tnftp/ If there is a better location, let me know. Otherwise I'll start putting together a tnftp package for Fedora and EPEL. If you want to continue this discussion outside of Bugzilla, that's fine (and preferred). Just use my work email address: dcantrell
calendar-1.25-8.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.