RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1714077 - getfacl follows symlinks, even without -L
Summary: getfacl follows symlinks, even without -L
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: acl
Version: 7.6
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-27 04:36 UTC by Kenneth D'souza
Modified: 2020-03-31 19:40 UTC (History)
2 users (show)

Fixed In Version: acl-2.2.51-15.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:40:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1023 0 None None None 2020-03-31 19:40:22 UTC

Description Kenneth D'souza 2019-05-27 04:36:24 UTC
Description of problem:
getfacl follows symlinks, even without -L

Version-Release number of selected component (if applicable):

# rpm -qa | grep -w acl
acl-2.2.51-14.el7.x86_64


How reproducible:
Always

Steps to Reproduce:

Make sure /bin is symlink to /usr/bin

1. # ls -l /bin
lrwxrwxrwx. 1 root root 7 May 24 04:05 /bin -> usr/bin

2. getfacl /bin | grep -w file  | less
# file: bin
# file: bin/grotty
# file: bin/catchsegv
# file: bin/gencat
# file: bin/getent
# file: bin/wall
# file: bin/iconv
# file: bin/nl-route-add


Actual results:
Lists acl of /bin and others by following symlinks

Expected results:

To list acl of only /bin

# getfacl /bin
getfacl: Removing leading '/' from absolute path names
# file: bin/
# owner: root
# group: root
user::r-x
group::r-x
other::r-x


Additional info:
Need to back port the below upstream patch:

http://git.savannah.gnu.org/cgit/acl.git/commit/?id=63451a0

# git show 63451a06b7484d220750ed8574d3ee84e156daf5 
commit 63451a06b7484d220750ed8574d3ee84e156daf5
Author: Andreas Gruenbacher <agruen>
Date:   Tue Jun 23 00:29:45 2009 +0200

    Make sure that getfacl -R only calls stat(2) on symlinks when it needs to
    
    This fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790
    "getfacl follows symlinks, even without -L".

diff --git a/doc/CHANGES b/doc/CHANGES
index 327a19b..c5ff1a8 100644
--- a/doc/CHANGES
+++ b/doc/CHANGES
@@ -1,3 +1,6 @@
+* Make sure that getfacl -R only calls stat(2) on symlinks when it needs to.
+  This fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790 "getfacl follows
+  symlinks, even without -L".
 * Stop quoting nonprintable characters in the getfacl output: what is printable
   or not depends on the locale settings, and getfacl often gets it wrong. We
   still need to quote a few special characters like newlines so that setfacl
diff --git a/getfacl/getfacl.c b/getfacl/getfacl.c
index fc650e3..b3e6200 100644
--- a/getfacl/getfacl.c
+++ b/getfacl/getfacl.c
@@ -70,7 +70,7 @@ struct option long_options[] = {
 const char *progname;
 const char *cmd_line_options;
 
-int walk_flags = WALK_TREE_DEREFERENCE;
+int walk_flags = WALK_TREE_DEREFERENCE_TOPLEVEL;
 int opt_print_acl;
 int opt_print_default_acl;
 int opt_strip_leading_slash = 1;
@@ -642,7 +642,7 @@ int main(int argc, char *argv[])
                        case 'L':  /* follow all symlinks */
                                if (posixly_correct)
                                        goto synopsis;
-                               walk_flags |= WALK_TREE_LOGICAL;
+                               walk_flags |= WALK_TREE_LOGICAL | WALK_TREE_DEREFERENCE;
                                walk_flags &= ~WALK_TREE_PHYSICAL;
                                break;
 
@@ -650,7 +650,8 @@ int main(int argc, char *argv[])
                                if (posixly_correct)
                                        goto synopsis;
                                walk_flags |= WALK_TREE_PHYSICAL;
-                               walk_flags &= ~WALK_TREE_LOGICAL;
+                               walk_flags &= ~(WALK_TREE_LOGICAL | WALK_TREE_DEREFERENCE |
+                                               WALK_TREE_DEREFERENCE_TOPLEVEL);
                                break;
 
                        case 's':  /* skip files with only base entries */

Comment 2 Kenneth D'souza 2019-05-27 05:20:37 UTC
The below mentioned match is already backported.

Make sure that getfacl -R only calls stat(2) on symlinks when it needs to
Checking further...

Comment 3 Kamil Dudka 2019-05-27 08:13:47 UTC
Thanks for the report!  It seems to be fixed by the following upstream commit:

http://git.savannah.nongnu.org/cgit/acl.git/commit/?id=3d80b8fa

Comment 4 Kenneth D'souza 2019-05-27 08:20:50 UTC
Thanks for finding it.
Yes, indeed! Tested the fix on acl-2.2.51 (Branch rhel-7.7)

./getfacl/getfacl /bin
lt-getfacl: Removing leading '/' from absolute path names
# file: bin
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

Comment 13 errata-xmlrpc 2020-03-31 19:40:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1023


Note You need to log in before you can comment on or make changes to this bug.