Bug 679668

Summary: batch jobs and "at now" jobs will be executed next day
Product: [openSUSE] openSUSE 11.4 Reporter: Björn Voigt <bjoernv>
Component: OtherAssignee: E-mail List <bnc-team-screening>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: meissner
Version: Final   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Björn Voigt 2011-03-15 08:37:16 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.17) Gecko/20110121 SUSE/2.0.12-0.3.1 SeaMonkey/2.0.12

The at command in openSUSE 11.4 introduced the following patch:

* Di Feb 01 2011 vcizek@novell.com
- at now shifts jobs with passed time without a date to tomorrow
  (bnc#668485)

I am not allowed to access bnc#668485. But the patch affects batch jobs and at jobs with the time spec "now". Normally "at now" jobs will be executed immediately. Batch jobs should be executed immediately, if the system load is low enough.

The patch seems to calculate the time spec "now" wrong. Probably the "now"-calculation ignores the seconds. Because of the wrong calculation, "at" thinks that "now" is in past and shifts the job to next day (tomorrow). 

Reproducible: Always

Steps to Reproduce:
1. Lookup the current date and time with "date"

   $ date
   Tue Mar 15 09:29:59 CET 2011

2. Create a "at now" job

   $ at now
   warning: commands will be executed using /bin/sh
   at> echo "at job executed"
   at> <EOT>
   job 5 at 2011-03-16 09:30

3. See the execution time or wait until next day
Actual Results:  
The job will be executed next day (tomorrow).

Expected Results:  
The job should be executed immediately.

The at implementation of at-3.1.12 works correctly. The function parsetime from at-3.1.12 may help to find a correct patch. Unfortunately at-3.1.12 contains multiple changes in parsetime and timespec compared with at-3.1.8.
Comment 1 Björn Voigt 2011-03-15 08:45:41 UTC
Here is a temporary work-around for "at now".

Instead of "at now", you can create a job one minute later with time spec "now + 1 minute":

$ date; at now + 1 minute
Tue Mar 15 09:44:27 CET 2011
warning: commands will be executed using /bin/sh
at> date
at> <EOT>
job 8 at 2011-03-15 09:45
Comment 2 Marcus Meissner 2011-03-15 12:57:50 UTC
Is this a dup of bug 672586?

For this an update is already in the queue.
Comment 3 Björn Voigt 2011-03-15 13:05:02 UTC
I would not say, that this bug is a duplicate of bug 672586.

There are different test cases and results. 

Maybe the fix for bug 672586 also solves this bug. Can I download and test the fixed at package?
Comment 4 Marcus Meissner 2011-03-15 14:40:50 UTC
http://download.opensuse.org/update/11.4-test/rpm/   ...
Comment 5 Björn Voigt 2011-03-16 18:44:55 UTC
The fix for bug 672586 also fixes this bug.

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