diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2010-05-04 22:08:46 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2010-05-04 22:12:00 +0200 |
commit | ad76f672858d3c566035eee6390382d717775b3b (patch) | |
tree | d1cd14b2ca580bf91ec828a5ff9b87db8c9fa4b3 | |
parent | 9dbdc0e748837620dcdd63978e4232c8be1f0566 (diff) | |
download | patch-ad76f672858d3c566035eee6390382d717775b3b.tar.gz |
tests/read-only-files: Replace the superuser test
* tests/read-only-files: Remove the superuser test, and instead try
out if a read-only file can be written to.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/read-only-files | 10 |
2 files changed, 11 insertions, 2 deletions
@@ -7,6 +7,9 @@ 2009-05-04 Andreas Gruenbacher <agruen@suse.de> + * tests/read-only-files: Remove the superuser test, and instead try + out if a read-only file can be written to. + * tests/test-lib.sh: Create temporary directories in builddir; this removes the need to do it safely: some systems do not have mktemp -d. diff --git a/tests/read-only-files b/tests/read-only-files index df4f7f0..172a0bd 100644 --- a/tests/read-only-files +++ b/tests/read-only-files @@ -12,10 +12,16 @@ require_cat use_local_patch use_tmpdir -if test `id -u` = 0; then - echo "This test must not be run as superuser" >&2 +# -------------------------------------------------------------- + +: > read-only +chmod a-w read-only +if : 2> /dev/null > read-only; then + echo "Files with read-only permissions are writable" \ + "(probably running as superuser)" >&2 exit 77 fi +rm -f read-only # ============================================================== |