mirror of
https://codeberg.org/landley/toybox.git
synced 2026-01-26 14:13:25 +00:00
In commit 2c96060, the tests for getfattr and setfattr were updated to only query specific names and avoid any unexpected extended attributes. Reintroduce the generic tests by filtering out any attribute in the `security` namespace.
32 lines
979 B
Bash
32 lines
979 B
Bash
#!/bin/bash
|
|
|
|
[ -f testing.sh ] && . testing.sh
|
|
|
|
#testing "name" "command" "result" "infile" "stdin"
|
|
|
|
function clean()
|
|
{
|
|
# The filesystem may include some extended attributes by default (for
|
|
# instance, security.selinux). Skip them.
|
|
grep -v "security\."
|
|
}
|
|
|
|
mkdir attrs
|
|
touch attrs/file
|
|
setfattr -n user.empty attrs/file
|
|
setfattr -n user.data -v hello attrs/file
|
|
setfattr -n user.more -v world attrs/file
|
|
|
|
testing "" "getfattr attrs/file | clean" \
|
|
"# file: attrs/file\nuser.data\nuser.empty\nuser.more\n\n" "" ""
|
|
testing "-d" "getfattr -d attrs/file | clean" \
|
|
"# file: attrs/file\nuser.data=\"hello\"\nuser.empty\nuser.more=\"world\"\n\n" "" ""
|
|
testing "-n" "getfattr -n user.empty attrs/file" \
|
|
"# file: attrs/file\nuser.empty\n\n" "" ""
|
|
testing "-d -n" "getfattr -d -n user.data attrs/file" \
|
|
"# file: attrs/file\nuser.data=\"hello\"\n\n" "" ""
|
|
testing "--only-values -n" "getfattr --only-values -n user.data attrs/file" \
|
|
"hello" "" ""
|
|
|
|
rm -rf attrs
|