1 commit d539830d19b35df0c12c0b7d36c1f6c428f34a91
2 Author: M. Steinborn <gnugv_maintainer@yahoo.de>
3 Date: Fri Jan 22 14:37:04 2010 -0800
5 setfacl: make sure that -R only calls stat(2) on symlinks when it needs to
7 Fixes http://savannah.nongnu.org/bugs/?28131
9 Signed-off-by: Brandon Philips <bphilips@suse.de>
11 diff --git a/setfacl/setfacl.c b/setfacl/setfacl.c
12 index 802f060..731e417 100644
13 --- a/setfacl/setfacl.c
14 +++ b/setfacl/setfacl.c
15 @@ -76,7 +76,7 @@ struct option long_options[] = {
17 const char *cmd_line_options, *cmd_line_spec;
19 -int walk_flags = WALK_TREE_DEREFERENCE;
20 +int walk_flags = WALK_TREE_DEREFERENCE_TOPLEVEL;
21 int opt_recalculate; /* recalculate mask entry (0=default, 1=yes, -1=no) */
22 int opt_promote; /* promote access ACL to default ACL */
23 int opt_test; /* do not write to the file system.
24 @@ -590,13 +590,15 @@ int main(int argc, char *argv[])
27 case 'L': /* follow symlinks */
28 - walk_flags |= WALK_TREE_LOGICAL;
29 + walk_flags |= WALK_TREE_LOGICAL | WALK_TREE_DEREFERENCE;
30 walk_flags &= ~WALK_TREE_PHYSICAL;
33 case 'P': /* do not follow symlinks */
34 walk_flags |= WALK_TREE_PHYSICAL;
35 - walk_flags &= ~WALK_TREE_LOGICAL;
36 + walk_flags |= WALK_TREE_PHYSICAL;
37 + walk_flags &= ~(WALK_TREE_LOGICAL | WALK_TREE_DEREFERENCE |
38 + WALK_TREE_DEREFERENCE_TOPLEVEL);
41 case 't': /* test mode */
42 diff --git a/test/misc.test b/test/misc.test
43 index 7c62c64..d5d7680 100644
46 @@ -424,3 +424,31 @@ Now, chmod should change the group_obj entry
51 +Dangling symlink test http://savannah.nongnu.org/bugs/?28131
63 + $ setfacl -R -m u:bin:rw d
65 + > getfacl: d/b: No such file or directory
75 + $ setfacl -RL -m u:bin:rw d
76 + > setfacl: d/b: No such file or directory