On Wed, Jan 04 2023, David Bremner wrote: > File permission errors e.g., are hard to trigger as root. > --- > test/T050-new.sh | 1 + > test/T150-tagging.sh | 1 + > test/test-lib.sh | 6 ++++++ > 3 files changed, 8 insertions(+) > > diff --git a/test/T050-new.sh b/test/T050-new.sh > index cb67889c..240c1810 100755 > --- a/test/T050-new.sh > +++ b/test/T050-new.sh > @@ -384,6 +384,7 @@ EOF > test_expect_equal_file EXPECTED OUTPUT > > test_begin_subtest "Xapian exception: read only files" > +test_subtest_broken_for_root > chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.* > output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' ) > chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.* > diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh > index 1a2fd77e..ac3f2539 100755 > --- a/test/T150-tagging.sh > +++ b/test/T150-tagging.sh > @@ -320,6 +320,7 @@ test_begin_subtest "Tag name beginning with -" > test_expect_code 1 'notmuch tag +- One' > > test_begin_subtest "Xapian exception: read only files" > +test_subtest_broken_for_root > chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.* > output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' ) > chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.* > diff --git a/test/test-lib.sh b/test/test-lib.sh > index eec5c5b4..c2b8cd8d 100644 > --- a/test/test-lib.sh > +++ b/test/test-lib.sh > @@ -740,6 +740,12 @@ test_subtest_known_broken () { > test_subtest_known_broken_=t > } > > +test_subtest_broken_for_root () { > + if [ "$(id -u)" = "0" ]; then > + test_subtest_known_broken_=t
Good progress -- bash has: $ bash -c 'set' | grep UID EUID=1001 UID=1001 $ podman run --rm -it debian:10.9 bash -c 'set' | grep UID EUID=0 UID=0 i.e. EUID as builtin variable ( man id says id -u prints "only the effective user ID" ) another question is whether test_subtest_broken_for_root is good name. perhaps it is tolerable enough Tomi > + fi > +} > + > test_expect_success () { > exec 1>&6 2>&7 # Restore stdout and stderr > if [ -z "$inside_subtest" ]; then > -- > 2.39.0 _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org