NetBSD Problem Report #33994

From foo@porticoluna.org  Thu Jul 13 14:49:20 2006
Return-Path: <foo@porticoluna.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 32E8363B8C1
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Jul 2006 14:49:20 +0000 (UTC)
Message-Id: <20060713144250.BD5A3E59E@porticoluna.org>
Date: Thu, 13 Jul 2006 16:42:50 +0200 (CEST)
From: foo@porticoluna.org (User Foo)
Reply-To: foo@porticoluna.org
To: gnats-bugs@NetBSD.org
Subject: Implement a XXX comment in job.c

>Number:         33994
>Category:       bin
>Synopsis:       Implement a XXX comment in job.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 13 14:50:00 +0000 2006
>Closed-Date:    Tue Nov 27 20:24:58 +0000 2018
>Last-Modified:  Tue Nov 27 20:24:58 +0000 2018
>Originator:     foo@porticoluna.org (User Foo)
>Release:        NetBSD 3.99.21
>Organization:
	<organization of PR author (multiple lines)>
>Environment:
	<The following information is extracted from your kernel. Please>
	<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD pl2 3.99.21 NetBSD 3.99.21 (PL2) #2: Fri Jun 23 01:12:03 CEST 2006 pancake@pl2:/home/build/obj/sys/arch/i386/compile/PL2 i386
Architecture: i386
Machine: i386
>Description:
	<precise description of the problem (multiple lines)>
This patch allows to use 15m or 1h syntax for the CRON_WITHIN environment variable
handled by the cron(8) daemon.

>How-To-Repeat:
	<code/input/activities to reproduce the problem (multiple lines)>
>Fix:
	<how to correct or work around the problem, if known (multiple lines)>
TODO: manpage must be updated to sync this change.

Index: usr.sbin/cron/job.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cron/job.c,v
retrieving revision 1.6
diff -u -r1.6 job.c
--- usr.sbin/cron/job.c	16 Mar 2005 02:53:55 -0000	1.6
+++ usr.sbin/cron/job.c	13 Jul 2006 14:22:11 -0000
@@ -115,9 +115,16 @@
 	if (within == NULL)
 		return (1);

-	/* XXX handle 2m, 4h, etc? */
 	errno = 0;
 	delta = strtol(within, &t, 10);
+	switch(within[strlen(within)-1]) {
+	case 'm':
+		delta *= 60;
+		break;
+	case 'h':
+		delta *= 360;
+		break;
+	}
 	if (errno == ERANGE || *t != '\0' || delta <= 0)
 		return (1);


>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 27 Nov 2018 20:24:58 +0000
State-Changed-Why:
Patch needs to be done better. 6 minutes isn't an hour, accessing within[-1] for empty string is bad. - from xtos


>Unformatted:
 SEND-PR: -*- send-pr -*-
 SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
 SEND-PR: will all comments (text enclosed in `<' and `>').
 SEND-PR: 
 SEND-PR: Please consult the send-pr man page `send-pr(1)' or the Texinfo
 SEND-PR: manual if you are not sure how to fill out a problem report.
 SEND-PR:
 SEND-PR: NOTE: If you include a patch that corrects the problem, the
 SEND-PR: issue will probably be handled much more quickly.
 SEND-PR:
 SEND-PR: Choose from the following categories:
 SEND-PR:
 SEND-PR: bin               install           kern              
 SEND-PR: lib               misc              pkg               
 SEND-PR: port-acorn26      port-acorn32      port-algor        
 SEND-PR: port-alpha        port-amd64        port-amiga        
 SEND-PR: port-amigappc     port-arc          port-arm          
 SEND-PR: port-atari        port-bebox        port-cats         
 SEND-PR: port-cesfic       port-cobalt       port-dreamcast    
 SEND-PR: port-evbarm       port-evbmips      port-evbppc       
 SEND-PR: port-evbsh3       port-evbsh5       port-hp300        
 SEND-PR: port-hp700        port-hpcarm       port-hpcmips      
 SEND-PR: port-hpcsh        port-hppa         port-i386         
 SEND-PR: port-ia64         port-ibmnws       port-iyonix       
 SEND-PR: port-luna68k      port-m68k         port-mac68k       
 SEND-PR: port-macppc       port-mips         port-mipsco       
 SEND-PR: port-mmeye        port-mvme68k      port-mvmeppc      
 SEND-PR: port-netwinder    port-news68k      port-newsmips     
 SEND-PR: port-next68k      port-ofppc        port-pc532        
 SEND-PR: port-playstation2 port-pmax         port-pmppc        
 SEND-PR: port-powerpc      port-prep         port-sandpoint    
 SEND-PR: port-sbmips       port-sgimips      port-sh3          
 SEND-PR: port-sh5          port-shark        port-sparc        
 SEND-PR: port-sparc64      port-sun2         port-sun3         
 SEND-PR: port-vax          port-x68k         port-xen          
 SEND-PR: security          standards         toolchain         
 SEND-PR: xsrc              y2k               
 SEND-PR:
 To: gnats-bugs@gnats.NetBSD.org
 Subject: Support for 'm'inute and 'h'ours suffix for CRON_WITHIN
 From: pancake@phreaker.net
 Reply-To: pancake@phreaker.net
 X-send-pr-version: 3.95


 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.