From ab538033efff5e38e5514128028e9d93335782f8 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Wed, 10 Jun 2009 00:24:24 -0400 Subject: [PATCH] don't break on new chattr which doesn't allow block/char devices and symlinks Signed-off-by: Erez Zadok --- scaffold | 9 ++++++++- t-mknod.sh | 1 + t-symlink.sh | 1 + t-unlink-whiteout.sh | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scaffold b/scaffold index d2cfad7..b592f62 100644 --- a/scaffold +++ b/scaffold @@ -37,6 +37,12 @@ function havechattr { return 0 } +# remove non regular files before trying to chattr (new version of chatter +# fails on symlinks and char/block devices. +function clean_hierarchy { + egrep "^[bcl] " | cut -d' ' -f2 | xargs /bin/rm -f +} + function create_hierarchy { havechattr $LOWER_DIR0 && chattr -R -i $LOWER_DIR0 @@ -135,7 +141,8 @@ function create_hierarchy { exit $? fi - if [ ! -z "$IMMUTABLE" ] ; then + # XXX: test if $NAME's branch has chattr support + if test -n "$IMMUTABLE" && havechattr $LOWER_DIR0 ; then chattr +i $NAME || exit $? fi done diff --git a/t-mknod.sh b/t-mknod.sh index ce4d1bd..2ef490e 100755 --- a/t-mknod.sh +++ b/t-mknod.sh @@ -116,6 +116,7 @@ echo -n "[ro] " } test_rw +afterfiles_rw | clean_hierarchy test_ro complete_test diff --git a/t-symlink.sh b/t-symlink.sh index 853cd60..a8ec699 100755 --- a/t-symlink.sh +++ b/t-symlink.sh @@ -123,6 +123,7 @@ echo -n "[ro] " } test_rw +afterfiles_rw | clean_hierarchy test_ro complete_test diff --git a/t-unlink-whiteout.sh b/t-unlink-whiteout.sh index 3011f94..d5856b8 100755 --- a/t-unlink-whiteout.sh +++ b/t-unlink-whiteout.sh @@ -348,9 +348,12 @@ echo -n "[rw createback 2] " } test1 +afterfiles_ro | clean_hierarchy test2 +afterfiles_createback_ro | clean_hierarchy test3 test4 +afterfiles_createback_ro | clean_hierarchy test5 test6 test7 -- 2.43.0