bin/179122: [patch] Fix bug with newsyslog -t

Mark Johnston markj at freebsd.org
Thu May 30 21:20:02 UTC 2013


The following reply was made to PR bin/179122; it has been noted by GNATS.

From: Mark Johnston <markj at freebsd.org>
To: Oliver Fromme <olli at secnetix.de>
Cc: bug-followup at 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;
 >  		}


More information about the freebsd-bugs mailing list