|
|
| version 1.1, 2007/11/21 05:13:52 | version 1.2, 2007/12/04 05:10:47 |
|---|---|
| Line 4 | Line 4 |
| $ touch f | $ touch f |
| $ setfattr -n user.test -v test f | $ setfattr -n user.test -v test f |
| $ ln -s f l | $ ln -s f l |
| $ setfattr -h -n trusted.test -v test l | |
| This case should be obvious: | This case should be obvious: |
| $ getfattr -d f | $ getfattr -m- -d f |
| > # file: f | > # file: f |
| > user.test="test" | > user.test="test" |
| > | > |
| If a symlink is explicitly specified on the command line, follow it | Without -h, we dereference symlinks: |
| (-H behavior): | $ getfattr -m- -d l |
| $ getfattr -d l | |
| > # file: l | > # file: l |
| > user.test="test" | > user.test="test" |
| > | > |
| Unless we are explicitly told not to dereference symlinks: | With -h, we do not dereference symlinks: |
| $ getfattr -hd l | $ getfattr -m- -hd l |
| > # file: l | |
| > trusted.test="test" | |
| > | |
| When walking a tree, it does not make sense to follow symlinks. We should | Do the same for symlinks we find in a directory hierarchy: |
| only see f's attributes here -- that's a bug: | $ getfattr -m- -Rd . |
| $ getfattr -Rd . | |
| > # file: f | > # file: f |
| > user.test="test" | > user.test="test" |
| > | > |
| > # file: l | |
| > user.test="test" | |
| > | |
| This case works as expected: | $ getfattr -m- -Rhd . |
| $ getfattr -Rhd . | |
| > # file: f | > # file: f |
| > user.test="test" | > user.test="test" |
| > | > |
| > # file: l | |
| > trusted.test="test" | |
| > | |
| In these two cases, getfattr should dereference the symlink passed on the | Make sure we follow symlinks on the command line only when we should: |
| command line, but not l. This doesn't work correctly, either; it's the same | |
| bug: | |
| $ ln -s . here | $ ln -s . here |
| $ getfattr -Rd here | $ getfattr -m- -Rd here |
| > # file: here/f | > # file: here/f |
| > user.test="test" | > user.test="test" |
| > | > |
| > # file: here/l | |
| > user.test="test" | |
| > | |
| $ getfattr -Rhd here | $ getfattr -m- -Rhd here |
| > # file: here/f | > # file: here/f |
| > user.test="test" | > 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 .. | $ cd .. |
| $ rm -rf d | $ rm -rf d |