NetBSD Problem Report #41762
From www@NetBSD.org Tue Jul 21 19:11:33 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 52ACD63BBD1
for <gnats-bugs@gnats.netbsd.org>; Tue, 21 Jul 2009 19:11:33 +0000 (UTC)
Message-Id: <20090721191133.26D0563B898@www.NetBSD.org>
Date: Tue, 21 Jul 2009 19:11:33 +0000 (UTC)
From: ekamperi@gmail.com
Reply-To: ekamperi@gmail.com
To: gnats-bugs@NetBSD.org
Subject: at(1) fails to submit job if time has passed
X-Send-Pr-Version: www-1.0
>Number: 41762
>Category: bin
>Synopsis: at(1) fails to submit job if time has passed
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 21 19:15:00 +0000 2009
>Last-Modified: Fri Feb 19 23:45:01 +0000 2010
>Originator: Stathis Kamperis
>Release: NetBSD 5.0_STABLE
>Organization:
Aristotle University of Thessaloniki
>Environment:
NetBSD voyager 5.0_STABLE NetBSD 5.0_STABLE (MYGENERIC) #8: Mon Jul 6 19:55:40 EEST 2009 root@voyager:/usr/obj/sys/arch/i386/compile/MYGENERIC i386
>Description:
Quoting from Issue 7:
If no date is given, today shall be assumed if the given time is greater than the current time, and tomorrow shall be assumed if it is less. If the given month is less than the current month (and no year is given), next year shall be assumed.
http://www.opengroup.org/onlinepubs/9699919799/utilities/at.html
But...
[stathis@voyager ~] date
Tue Jul 21 22:05:19 EEST 2009
[stathis@voyager ~] at 22:00
at: Trying to travel back in time <--- this should never happen; at(1) should submit job for tomorrow
[stathis@voyager ~] at 21:00
clear
Job 51 will be executed using /bin/sh
[stathis@voyager ~] at -l
Date Owner Queue Job
21:00:00 07/22/09 stathis c 51 <--- with 21:00 it got it right, look at 22/
[stathis@voyager ~]
>How-To-Repeat:
>Fix:
>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/41762: at(1) fails to submit job if time has passed
Date: Thu, 23 Jul 2009 23:12:07 +0700
While I certainly expect that the result you show is most likely
due to a bug in the code, I always regarded it as a feature, not
a bug.
That is, if at 22:05 I do "at 22:00" there's a fairly good chance that
I didn't realise that 22:00 had just passed, and intended for the job
to run today (quite soon), rather than tomorrow (almost 24 hours away).
If I really intended tomorrow, I just say "at 22:00 tomorrow" and it
works like it should (whether the current time is just before, or
just after 22:00, or anything else.)
On the other hand, if I ask for a time that's much earlier than the current
clock time, then it's much more likely that I intended "tomorrow" and having
it default that way makes sense.
What all this means is that I'd kind of prefer it if this bug was not fixed.
kre
From: Stathis Kamperis <ekamperi@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/41762
Date: Thu, 23 Jul 2009 19:26:58 +0300
Salute!
I don't mind if it stays as it is, provided that other people like
better the current status quo.
But if we decide to do so, the man page should be adjusted to describe
the deviation from standard.
Best regards,
Stathis
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/41762
Date: Fri, 24 Jul 2009 00:41:47 +0700
Date: Thu, 23 Jul 2009 16:30:06 +0000 (UTC)
From: Stathis Kamperis <ekamperi@gmail.com>
Message-ID: <20090723163006.2CCFB63B913@www.NetBSD.org>
| But if we decide to do so, the man page should be adjusted to describe
| the deviation from standard.
Certainly. Perhaps an update like the following?
kre
--- at.1 2009-07-23 23:47:21.000000000 +0700
+++ at.1.new 2009-07-23 23:57:21.000000000 +0700
@@ -72,7 +72,11 @@
or
.Ar HH:MM
to run a job at a specific time of day.
-(If that time is already past, the next day is assumed.)
+(If that time is already well past, the next day is assumed.
+If the time is in the recent past, an error is generated instead
+to protect against accidental timing errors.
+To specify the next day, append
+.Sq tomorrow . )
You may also specify
.Sq midnight ,
.Sq noon ,
From: Christopher Berardi <cberardi@natoufa.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/41762
Date: Fri, 19 Feb 2010 18:40:23 -0500
Here is a patch that will make this update the time to the next day if it has past the time.
--- parsetime.c.orig 2010-02-19 18:33:57.000000000 -0500
+++ parsetime.c 2010-02-19 18:33:19.000000000 -0500
@@ -405,7 +405,8 @@
* if we've gone past that time - but if we're specifying a time plus
* a relative offset, it's okay to bump things
*/
- if ((sc_tokid == TOKEOF || sc_tokid == PLUS) && tm->tm_hour > hour) {
+ if ((sc_tokid == TOKEOF || sc_tokid == PLUS) && (tm->tm_hour > hour) ||
+ (tm->tm_hour == hour && tm->tm_min >= minute)) {
tm->tm_mday++;
tm->tm_wday++;
}
--
Christopher Berardi
http://www.natoufa.com/
Be still, and know that I am God (Psalms 46:10)
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.