Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2013 10:42:43 GMT
From:      Henri Hennebert <hlh@restart.be>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/183550: On FreeBSD 10 newsyslog -t don't always work
Message-ID:  <201311011042.rA1AghlA040685@oldred.freebsd.org>
Resent-Message-ID: <201311011050.rA1Ao2Rt024073@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         183550
>Category:       bin
>Synopsis:       On FreeBSD 10 newsyslog -t don't always work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 01 10:50:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Henri Hennebert
>Release:        FreeBSD-10.0-BETA2
>Organization:
NA
>Environment:
FreeBSD meribel.restart.bel 10.0-BETA2 FreeBSD 10.0-BETA2 #0 r257323: Tue Oct 29 19:59:50 CET 2013     root@meribel.restart.bel:/usr/obj/usr/src/sys/MERIBEL  i386

>Description:
With `newsyslog -t \%Y-\%m-\%d_\%H:\%M' in /etc/crontab newsyslog, from time
to time, stop with error "Could not convert time string to time value".

As `man strptime' say:
                                                                                "If the format string does not contain enough conversion specifications to
completely specify the resulting struct tm, the unspecified members timeptr
are left untouched."

In the previous case the 'tm_sec' entry is untouch and trigger the problem.

If 'tm->tm_sec' is initialized to 0, the problem is solved.

PS                                                                                
Maybe 'tm_min' and even 'tm_hour' should be also initialized.

>How-To-Repeat:

>Fix:
Apply following patch.

Patch attached with submission follows:

--- newsyslog.c.orig	2013-10-15 10:10:39.027064717 +0200
+++ newsyslog.c	2013-10-26 18:50:35.233347913 +0200
@@ -1491,6 +1491,7 @@
 			    &dp->d_name[logfname_len]);
 		return (0);
 	}
+	tm->tm_sec = 0;
 	if ((s = strptime(&dp->d_name[logfname_len + 1],
 	    timefnamefmt, tm)) == NULL) {
 		/*


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311011042.rA1AghlA040685>