mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-27 12:04:25 +08:00
Adjust the other two "no-x" tests and unify all three.
* tests/du/no-x: Factor out du-specific bits. * tests/chmod/no-x: Use the same code. * tests/chgrp/no-x: Use the same code.
This commit is contained in:
parent
df03463679
commit
674ea8b2dc
@ -1,5 +1,10 @@
|
|||||||
2007-08-02 Jim Meyering <jim@meyering.net>
|
2007-08-02 Jim Meyering <jim@meyering.net>
|
||||||
|
|
||||||
|
Adjust the other two "no-x" tests and unify all three.
|
||||||
|
* tests/du/no-x: Factor out du-specific bits.
|
||||||
|
* tests/chmod/no-x: Use the same code.
|
||||||
|
* tests/chgrp/no-x: Use the same code.
|
||||||
|
|
||||||
Adapt du's no-x test not to fail on older Linux systems.
|
Adapt du's no-x test not to fail on older Linux systems.
|
||||||
* tests/du/no-x: Accept a third variant of the diagnostic.
|
* tests/du/no-x: Accept a third variant of the diagnostic.
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Make sure chgrp gives the right diagnostic for a readable,
|
# Make sure chgrp gives the right diagnostic for a readable,
|
||||||
# but inaccessible directory.
|
# but inaccessible directory.
|
||||||
|
|
||||||
# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -50,25 +50,24 @@ fail=0
|
|||||||
|
|
||||||
# This must exit nonzero.
|
# This must exit nonzero.
|
||||||
chgrp -R $g2 d >/dev/null 2>out && fail=1
|
chgrp -R $g2 d >/dev/null 2>out && fail=1
|
||||||
cat <<\EOF > exp
|
|
||||||
chgrp: `d/no-x': Permission denied
|
prog=chgrp
|
||||||
|
# NOTE: this code is the same for all tests/*/no-x tests.
|
||||||
|
# Depending on whether fts is using native fdopendir, we see one
|
||||||
|
# of the following diagnostics (note also the /y suffix in one case):
|
||||||
|
# prog: `d/no-x': Permission denied
|
||||||
|
# prog: cannot access `d/no-x/y': Permission denied
|
||||||
|
# prog: cannot read directory `d/no-x': Permission denied
|
||||||
|
# Convert either of the latter two to the first one.
|
||||||
|
sed "s/^$prog: cannot access /$prog: /" out > t && mv t out
|
||||||
|
sed "s/^$prog: cannot read directory /$prog: /" out > t && mv t out
|
||||||
|
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
|
||||||
|
|
||||||
|
cat <<EOF > exp
|
||||||
|
$prog: \`d/no-x': Permission denied
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# With native fdopendir, du uses a different code path.
|
cmp out exp || fail=1
|
||||||
cat <<\EOF > exp-native-fdopendir
|
|
||||||
chgrp: cannot access `d/no-x/y': Permission denied
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if cmp out exp >/dev/null 2>&1; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
if cmp out exp-native-fdopendir; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
fail=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test $fail = 1 && diff out exp 2> /dev/null
|
test $fail = 1 && diff out exp 2> /dev/null
|
||||||
|
|
||||||
(exit $fail); exit $fail
|
(exit $fail); exit $fail
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Make sure chmod gives the right diagnostic for a readable,
|
# Make sure chmod gives the right diagnostic for a readable,
|
||||||
# but inaccessible directory.
|
# but inaccessible directory.
|
||||||
|
|
||||||
# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -46,25 +46,23 @@ fail=0
|
|||||||
# This must exit nonzero.
|
# This must exit nonzero.
|
||||||
chmod -R o=r d >/dev/null 2>out && fail=1
|
chmod -R o=r d >/dev/null 2>out && fail=1
|
||||||
|
|
||||||
cat <<\EOF > exp
|
prog=chmod
|
||||||
chmod: `d/no-x': Permission denied
|
# NOTE: this code is the same for all tests/*/no-x tests.
|
||||||
|
# Depending on whether fts is using native fdopendir, we see one
|
||||||
|
# of the following diagnostics (note also the /y suffix in one case):
|
||||||
|
# prog: `d/no-x': Permission denied
|
||||||
|
# prog: cannot access `d/no-x/y': Permission denied
|
||||||
|
# prog: cannot read directory `d/no-x': Permission denied
|
||||||
|
# Convert either of the latter two to the first one.
|
||||||
|
sed "s/^$prog: cannot access /$prog: /" out > t && mv t out
|
||||||
|
sed "s/^$prog: cannot read directory /$prog: /" out > t && mv t out
|
||||||
|
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
|
||||||
|
|
||||||
|
cat <<EOF > exp
|
||||||
|
$prog: \`d/no-x': Permission denied
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# With native fdopendir, du uses a different code path.
|
cmp out exp || fail=1
|
||||||
cat <<\EOF > exp-native-fdopendir
|
|
||||||
chmod: cannot access `d/no-x/y': Permission denied
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if cmp out exp >/dev/null 2>&1; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
if cmp out exp-native-fdopendir; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
fail=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test $fail = 1 && diff out exp 2> /dev/null
|
test $fail = 1 && diff out exp 2> /dev/null
|
||||||
|
|
||||||
mkdir -p a/b
|
mkdir -p a/b
|
||||||
|
@ -46,19 +46,20 @@ fail=0
|
|||||||
# This must exit nonzero.
|
# This must exit nonzero.
|
||||||
du d >/dev/null 2>out && fail=1
|
du d >/dev/null 2>out && fail=1
|
||||||
|
|
||||||
# Depending on whether du/fts is using native fdopendir, we see one
|
prog=du
|
||||||
|
# NOTE: this code is the same for all tests/*/no-x tests.
|
||||||
|
# Depending on whether fts is using native fdopendir, we see one
|
||||||
# of the following diagnostics (note also the /y suffix in one case):
|
# of the following diagnostics (note also the /y suffix in one case):
|
||||||
# du: `d/no-x': Permission denied
|
# prog: `d/no-x': Permission denied
|
||||||
# du: cannot access `d/no-x/y': Permission denied
|
# prog: cannot access `d/no-x/y': Permission denied
|
||||||
# du: cannot read directory `d/no-x': Permission denied
|
# prog: cannot read directory `d/no-x': Permission denied
|
||||||
# Convert either of the latter two to the first one.
|
# Convert either of the latter two to the first one.
|
||||||
|
sed "s/^$prog: cannot access /$prog: /" out > t && mv t out
|
||||||
sed 's/^du: cannot access /du: /' out > t && mv t out
|
sed "s/^$prog: cannot read directory /$prog: /" out > t && mv t out
|
||||||
sed 's/^du: cannot read directory /du: /' out > t && mv t out
|
|
||||||
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
|
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
|
||||||
|
|
||||||
cat <<\EOF > exp
|
cat <<EOF > exp
|
||||||
du: `d/no-x': Permission denied
|
$prog: \`d/no-x': Permission denied
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cmp out exp || fail=1
|
cmp out exp || fail=1
|
||||||
|
Loading…
Reference in New Issue
Block a user