bin/149780: setfacl doesn't return non-zero on error
Ævar Arnfjörð Bjarmason
avarab at gmail.com
Wed Aug 18 19:00:17 UTC 2010
>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 at 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?= <avarab at gmail.com>
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 <avarab at gmail.com>
---
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:
More information about the freebsd-bugs
mailing list