0.8.8.25:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 15 Mar 2004 13:27:50 +0000 (13:27 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 15 Mar 2004 13:27:50 +0000 (13:27 +0000)
Don't allow the system to be built as root
... id(1) check early in the build.
Fix the SB-POSIX test suite
... rewrite mkdir.error.3 not to assume that / is unwriteable;
... continue to assume that the user is not (fake)root, but
nonetheless try to clean up a bit more if we are.

NEWS
contrib/sb-posix/posix-tests.lisp
make-config.sh

diff --git a/NEWS b/NEWS
index 0b1ee32..1183175 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2320,6 +2320,11 @@ changes in sbcl-0.8.9 relative to sbcl-0.8.8:
     should matter to you only if you rebind the printer control
     variables and then find you want different bindings in the 
     debugger than in the ordinary execution of your program.)
+  * minor incompatible change: the system no longer allows itself to
+    be built as root.  This is primarily to allow the SB-POSIX contrib
+    module's test suite to assume that it is being run as an ordinary
+    user, with the attendant filesystem permissions semantics that
+    entails.
   * The runtime build system has been tweaked to support building
     (on SPARC/SunOS) using a C compiler which invokes Sun's own
     assembler and linker.  (thanks to Nikodemus Siivola)
index 469b739..c304f7d 100644 (file)
   #.sb-posix::eexist)
 
 (deftest mkdir.error.3
-  (handler-case
-      (sb-posix:mkdir "/almost-certainly-does-not-exist" 0)
-    (sb-posix:syscall-error (c)
-      (sb-posix:syscall-errno c)))
+  (let* ((dir (merge-pathnames
+              (make-pathname :directory '(:relative "mkdir.error.3"))
+              *test-directory*))
+        (dir2 (merge-pathnames
+               (make-pathname :directory '(:relative "does-not-exist"))
+               dir)))
+    (sb-posix:mkdir dir 0)
+    (handler-case
+       (sb-posix:mkdir dir2 0)
+      (sb-posix:syscall-error (c)
+       (sb-posix:rmdir dir)
+       (sb-posix:syscall-errno c))
+      (:no-error (result)
+       (sb-posix:rmdir dir2)
+       (sb-posix:rmdir dir)
+       result)))
   #.sb-posix::eacces)
 \f
 (deftest rmdir.1
       (sb-posix:syscall-errno c)))
   #.sb-posix::enotdir)
 
-#-sunos ; Apparently gives EINVAL on SunOS 8, which doesn't make sense
 (deftest rmdir.error.3
   (handler-case
       (sb-posix:rmdir "/")
        (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
        (sb-posix:rmdir dir2)
        (sb-posix:rmdir dir)
-       (sb-posix:syscall-errno c))))
+       (sb-posix:syscall-errno c))
+      (:no-error (result)
+       (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
+       (sb-posix:rmdir dir)
+       result)))
   #.sb-posix::eacces)
 \f
 (deftest stat.1
     (< (- atime unix-now) 10))
   t)
 
-(deftest stat.2
+(deftest stat.4
   (let* ((stat (sb-posix:stat (make-pathname :directory '(:absolute :up))))
         (mode (sb-posix::stat-mode stat)))
     ;; it's logically possible for / to be writeable by others... but
        (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
        (sb-posix:unlink file)
        (sb-posix:rmdir dir)
-       (sb-posix:syscall-errno c))))
+       (sb-posix:syscall-errno c))
+      (:no-error (result)
+       (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
+       (sb-posix:unlink file)
+       (sb-posix:rmdir dir)
+       result)))
   #.sb-posix::eacces)
 \f
 ;;; stat-mode tests
index ff693d1..7664551 100644 (file)
@@ -18,6 +18,9 @@
 
 echo //entering make-config.sh
 
+echo //checking that we are not root
+if [ `id -u` -eq 0 ] ; then echo 'Argh! we are (fake)root!'; exit 1; fi;
+
 echo //ensuring the existence of output/ directory
 if [ ! -d output ] ; then mkdir output; fi