From owner-freebsd-bugs@FreeBSD.ORG Fri Nov 1 10:50:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7194D143 for ; Fri, 1 Nov 2013 10:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBB7215C for ; Fri, 1 Nov 2013 10:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA1Ao2vj024074 for ; Fri, 1 Nov 2013 10:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA1Ao2Rt024073; Fri, 1 Nov 2013 10:50:02 GMT (envelope-from gnats) Resent-Date: Fri, 1 Nov 2013 10:50:02 GMT Resent-Message-Id: <201311011050.rA1Ao2Rt024073@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Henri Hennebert Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7B515EB4 for ; Fri, 1 Nov 2013 10:42:44 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 692E5210D for ; Fri, 1 Nov 2013 10:42:44 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA1AghqL040686 for ; Fri, 1 Nov 2013 10:42:43 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA1AghlA040685; Fri, 1 Nov 2013 10:42:43 GMT (envelope-from nobody) Message-Id: <201311011042.rA1AghlA040685@oldred.freebsd.org> Date: Fri, 1 Nov 2013 10:42:43 GMT From: Henri Hennebert To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/183550: On FreeBSD 10 newsyslog -t don't always work X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2013 10:50:02 -0000 >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: