From patchwork Tue Apr 12 20:51:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oskari Saarenmaa X-Patchwork-Id: 8822091 Return-Path: X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7FC169F36E for ; Wed, 13 Apr 2016 12:17:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D53B62034F for ; Wed, 13 Apr 2016 12:17:19 +0000 (UTC) Received: from emvm-gh1-uea09.nsa.gov (smtp.nsa.gov [8.44.101.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95070202FE for ; Wed, 13 Apr 2016 12:17:17 +0000 (UTC) X-TM-IMSS-Message-ID: <7e80f95400019e74@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1) id 7e80f95400019e74 ; Wed, 13 Apr 2016 08:15:19 -0400 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3DCEE2X027314; Wed, 13 Apr 2016 08:14:30 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u3CKpl5p185249 for ; Tue, 12 Apr 2016 16:51:47 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3CKplW4014628 for ; Tue, 12 Apr 2016 16:51:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1C2CwDaXg1X/+tDndVeJ4QtM4JytWeEExKIBAEBAQEBAWaFKQYBATg7NAUYRIgsry2FKAEEjWsGhiGIWH6CX4IrjkWJSI4DjxgCjydigTYMgig5MIhIgT0BAQE X-IPAS-Result: A1C2CwDaXg1X/+tDndVeJ4QtM4JytWeEExKIBAEBAQEBAWaFKQYBATg7NAUYRIgsry2FKAEEjWsGhiGIWH6CX4IrjkWJSI4DjxgCjydigTYMgig5MIhIgT0BAQE X-IronPort-AV: E=Sophos;i="5.24,476,1454994000"; d="scan'208";a="5374153" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 12 Apr 2016 16:51:45 -0400 X-TM-IMSS-Message-ID: <2f54dc4400017b33@nsa.gov> Received: from mail.taisia.fi (mail.taisia.fi [213.157.67.235]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 DHE-RSA-AES256-SHA (256/256)) id 2f54dc4400017b33 ; Tue, 12 Apr 2016 16:51:27 -0400 Received: by mail.taisia.fi (Postfix, from userid 1001) id 13BA2A457F; Tue, 12 Apr 2016 23:51:41 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=taisial1; t=1460494301; bh=KIUi0pthFskhJZZcLbJnF2g4HRVLaFhdwcQpAzM9DuI=; h=Date:From:To:Subject:From; b=KwrrjmT7BPBZGaWpYTUFkqJ2+jjaHbbl86pIclzquBwlRvJjPW0AU4990KXK4zA7I IdJD/2s3Wst74yMupr7TfhoDzg/9iawgH38LWivZm2dqY0AfAA0e2+ra+Mq6QrikEz HjrDi79CkCCuyvtEUq9DXrFWriyHSzQwEs9adc/U= Date: Tue, 12 Apr 2016 23:51:41 +0300 From: Oskari Saarenmaa To: selinux@tycho.nsa.gov Subject: [PATCH] fixfiles: make sure $LOGFILE starts with a slash Message-ID: <20160412205141.GA15479@saarenmaa.fi> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-MML: disable X-Mailman-Approved-At: Wed, 13 Apr 2016 08:14:13 -0400 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP `tty` may output a (localized) "not a tty" message to stdout and exit with a zero status in case ttyname(3) returns NULL but isatty(3) returns success. This happens at least when stdin is connected to a tty but we're inside a chroot with no access to the tty file. This results in an error: /usr/sbin/fixfiles: line 257: $LOGFILE: ambiguous redirect Handle `tty` results that don't start with a slash the same way as no tty errors: point $LOGFILE to /dev/null. Signed-off-by: Oskari Saarenmaa --- policycoreutils/scripts/fixfiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles index 5c29eb9..1c64191 100755 --- a/policycoreutils/scripts/fixfiles +++ b/policycoreutils/scripts/fixfiles @@ -120,7 +120,7 @@ FORCEFLAG="" DIRS="" RPMILES="" LOGFILE=`tty` -if [ $? != 0 ]; then +if [ $? != 0 -o ${LOGFILE:0:1} != "/" ]; then LOGFILE="/dev/null" fi LOGGER=/usr/sbin/logger