tests,debugfs: ea_set's "-f <value_file" needs to be before the other args

For systems that don't use GNU's getopt(3), options have to be before
all non-option arguments.  So change the usage message for debugfs's
ea_set command, and then fix the d_xattr_sorting test.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian
Theodore Ts'o 2016-06-06 16:49:37 -04:00
parent 7618802123
commit be05f60ecf
3 changed files with 10 additions and 11 deletions

View File

@ -196,15 +196,14 @@ void do_set_xattr(int argc, char **argv)
} }
break; break;
default: default:
printf("%s: Usage: %s <file> <attr> [-f infile | " goto print_usage;
"value]\n", argv[0], argv[0]);
goto out2;
} }
} }
if (!(fp && optind == argc - 2) && !(!fp && optind == argc - 3)) { if (!(fp && optind == argc - 2) && !(!fp && optind == argc - 3)) {
printf("%s: Usage: %s <file> <attr> [-f infile | value>]\n", print_usage:
argv[0], argv[0]); printf("Usage:\t%s <file> <attr> <value>\n", argv[0]);
printf("\t%s -f <value_file> <file> <attr>\n", argv[0]);
goto out2; goto out2;
} }

View File

@ -1,9 +1,9 @@
debugfs sort extended attributes debugfs sort extended attributes
mke2fs -Fq -b 1024 test.img 512 mke2fs -Fq -b 1024 test.img 512
Exit status is 0 Exit status is 0
ea_set / security.SMEG64 -f /tmp/b ea_set -f /tmp/b / security.SMEG64
Exit status is 0 Exit status is 0
ea_set / security.imb -f /tmp/b ea_set -f /tmp/b / security.imb
Exit status is 0 Exit status is 0
ea_set / user.moo cow ea_set / user.moo cow
Exit status is 0 Exit status is 0

View File

@ -21,14 +21,14 @@ B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
perl -e 'print "x" x 256;' > $B perl -e 'print "x" x 256;' > $B
echo "ea_set / security.SMEG64 -f /tmp/b" > $OUT.new echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new
$DEBUGFS -w -R "ea_set / security.SMEG64 -f $B" $TMPFILE >> $OUT.new 2>&1 $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
status=$? status=$?
echo Exit status is $status >> $OUT.new echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed $OUT.new >> $OUT sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
echo "ea_set / security.imb -f /tmp/b" > $OUT.new echo "ea_set -f /tmp/b / security.imb" > $OUT.new
$DEBUGFS -w -R "ea_set / security.imb -f $B" $TMPFILE >> $OUT.new 2>&1 $DEBUGFS -w -R "ea_set -f $B / security.imb" $TMPFILE >> $OUT.new 2>&1
status=$? status=$?
echo Exit status is $status >> $OUT.new echo Exit status is $status >> $OUT.new
sed -f $cmd_dir/filter.sed $OUT.new >> $OUT sed -f $cmd_dir/filter.sed $OUT.new >> $OUT