From owner-freebsd-bugs@FreeBSD.ORG Wed Aug 18 19:00:16 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB4EA1065714 for ; Wed, 18 Aug 2010 19:00:16 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7788FC1A for ; Wed, 18 Aug 2010 19:00:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7IJ063m023697 for ; Wed, 18 Aug 2010 19:00:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o7IJ065R023691; Wed, 18 Aug 2010 19:00:06 GMT (envelope-from gnats) Resent-Date: Wed, 18 Aug 2010 19:00:06 GMT Resent-Message-Id: <201008181900.o7IJ065R023691@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, Ævar Arnfjörð Bjarmason Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CFED106566B for ; Wed, 18 Aug 2010 18:52:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 2CC9D8FC1B for ; Wed, 18 Aug 2010 18:52:12 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o7IIqBgi096421 for ; Wed, 18 Aug 2010 18:52:11 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o7IIqB1u096404; Wed, 18 Aug 2010 18:52:11 GMT (envelope-from nobody) Message-Id: <201008181852.o7IIqB1u096404@www.freebsd.org> Date: Wed, 18 Aug 2010 18:52:11 GMT From: Ævar Arnfjörð Bjarmason To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/149780: setfacl doesn't return non-zero on error X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2010 19:00:17 -0000 >Number: 149780 >Category: bin >Synopsis: setfacl doesn't return non-zero on error >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Aug 18 19:00:05 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Ævar Arnfjörð Bjarmason >Release: 8.1-STABLE >Organization: MagNet Inc. >Environment: FreeBSD eschaton.local 8.1-STABLE FreeBSD 8.1-STABLE #0: Wed Aug 4 09:11:13 EDT 2010 root@eschaton.local:/usr/src/sys/amd64/compile/ESCHATON amd64 >Description: setfacl doesn't return non-zero when it encounters an error in all cases. >How-To-Repeat: $ setfacl -m u:root:rwx . ; echo $? setfacl: .: acl_get_file() failed: Operation not supported 0 >Fix: See the attached one-line patch to setfacl.c. There are also more potential problems of this type in the source, e.g. setfacl won't return an error if a stat() call fails. Patch attached with submission follows: >From acfdd206be4b2b2966eb55352ece421e86e75bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 18 Aug 2010 14:40:34 -0400 Subject: [PATCH] setfacl: don't return 0 on error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setfacl documentation states: The setfacl utility exits 0 on success, and >0 if an error occurs. Which is contradicted in this case: $ setfacl -m u:root:rwx . ; echo $? setfacl: .: acl_get_file() failed: Operation not supported 0 But on Linux: $ setfacl -m u:root:rwx . ; echo $? setfacl: .: Operation not supported 1 Signed-off-by: Ævar Arnfjörð Bjarmason --- setfacl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/setfacl.c b/setfacl.c index 5552ff1..e254e75 100644 --- a/setfacl.c +++ b/setfacl.c @@ -234,6 +234,7 @@ main(int argc, char *argv[]) else acl = acl_get_file(file->filename, acl_type); if (acl == NULL) { + carried_error++; if (h_flag) warn("%s: acl_get_link_np() failed", file->filename); -- 1.7.2.1 >Release-Note: >Audit-Trail: >Unformatted: