From owner-freebsd-bugs@FreeBSD.ORG Thu May 30 20:40:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 62CB0404 for ; Thu, 30 May 2013 20:40: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 2E8CD691 for ; Thu, 30 May 2013 20:40: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 r4UKe2Zs051197 for ; Thu, 30 May 2013 20:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r4UKe2jU051196; Thu, 30 May 2013 20:40:02 GMT (envelope-from gnats) Resent-Date: Thu, 30 May 2013 20:40:02 GMT Resent-Message-Id: <201305302040.r4UKe2jU051196@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, Oliver Fromme Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 32F062F6 for ; Thu, 30 May 2013 20:34:08 +0000 (UTC) (envelope-from olli@grabthar.secnetix.de) Received: from grabthar.secnetix.de (grabthar.secnetix.de [212.17.241.225]) by mx1.freebsd.org (Postfix) with ESMTP id BC280634 for ; Thu, 30 May 2013 20:34:07 +0000 (UTC) Received: from grabthar.secnetix.de (localhost [127.0.0.1]) by grabthar.secnetix.de (8.14.5/8.14.5) with ESMTP id r4UKY0BX028155; Thu, 30 May 2013 22:34:00 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by grabthar.secnetix.de (8.14.5/8.14.5/Submit) id r4UKY0Sk028154; Thu, 30 May 2013 22:34:00 +0200 (CEST) (envelope-from olli) Message-Id: <201305302034.r4UKY0Sk028154@grabthar.secnetix.de> Date: Thu, 30 May 2013 22:34:00 +0200 (CEST) From: Oliver Fromme To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/179122: [patch] Fix bug with newsyslog -t Cc: Oliver Fromme X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Oliver Fromme List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 20:40:02 -0000 >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 >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; } >Release-Note: >Audit-Trail: >Unformatted: