From df03463679a32c5f7cde99e6dea0acc8579a0cf6 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 2 Aug 2007 18:52:40 +0200 Subject: Adapt du's no-x test not to fail on older Linux systems. * tests/du/no-x: Accept a third variant of the diagnostic. --- ChangeLog | 5 +++++ tests/du/no-x | 29 +++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d19371b1..40cf00bb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-02 Jim Meyering + + Adapt du's no-x test not to fail on older Linux systems. + * tests/du/no-x: Accept a third variant of the diagnostic. + 2007-07-31 Jim Meyering du: print size (probably incomplete) of each inaccessible directory diff --git a/tests/du/no-x b/tests/du/no-x index 00aea6a34..f6b59974a 100755 --- a/tests/du/no-x +++ b/tests/du/no-x @@ -2,7 +2,7 @@ # Make sure du gives the right diagnostic for a readable, # 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 # it under the terms of the GNU General Public License as published by @@ -46,25 +46,22 @@ fail=0 # This must exit nonzero. du d >/dev/null 2>out && fail=1 +# Depending on whether du/fts is using native fdopendir, we see one +# of the following diagnostics (note also the /y suffix in one case): +# du: `d/no-x': Permission denied +# du: cannot access `d/no-x/y': Permission denied +# du: cannot read directory `d/no-x': Permission denied +# Convert either of the latter two to the first one. + +sed 's/^du: cannot access /du: /' 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 + cat <<\EOF > exp du: `d/no-x': Permission denied EOF -# With native fdopendir, du uses a different code path. -cat <<\EOF > exp-native-fdopendir -du: 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 - +cmp out exp || fail=1 test $fail = 1 && diff out exp 2> /dev/null (exit $fail); exit $fail -- cgit v1.2.3-54-g00ecf