From owner-freebsd-bugs@FreeBSD.ORG Thu May 30 21:20:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 190D86D8 for ; Thu, 30 May 2013 21:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id E62659B9 for ; Thu, 30 May 2013 21:20:01 +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 r4ULK1Fw059480 for ; Thu, 30 May 2013 21:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r4ULK1Kg059479; Thu, 30 May 2013 21:20:01 GMT (envelope-from gnats) Date: Thu, 30 May 2013 21:20:01 GMT Message-Id: <201305302120.r4ULK1Kg059479@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Mark Johnston Subject: Re: bin/179122: [patch] Fix bug with newsyslog -t X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Mark Johnston List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 21:20:02 -0000 The following reply was made to PR bin/179122; it has been noted by GNATS. From: Mark Johnston To: Oliver Fromme Cc: bug-followup@freebsd.org Subject: Re: bin/179122: [patch] Fix bug with newsyslog -t Date: Thu, 30 May 2013 17:16:35 -0400 On Thu, May 30, 2013 at 10:34:00PM +0200, Oliver Fromme wrote: > > >Number: 179122 > >Category: bin > >Synopsis: [patch] Fix bug with newsyslog -t > >Confidential: no > >Severity: non-critical > >Priority: medium > >Responsible: freebsd-bugs > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Thu May 30 20:40:01 UTC 2013 > >Closed-Date: > >Last-Modified: > >Originator: Oliver Fromme > >Release: FreeBSD 9.1-STABLE-20130529 amd64 > >Organization: > secnetix GmbH & Co. KG > >Environment: > > The problem was found on stable/9 as of 2013-05-29, > but it probably also exists on head and stable/8. > > >Description: > > The latest commits to newsyslog.c seem to have introduced > a problem with the -t option: The wrong file name is used > with the fstatat() call when checking for the mtime. > This becomes especially apparent when thr -a option is > also used, because the file does not exist in the archive > directory, so newsyslog prints error messages. See below. > > >How-To-Repeat: > > Change the newsyslog entry in /etc/crontab to use both > -t and -a, for example: > > 0 * * * * root newsyslog -a OLD -t DEFAULT > > Soon you will get output like the following mailed to you > by cron: > > newsyslog: Cannot stat '/var/log/OLD/maillog': No such file or directory > newsyslog: Cannot stat '/var/log/OLD/messages': No such file or directory Hi Oliver, Thanks for reporting this. I've done some testing and the patch looks correct. Have you configured the log file in question to be rotated once every hour? If not, then newsyslog -t wouldn't have been working properly before either. Thanks, -Mark > > >Fix: > > --- usr.sbin/newsyslog/newsyslog.c.orig 2013-05-11 03:01:44.000000000 +0200 > +++ usr.sbin/newsyslog/newsyslog.c 2013-05-30 15:55:19.000000000 +0200 > @@ -2313,7 +2313,7 @@ > if (validate_old_timelog(dp, logfname, &tm) == 0) > continue; > > - if (fstatat(dir_fd, logfname, &sb, 0) == -1) { > + if (fstatat(dir_fd, dp->d_name, &sb, 0) == -1) { > warn("Cannot stat '%s'", file); > continue; > }