bin/183550: On FreeBSD 10 newsyslog -t don't always work
Henri Hennebert
hlh at restart.be
Fri Nov 1 10:50:02 UTC 2013
>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 at 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:
More information about the freebsd-bugs
mailing list