"Theodoros V. Kalamatianos" <[EMAIL PROTECTED]> wrote: > as the subject says, the tests/misc/pwd-long test fails with a > Permission denied' error when / is not readable by the user that runs > the test. The reason for this is that it apparently tries to read the > ../../../ ... ../../../' directory, which normally points to root. > > While the usefulness and/or validity of having / unreadable by > unprivileged users is debatable, at least one Linux distribution > (Mandrake/Mandriva) seems to keep it that way in its "secure" setting > and I was wondering if it would be possible to work around this issue > (would '../misc/../misc/../misc ...' do ?) or at least to make that > test run as root only or be skipped if / is not readable.
Thanks for the report. Would you please confirm that this patch is sufficient? Subject: [PATCH] Avoid test failures when root (/) is not readable. * tests/test-lib.sh (require_readable_root_): New function. * tests/misc/pwd-long: Skip this test when / is unreadable. * tests/du/slash: Likewise. This is required at least for Mandrake/Mandriva in "secure" mode. Reported by Theodoros V. Kalamatianos in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12800 --- tests/du/slash | 3 ++- tests/misc/pwd-long | 3 ++- tests/test-lib.sh | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/du/slash b/tests/du/slash index dd91751..7f218c9 100755 --- a/tests/du/slash +++ b/tests/du/slash @@ -22,6 +22,7 @@ if test "$VERBOSE" = yes; then fi . $srcdir/../test-lib.sh +require_readable_root_ fail=0 diff --git a/tests/misc/pwd-long b/tests/misc/pwd-long index 6ab2188..d931d34 100755 --- a/tests/misc/pwd-long +++ b/tests/misc/pwd-long @@ -20,6 +20,7 @@ . $srcdir/../require-perl . $srcdir/../test-lib.sh +require_readable_root_ ARGV_0=$0 export ARGV_0 diff --git a/tests/test-lib.sh b/tests/test-lib.sh index a473dfb..c494e19 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -39,6 +39,11 @@ require_ulimit_() && skip_test_ "this shell lacks ulimit support" } +require_readable_root_() +{ + test -r / || skip_test_ "/ is not readable" +} + # Skip the current test if strace is not available or doesn't work. require_strace_() { -- 1.5.4.2.198.g5fe8d _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils