79 lines
4.0 KiB
Diff
79 lines
4.0 KiB
Diff
Subject: attr: Fix WALK_TREE_RECURSIVE for the WALK_TREE_DEREFERENCE case
|
|
|
|
NOTE: This fix was already added to the attr tree
|
|
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-cmds/attr/libmisc/walk_tree.c
|
|
|
|
[295] $ mkdir -p 1/sub -- ok
|
|
[296] $ mkdir 1/link -- ok
|
|
[297] $ touch 1/link/link-file -- ok
|
|
[298] $ touch 1/sub/sub-file -- ok
|
|
[299] $ ln -s `pwd`/1/link 1/sub/link -- ok
|
|
[300] $ setfattr -n "user.a" 1 -- ok
|
|
[301] $ setfattr -n "user.a" 1/link/link-file -- ok
|
|
[302] $ setfattr -n "user.a" 1/link -- ok
|
|
[303] $ setfattr -n "user.a" 1/sub/sub-file -- ok
|
|
[304] $ setfattr -n "user.a" 1/sub -- ok
|
|
[305] $ getfattr -P -R 1 -- failed
|
|
# file: 1 | # file: 1
|
|
user.a | user.a
|
|
|
|
|
# file: 1/sub | # file: 1/sub
|
|
user.a | user.a
|
|
|
|
|
# file: 1/sub/link | # file: 1/sub/link
|
|
user.a | user.a
|
|
|
|
|
# file: 1/sub/sub-file ? # file: 1/sub/link/link-file
|
|
user.a | user.a
|
|
|
|
|
# file: 1/link ? # file: 1/sub/sub-file
|
|
user.a | user.a
|
|
|
|
|
# file: 1/link/link-file ? # file: 1/link
|
|
user.a | user.a
|
|
|
|
|
~ ? # file: 1/link/link-file
|
|
~ ? user.a
|
|
~ ?
|
|
[324] $ getfattr -R -P 1/sub -- failed
|
|
# file: 1/sub | # file: 1/sub
|
|
user.a | user.a
|
|
|
|
|
# file: 1/sub/link | # file: 1/sub/link
|
|
user.a | user.a
|
|
|
|
|
# file: 1/sub/sub-file ? # file: 1/sub/link/link-file
|
|
user.a | user.a
|
|
|
|
|
~ ? # file: 1/sub/sub-file
|
|
~ ? user.a
|
|
~ ?
|
|
|
|
Signed-off-by: Brandon Philips <bphilips@suse.de>
|
|
|
|
---
|
|
libmisc/walk_tree.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
Index: attr-2.4.43/libmisc/walk_tree.c
|
|
===================================================================
|
|
--- attr-2.4.43.orig/libmisc/walk_tree.c
|
|
+++ attr-2.4.43/libmisc/walk_tree.c
|
|
@@ -93,8 +93,15 @@ static int walk_tree_rec(const char *pat
|
|
have_dir_stat = 1;
|
|
}
|
|
err = func(path, &st, flags, arg);
|
|
+
|
|
+ /*
|
|
+ * Recurse if WALK_TREE_RECURSIVE and the path is:
|
|
+ * a dir not from a symlink
|
|
+ * a link and follow_symlinks
|
|
+ */
|
|
if ((flags & WALK_TREE_RECURSIVE) &&
|
|
- (S_ISDIR(st.st_mode) || (S_ISLNK(st.st_mode) && follow_symlinks))) {
|
|
+ (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
|
|
+ ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
|
|
struct dirent *entry;
|
|
|
|
/*
|