diff options
author | Tim Shimmin <tes@sgi.com> | 2007-12-04 05:10:47 +0000 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2007-12-04 05:10:47 +0000 |
commit | 770365fc7cdee68d0f397b376d49970ff396a296 (patch) | |
tree | cdacc3bbbce7ca65eb2102f592b6dee325cf35a8 /test | |
parent | c329461afb4c9a95eca8f44cd1d87471e8213464 (diff) | |
download | attr-770365fc7cdee68d0f397b376d49970ff396a296.tar.gz |
Add some code to the tree walking to better handle file descriptors.
Merge of master-melb:xfs-cmds:30192a by kenmcd.
Diffstat (limited to 'test')
-rw-r--r-- | test/getfattr.test | 103 |
1 files changed, 87 insertions, 16 deletions
diff --git a/test/getfattr.test b/test/getfattr.test index 1e9366d..c9458e6 100644 --- a/test/getfattr.test +++ b/test/getfattr.test @@ -4,49 +4,120 @@ $ touch f $ setfattr -n user.test -v test f $ ln -s f l + $ setfattr -h -n trusted.test -v test l This case should be obvious: - $ getfattr -d f + $ getfattr -m- -d f > # file: f > user.test="test" > -If a symlink is explicitly specified on the command line, follow it -(-H behavior): - $ getfattr -d l +Without -h, we dereference symlinks: + $ getfattr -m- -d l > # file: l > user.test="test" > -Unless we are explicitly told not to dereference symlinks: - $ getfattr -hd l +With -h, we do not dereference symlinks: + $ getfattr -m- -hd l + > # file: l + > trusted.test="test" + > -When walking a tree, it does not make sense to follow symlinks. We should -only see f's attributes here -- that's a bug: - $ getfattr -Rd . +Do the same for symlinks we find in a directory hierarchy: + $ getfattr -m- -Rd . > # file: f > user.test="test" > + > # file: l + > user.test="test" + > -This case works as expected: - $ getfattr -Rhd . + $ getfattr -m- -Rhd . > # file: f > user.test="test" > + > # file: l + > trusted.test="test" + > -In these two cases, getfattr should dereference the symlink passed on the -command line, but not l. This doesn't work correctly, either; it's the same -bug: +Make sure we follow symlinks on the command line only when we should: $ ln -s . here - $ getfattr -Rd here + $ getfattr -m- -Rd here > # file: here/f > user.test="test" > + > # file: here/l + > user.test="test" + > - $ getfattr -Rhd here + $ getfattr -m- -Rhd here > # file: here/f > user.test="test" > + > # file: here/l + > trusted.test="test" + > + + $ getfattr -m- -RLhd here + > # file: here/f + > user.test="test" + > + > # file: here/l + > trusted.test="test" + > + + $ getfattr -m- -RPhd here + +Make sure we recurse into sub-directories: + $ mkdir sub + $ mv f l sub + $ getfattr -m- -Rd . + > # file: sub/f + > user.test="test" + > + > # file: sub/l + > user.test="test" + > + + $ getfattr -m- -Rhd . + > # file: sub/f + > user.test="test" + > + > # file: sub/l + > trusted.test="test" + > + +Make sure we follow symlinks to directories only when we should: + $ mkdir sub2 + $ ln -s ../sub sub2/to-sub + $ getfattr -m- -Rhd sub2 + + $ getfattr -m- -RLhd sub2 + > # file: sub2/to-sub/f + > user.test="test" + > + > # file: sub2/to-sub/l + > trusted.test="test" + > + + $ getfattr -m- -RPhd sub2 + +Symlink loop detection: + $ ln -s .. sub/up + $ getfattr -m- -RLhd . + > # file: sub2/to-sub/f + > user.test="test" + > + > # file: sub2/to-sub/l + > trusted.test="test" + > + > # file: sub/f + > user.test="test" + > + > # file: sub/l + > trusted.test="test" + > $ cd .. $ rm -rf d |