Description of problem: at, when scheduling a job by day-of-week or number-of-days that should run in the coming year, actually schedules it in the year after. Version-Release number of selected component (if applicable): at-3.1.10-26.fc10 How reproducible: every time Steps to Reproduce: 1. date Tue Dec 30 10:13:05 PST 2008 2. at -f atjob 1pm friday or 3. at -f atjob 1pm +3 days Actual results: job n at 2010-01-02 13:00 Expected results: job n at 2009-01-02 13:00 Additional info: at correctly schedules jobs that use the day-of-month to specify the day.
Can't reproduce here. at-3.1.10-26.fc10.i386 $ date Fri Feb 27 00:01:25 EST 2009 $ at -f foo 1pm +3 days job 4 at 2009-03-02 13:00 $ at -f foo 1pm +400 days job 5 at 2010-04-03 13:00 $ atq 5 2010-04-03 13:00 a lex 4 2009-03-02 13:00 a lex Ali, can you still reproduce this? If so, can you provide a better testcase?
It looks like the bug only occurs in the period between the first day of the coming year and a year from today: # date Thu Feb 26 11:52:44 PST 2009 # at -f foo 1pm +308 days job 15 at 2009-12-31 13:00 # at -f foo 1pm +309 days job 16 at 2011-01-01 13:00 # at -f foo 1pm +365 days job 17 at 2010-02-26 13:00 # at -f foo 1pm +364 days job 18 at 2011-02-25 13:00 # atq 16 2011-01-01 13:00 a root 15 2009-12-31 13:00 a root 18 2011-02-25 13:00 a root 17 2010-02-26 13:00 a root
Wow! reproduced Fedora 10. $ date Fri Feb 27 09:49:34 EST 2009 $ at -f foo 1pm +307 days job 16 at 2009-12-31 13:00 $ at -f foo 1pm +308 days job 17 at 2011-01-01 13:00
Created attachment 334353 [details] Patch to add 'yearspec = 1;' in several places, for the end-of-year bug First a declaimer: I don't know yacc, and am not really sure exactly how parsetime.y is working. But I noticed that 'at now +301' worked correctly, while 'at today', 'tomorrow', 'noon', '1pm', etc failed. So I poked around in the code and found that 'NOW' was setting yearspec = 1, while the other tokens weren't. When I added yearspec = 1 to other places in the file, it seemed to work better. Now I have no idea what this patch might break. I tried to run 'make test' before I made any changes, but it complained about the panic() in parsetime.y and aborted. (And even after I commented panic() out, nearly half of its tests still failed.) So I couldn't do any regression tests.
OK, I found at least one thing that the patch broke: > at -f ~/foo noon 1 Jan at: refusing to create job destined in the past
Forget the patch. The problem isn't that yearspec isn't being set correctly. The problem is that exectm.tm_year is being incremented twice. I added some debug statements to parsetime(): exectm = *localtime(&currtime); ... yearspec = 0; fprintf(stderr,"after localtime, tm_year is %d\n", exectm.tm_year); if (yyparse() == 0) { fprintf(stderr,"after yyparse, tm_year is %d\n", exectm.tm_year); if (time_only) { if ((exectm.tm_hour < currtm.tm_hour) || ((exectm.tm_hour == currtm.tm_hour && exectm.tm_min <= currtm.tm_min))) exectm.tm_mday++; } else if (!yearspec) { fprintf(stderr,"before year++, year is %d\n", exectm.tm_year); if ((exectm.tm_mon < currtm.tm_mon) || ((exectm.tm_mon == currtm.tm_mon && exectm.tm_mday < currtm.tm_mday))) exectm.tm_year++; fprintf(stderr,"after year++, year is %d\n", exectm.tm_year); } > at -f ~/foo noon +301 days after localtime, tm_year is 109 after yyparse, tm_year is 110 before year++, year is 110 after year++, year is 111 job 96 at 2011-01-01 12:00 So it's getting incremented once somewhere in yyparse(), and then again in the 'if (!yearspec)' paragraph. I haven't a clue where in the yacc code it's getting incremented.
Yes, that's the same problem as I have ;-) I can't track down the problem in yacc. I plan go through whole yacc and fix all reported problems, but not now. I won't break with changes in grammar things which were working.
This issue is also tracked in the Debian BTS [1] and will be fixed in at/3.1.12 [2]. There is also a similar bug when using "at 23.55 + 7 minutes", which is also fixed [3]. [1] http://bugs.debian.org/404965 [2] http://git.debian.org/?p=collab-maint/at.git;a=commit;h=2160392be1716fc9895f09e3fd1ce148ec0325c9 [3] http://git.debian.org/?p=collab-maint/at.git;a=commit;h=2fe813274cc6bb9f98f85e5c8d0763ab8a7fa34d
Thank you for a fix. I'm closing as upstream.
This message is a reminder that Fedora 10 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 10. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '10'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 10's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 10 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping