1 (defpackage "SB-POSIX-TESTS"
2 (:use "COMMON-LISP" "SB-RT"))
4 (in-package "SB-POSIX-TESTS")
6 (defvar *test-directory*
7 (ensure-directories-exist
8 (merge-pathnames (make-pathname :directory '(:relative "test-lab"))
9 (make-pathname :directory
10 (pathname-directory *load-truename*)))))
12 (defvar *current-directory* *default-pathname-defaults*)
14 (defvar *this-file* *load-truename*)
16 (eval-when (:compile-toplevel :load-toplevel)
17 (defconstant +mode-rwx-all+
18 (logior sb-posix::s-irusr sb-posix::s-iwusr sb-posix::s-ixusr
21 sb-posix::s-irgrp sb-posix::s-iwgrp sb-posix::s-ixgrp
22 sb-posix::s-iroth sb-posix::s-iwoth sb-posix::s-ixoth))))
24 (defmacro define-eacces-test (name form &rest values)
28 (when (= (sb-posix:geteuid) 0)
29 (return-from ,name (values ,@values)))
34 (sb-posix:chdir *test-directory*)
38 (sb-posix:chdir (namestring *test-directory*))
46 (sb-posix:chdir #p"/")
50 (sb-posix:chdir *current-directory*)
54 (sb-posix:chdir "/../")
58 (sb-posix:chdir #p"/../")
62 (sb-posix:chdir (make-pathname :directory '(:absolute :up)))
65 (deftest chdir.error.1
66 (let ((dne (make-pathname :directory '(:relative "chdir.does-not-exist"))))
68 (sb-posix:chdir (merge-pathnames dne *test-directory*))
69 (sb-posix:syscall-error (c)
70 (sb-posix:syscall-errno c))))
73 (deftest chdir.error.2
75 (sb-posix:chdir *this-file*)
76 (sb-posix:syscall-error (c)
77 (sb-posix:syscall-errno c)))
84 (let ((dne (make-pathname :directory '(:relative "mkdir.does-not-exist.1"))))
86 (sb-posix:mkdir (merge-pathnames dne *test-directory*) 0)
87 ;; FIXME: no delete-directory in CL, but using our own operators
88 ;; is probably not ideal
89 (ignore-errors (sb-posix:rmdir (merge-pathnames dne *test-directory*)))))
93 (let ((dne (make-pathname :directory '(:relative "mkdir.does-not-exist.2"))))
95 (sb-posix:mkdir (namestring (merge-pathnames dne *test-directory*)) 0)
96 (ignore-errors (sb-posix:rmdir (merge-pathnames dne *test-directory*)))))
99 (deftest mkdir.error.1
101 (sb-posix:mkdir *test-directory* 0)
102 (sb-posix:syscall-error (c)
103 (sb-posix:syscall-errno c)))
106 (deftest mkdir.error.2
108 (sb-posix:mkdir #-win32 "/" #+win32 "C:/" 0)
109 (sb-posix:syscall-error (c)
110 (sb-posix:syscall-errno c)))
118 (define-eacces-test mkdir.error.3
119 (let* ((dir (merge-pathnames
120 (make-pathname :directory '(:relative "mkdir.error.3"))
122 (dir2 (merge-pathnames
123 (make-pathname :directory '(:relative "does-not-exist"))
125 (sb-posix:mkdir dir 0)
127 (sb-posix:mkdir dir2 0)
128 (sb-posix:syscall-error (c)
130 (sb-posix:syscall-errno c))
132 (sb-posix:rmdir dir2)
138 (let ((dne (make-pathname :directory '(:relative "rmdir.does-not-exist.1"))))
139 (ensure-directories-exist (merge-pathnames dne *test-directory*))
140 (sb-posix:rmdir (merge-pathnames dne *test-directory*)))
144 (let ((dne (make-pathname :directory '(:relative "rmdir.does-not-exist.2"))))
145 (ensure-directories-exist (merge-pathnames dne *test-directory*))
146 (sb-posix:rmdir (namestring (merge-pathnames dne *test-directory*))))
149 (deftest rmdir.error.1
150 (let ((dne (make-pathname :directory '(:relative "rmdir.dne.error.1"))))
152 (sb-posix:rmdir (merge-pathnames dne *test-directory*))
153 (sb-posix:syscall-error (c)
154 (sb-posix:syscall-errno c))))
157 (deftest rmdir.error.2
159 (sb-posix:rmdir *this-file*)
160 (sb-posix:syscall-error (c)
161 (sb-posix:syscall-errno c)))
167 (deftest rmdir.error.3
169 (sb-posix:rmdir #-win32 "/" #+win32 "C:/")
170 (sb-posix:syscall-error (c)
171 (sb-posix:syscall-errno c)))
178 #-(or darwin win32 sunos)
181 (deftest rmdir.error.4
182 (let* ((dir (ensure-directories-exist
184 (make-pathname :directory '(:relative "rmdir.error.4"))
186 (file (make-pathname :name "foo" :defaults dir)))
187 (with-open-file (s file :direction :output :if-exists nil)
188 (write "" :stream s))
191 (sb-posix:syscall-error (c)
194 (let ((errno (sb-posix:syscall-errno c)))
195 ;; documented by POSIX
196 (or (= errno sb-posix::eexist) (= errno sb-posix::enotempty))))))
199 (define-eacces-test rmdir.error.5
200 (let* ((dir (merge-pathnames
201 (make-pathname :directory '(:relative "rmdir.error.5"))
203 (dir2 (merge-pathnames
204 (make-pathname :directory '(:relative "unremovable"))
206 (sb-posix:mkdir dir +mode-rwx-all+)
207 (sb-posix:mkdir dir2 +mode-rwx-all+)
208 (sb-posix:chmod dir 0)
210 (sb-posix:rmdir dir2)
211 (sb-posix:syscall-error (c)
212 (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
213 (sb-posix:rmdir dir2)
215 (sb-posix:syscall-errno c))
217 (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
223 (let* ((stat (sb-posix:stat *test-directory*))
224 (mode (sb-posix::stat-mode stat)))
225 ;; FIXME: Ugly ::s everywhere
226 (logand mode (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec)))
227 #.(logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
231 (let* ((stat (sb-posix:stat "/"))
232 (mode (sb-posix::stat-mode stat)))
233 ;; it's logically possible for / to be writeable by others... but
234 ;; if it is, either someone is playing with strange security
235 ;; modules or they want to know about it anyway.
236 (logand mode sb-posix::s-iwoth))
240 (let* ((now (get-universal-time))
241 ;; FIXME: (encode-universal-time 00 00 00 01 01 1970)
242 (unix-now (- now 2208988800))
243 (stat (sb-posix:stat *test-directory*))
244 (atime (sb-posix::stat-atime stat)))
245 ;; FIXME: breaks if mounted noatime :-(
246 #+nil (< (- atime unix-now) 10)
247 (< (- atime unix-now) 10))
252 (let* ((stat (sb-posix:stat (make-pathname :directory '(:absolute :up))))
253 (mode (sb-posix::stat-mode stat)))
254 ;; it's logically possible for / to be writeable by others... but
255 ;; if it is, either someone is playing with strange security
256 ;; modules or they want to know about it anyway.
257 (logand mode sb-posix::s-iwoth))
260 ;; Test that stat can take a second argument.
263 (let* ((stat-1 (sb-posix:stat "/"))
264 (inode-1 (sb-posix:stat-ino stat-1))
265 (stat-2 (sb-posix:stat "/bin/sh"
267 (inode-2 (sb-posix:stat-ino stat-2)))
270 (/= inode-1 inode-2)))
276 (let* ((stat-1 (sb-posix:stat "/"))
277 (mode-1 (sb-posix:stat-mode stat-1))
278 (stat-2 (sb-posix:stat "C:\\CONFIG.SYS"
280 (mode-2 (sb-posix:stat-mode stat-2)))
287 ;;; FIXME: add tests for carrying a stat structure around in the
288 ;;; optional argument to SB-POSIX:STAT
290 (deftest stat.error.1
291 (handler-case (sb-posix:stat "")
292 (sb-posix:syscall-error (c)
293 (sb-posix:syscall-errno c)))
296 (define-eacces-test stat.error.2
297 (let* ((dir (merge-pathnames
298 (make-pathname :directory '(:relative "stat.error.2"))
300 (file (merge-pathnames
301 (make-pathname :name "unstatable")
303 (sb-posix:mkdir dir +mode-rwx-all+)
304 (with-open-file (s file :direction :output)
305 (write "" :stream s))
306 (sb-posix:chmod dir 0)
309 (sb-posix:syscall-error (c)
310 (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
311 (sb-posix:unlink file)
313 (sb-posix:syscall-errno c))
315 (sb-posix:chmod dir (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
316 (sb-posix:unlink file)
322 (defmacro with-stat-mode ((mode pathname) &body body)
323 (let ((stat (gensym)))
324 `(let* ((,stat (sb-posix:stat ,pathname))
325 (,mode (sb-posix::stat-mode ,stat)))
328 (defmacro with-lstat-mode ((mode pathname) &body body)
329 (let ((stat (gensym)))
330 `(let* ((,stat (sb-posix:lstat ,pathname))
331 (,mode (sb-posix::stat-mode ,stat)))
335 (with-stat-mode (mode *test-directory*)
336 (sb-posix:s-isreg mode))
340 (with-stat-mode (mode *test-directory*)
341 (sb-posix:s-isdir mode))
345 (with-stat-mode (mode *test-directory*)
346 (sb-posix:s-ischr mode))
350 (with-stat-mode (mode *test-directory*)
351 (sb-posix:s-isblk mode))
355 (with-stat-mode (mode *test-directory*)
356 (sb-posix:s-isfifo mode))
361 (with-stat-mode (mode *test-directory*)
362 (sb-posix:s-issock mode))
367 (let ((link-pathname (make-pathname :name "stat-mode.7"
368 :defaults *test-directory*)))
371 (sb-posix:symlink *test-directory* link-pathname)
372 (with-lstat-mode (mode link-pathname)
373 (sb-posix:s-islnk mode)))
374 (ignore-errors (sb-posix:unlink link-pathname))))
378 (let ((pathname (make-pathname :name "stat-mode.8"
379 :defaults *test-directory*)))
382 (with-open-file (out pathname :direction :output)
383 (write-line "test" out))
384 (with-stat-mode (mode pathname)
385 (sb-posix:s-isreg mode)))
386 (ignore-errors (delete-file pathname))))
389 ;;; see comment in filename's designator definition, in macros.lisp
390 (deftest filename-designator.1
391 (let ((file (format nil "~A/[foo].txt" (namestring *test-directory*))))
392 ;; creat() with a string as argument
393 (let ((fd (sb-posix:creat file sb-posix:s-iwrite)))
396 ;; if this test fails, it will probably be with
397 ;; "System call error 2 (No such file or directory)"
398 (let ((*default-pathname-defaults* *test-directory*))
399 (sb-posix:unlink (car (directory "*.txt")))))
403 (let ((name (merge-pathnames "open-test.txt" *test-directory*)))
407 (sb-posix:creat name (logior sb-posix:s-iwrite sb-posix:s-iread)))
408 (let ((fd (sb-posix:open name sb-posix::o-rdonly)))
409 (ignore-errors (sb-posix:close fd))
411 (ignore-errors (sb-posix:unlink name))))
414 #-hpux ; fix: cant handle c-vargs
415 (deftest open.error.1
416 (handler-case (sb-posix:open *test-directory* sb-posix::o-wronly)
417 (sb-posix:syscall-error (c)
418 (sb-posix:syscall-errno c)))
424 #-(or (and x86-64 (or linux sunos)) win32)
426 (let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
427 (= (sb-posix:fcntl fd sb-posix::f-getfl) sb-posix::o-nonblock))
429 ;; On AMD64/Linux O_LARGEFILE is always set, even though the whole
430 ;; flag makes no sense.
431 #+(and x86-64 (or linux sunos))
433 (let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
434 (/= 0 (logand (sb-posix:fcntl fd sb-posix::f-getfl)
435 sb-posix::o-nonblock)))
438 #-(or hpux win32) ; fix: cant handle c-vargs
439 (deftest fcntl.flock.1
440 (locally (declare (sb-ext:muffle-conditions sb-ext:compiler-note))
441 (let ((flock (make-instance 'sb-posix:flock
442 :type sb-posix:f-wrlck
443 :whence sb-posix:seek-set
445 (pathname "fcntl.flock.1")
448 (with-open-file (f pathname :direction :output)
449 (write-line "1234567890" f)
450 (assert (zerop (sb-posix:fcntl f sb-posix:f-setlk flock)))
451 (let ((pid (sb-posix:fork)))
454 (multiple-value-bind (nope error)
455 (ignore-errors (sb-posix:fcntl f sb-posix:f-setlk flock))
458 (cond ((not (null nope)) 1)
459 ((= (sb-posix:syscall-errno error) sb-posix:eagain)
462 :recklessly-p t #| don't delete the file |#)))
465 (sb-posix:wexitstatus
467 1 (sb-posix:waitpid pid 0))))
468 (throw 'test nil))))))
474 (deftest fcntl.flock.2
475 (locally (declare (sb-ext:muffle-conditions sb-ext:compiler-note))
476 (let ((flock (make-instance 'sb-posix:flock
477 :type sb-posix:f-wrlck
478 :whence sb-posix:seek-set
480 (pathname "fcntl.flock.2")
483 (with-open-file (f pathname :direction :output)
484 (write-line "1234567890" f)
485 (assert (zerop (sb-posix:fcntl f sb-posix:f-setlk flock)))
486 (let ((ppid (sb-posix:getpid))
487 (pid (sb-posix:fork)))
489 (let ((r (sb-posix:fcntl f sb-posix:f-getlk flock)))
492 (cond ((not (zerop r)) 1)
493 ((= (sb-posix:flock-pid flock) ppid) 42)
495 :recklessly-p t #| don't delete the file |#))
498 (sb-posix:wexitstatus
500 1 (sb-posix:waitpid pid 0))))
501 (throw 'test nil))))))
506 (let ((dir (sb-posix:opendir "/")))
507 (unwind-protect (sb-alien:null-alien dir)
508 (unless (sb-alien:null-alien dir)
509 (sb-posix:closedir dir))))
513 (let ((dir (sb-posix:opendir "/")))
516 (loop for dirent = (sb-posix:readdir dir)
517 until (sb-alien:null-alien dirent)
518 when (not (stringp (sb-posix:dirent-name dirent)))
519 do (return-from dir-loop nil)
521 (sb-posix:closedir dir)))
525 (deftest readdir/dirent-name
526 (let ((dir (sb-posix:opendir *current-directory*)))
528 (equal (sort (loop for entry = (sb-posix:readdir dir)
529 until (sb-alien:null-alien entry)
530 collect (sb-posix:dirent-name entry))
532 (sort (append '("." "..")
534 (let ((string (enough-namestring p *current-directory*)))
535 (if (pathname-name p)
537 (subseq string 0 (1- (length string))))))
538 (directory (make-pathname
541 :defaults *current-directory*))))
543 (sb-posix:closedir dir)))
548 ;; make sure that we found something
549 (not (sb-posix:getpwuid 0))
554 ;; make sure that we found something
555 (not (sb-posix:getpwnam "root"))
559 (deftest pwent.non-existing
560 ;; make sure that we get something sensible, not an error
561 (handler-case (progn (sb-posix:getpwnam "almost-certainly-does-not-exist")
568 ;; make sure that we found something
569 (not (sb-posix:getgrgid 0))
574 ;; make sure that we found something
575 (not (sb-posix:getgrnam "sys"))
579 (deftest grent.non-existing
580 ;; make sure that we get something sensible, not an error
581 (handler-case (progn (sb-posix:getgrnam "almost-certainly-does-not-exist")
587 ;; Requires root or special group + plus a sensible thing on the port
588 (deftest cfget/setispeed.1
589 (with-open-file (s "/dev/ttyS0")
590 (let* ((termios (sb-posix:tcgetattr s))
591 (old (sb-posix:cfgetispeed termios))
592 (new (if (= old sb-posix:b2400)
595 (sb-posix:cfsetispeed new termios)
596 (sb-posix:tcsetattr 0 sb-posix:tcsadrain termios)
597 (setf termios (sb-posix:tcgetattr s))
598 (= new (sb-posix:cfgetispeed termios))))
602 ;; Requires root or special group + a sensible thing on the port
603 (deftest cfget/setospeed.1
604 (with-open-file (s "/dev/ttyS0" :direction :output :if-exists :append)
605 (let* ((termios (sb-posix:tcgetattr s))
606 (old (sb-posix:cfgetospeed termios))
607 (new (if (= old sb-posix:b2400)
610 (sb-posix:cfsetospeed new termios)
611 (sb-posix:tcsetattr 0 sb-posix:tcsadrain termios)
612 (setf termios (sb-posix:tcgetattr 0))
613 (= new (sb-posix:cfgetospeed termios))))
619 (plusp (sb-posix:time))
624 (let ((file (merge-pathnames #p"utimes.1" *test-directory*))
625 (atime (random (1- (expt 2 31))))
626 (mtime (random (1- (expt 2 31)))))
627 (with-open-file (stream file
629 :if-exists :supersede
630 :if-does-not-exist :create)
631 (princ "Hello, utimes" stream))
632 (sb-posix:utime file atime mtime)
633 (let* ((stat (sb-posix:stat file)))
635 (list (= (sb-posix:stat-atime stat) atime)
636 (= (sb-posix:stat-mtime stat) mtime))))
643 (let ((link-pathname (make-pathname :name "readlink.1"
644 :defaults *test-directory*)))
645 (sb-posix:symlink "/" link-pathname)
647 (sb-posix:readlink link-pathname)
648 (ignore-errors (sb-posix:unlink link-pathname))))
651 ;; Same thing, but with a very long link target (which doesn't have
652 ;; to exist). This tests the array adjustment in the wrapper,
653 ;; provided that the target's length is long enough.
654 #-hpux ; arg2 to readlink is 80, and arg0 is larger than that
656 (let ((target-pathname (make-pathname
657 :name (make-string 255 :initial-element #\a)
658 :directory '(:absolute)))
659 (link-pathname (make-pathname :name "readlink.2"
660 :defaults *test-directory*)))
661 (sb-posix:symlink target-pathname link-pathname)
663 (sb-posix:readlink link-pathname)
664 (ignore-errors (sb-posix:unlink link-pathname))))
665 #.(concatenate 'string "/" (make-string 255 :initial-element #\a)))
667 ;; The error tests are in the order of exposition from SUSv3.
668 (deftest readlink.error.1
669 (let* ((subdir-pathname (merge-pathnames
671 :directory '(:relative "readlink.error.1"))
673 (link-pathname (make-pathname :name "readlink.error.1"
674 :defaults subdir-pathname)))
675 (sb-posix:mkdir subdir-pathname #o777)
676 (sb-posix:symlink "/" link-pathname)
677 (sb-posix:chmod subdir-pathname 0)
679 (handler-case (sb-posix:readlink link-pathname)
680 (sb-posix:syscall-error (c)
681 (sb-posix:syscall-errno c)))
683 (sb-posix:chmod subdir-pathname #o777)
684 (sb-posix:unlink link-pathname)
685 (sb-posix:rmdir subdir-pathname))))
687 (deftest readlink.error.2
688 (let* ((non-link-pathname (make-pathname :name "readlink.error.2"
689 :defaults *test-directory*))
690 (fd (sb-posix:open non-link-pathname sb-posix::o-creat)))
692 (handler-case (sb-posix:readlink non-link-pathname)
693 (sb-posix:syscall-error (c)
694 (sb-posix:syscall-errno c)))
697 (sb-posix:unlink non-link-pathname))))
699 ;; Skipping EIO, ELOOP
700 (deftest readlink.error.3
701 (let* ((link-pathname (make-pathname :name "readlink.error.3"
702 :defaults *test-directory*))
703 (bogus-pathname (merge-pathnames
706 :directory '(:relative "readlink.error.3"))
708 (sb-posix:symlink link-pathname link-pathname)
710 (handler-case (sb-posix:readlink bogus-pathname)
711 (sb-posix:syscall-error (c)
712 (sb-posix:syscall-errno c)))
713 (ignore-errors (sb-posix:unlink link-pathname))))
715 ;; Note: PATH_MAX and NAME_MAX need not be defined, and may vary, so
716 ;; failure of this test is not too meaningful.
717 (deftest readlink.error.4
719 (make-pathname :name (make-string 257 ;NAME_MAX plus some, maybe
720 :initial-element #\a))))
721 (handler-case (sb-posix:readlink pathname)
722 (sb-posix:syscall-error (c)
723 (sb-posix:syscall-errno c))))
724 #.sb-posix:enametoolong)
725 (deftest readlink.error.5
726 (let ((string (format nil "~v{/A~}" 2049 ;PATH_MAX/2 plus some, maybe
728 (handler-case (sb-posix:readlink string)
729 (sb-posix:syscall-error (c)
730 (sb-posix:syscall-errno c))))
731 #.sb-posix:enametoolong)
732 (deftest readlink.error.6
733 (let ((no-such-pathname (make-pathname :name "readlink.error.6"
734 :defaults *test-directory*)))
735 (handler-case (sb-posix:readlink no-such-pathname)
736 (sb-posix:syscall-error (c)
737 (sb-posix:syscall-errno c))))
739 (deftest readlink.error.7
740 (let* ((non-link-pathname (make-pathname :name "readlink.error.7"
741 :defaults *test-directory*))
742 (impossible-pathname (merge-pathnames
745 '(:relative "readlink.error.7")
746 :name "readlink.error.7")
748 (fd (sb-posix:open non-link-pathname sb-posix::o-creat)))
750 (handler-case (sb-posix:readlink impossible-pathname)
751 (sb-posix:syscall-error (c)
752 (sb-posix:syscall-errno c)))
755 (sb-posix:unlink non-link-pathname))))
760 ;; FIXME: something saner, please
761 (equal (sb-unix::posix-getcwd) (sb-posix:getcwd))
766 (multiple-value-bind (fd temp)
767 (sb-posix:mkstemp (make-pathname
770 :defaults *test-directory*))
771 (let ((pathname (sb-ext:parse-native-namestring temp)))
773 (values (integerp fd) (pathname-name pathname))
774 (delete-file temp))))
777 ;#-(or win32 sunos hpux)
778 ;;;; mkdtemp is unimplemented on at least Solaris 10
779 #-(or win32 hpux sunos)
780 ;;; But it is implemented on OpenSolaris 2008.11
783 (sb-ext:parse-native-namestring
784 (sb-posix:mkdtemp (make-pathname
787 :defaults *test-directory*))
789 *default-pathname-defaults*
792 (values (let* ((xxx (car (last (pathname-directory pathname))))
793 (p (position #\. xxx)))
794 (and p (subseq xxx 0 p)))
795 (pathname-name pathname)
796 (pathname-type pathname))
797 (sb-posix:rmdir pathname)))
802 (let ((pathname (sb-ext:parse-native-namestring
803 (sb-posix:mktemp #p"mktemp.XXXXXX"))))
804 (values (equal "mktemp" (pathname-name pathname))
805 (not (equal "XXXXXX" (pathname-type pathname)))))
809 (deftest mkstemp.null-terminate
810 (let* ((default (make-pathname :directory '(:absolute "tmp")))
811 (filename (namestring (make-pathname :name "mkstemp-1"
814 ;; The magic 64 is the filename length that happens to
815 ;; trigger the no null termination bug at least on my
816 ;; machine on a certain build.
817 (n (- 64 (length (sb-ext:string-to-octets filename)))))
818 (multiple-value-bind (fd temp)
819 (sb-posix:mkstemp (make-pathname
821 :type (format nil "~AXXXXXX"
822 (make-string n :initial-element #\x))
824 (let ((pathname (sb-ext:parse-native-namestring temp)))
826 (values (integerp fd) (pathname-name pathname))
827 (delete-file temp)))))
831 (let ((name1 "ASLIFJLSDKFJKAHGSDKLJH")
832 (name2 "KJHFKLJDSHIUYHBSDNFCBH"))
833 (values (sb-posix:getenv name1)
834 (sb-posix:getenv name1)
836 (sb-posix:putenv (concatenate 'string name1 "=name1,test1"))
838 (sb-posix:getenv name1))
840 (sb-posix:setenv name1 "name1,test2" 0)
842 (sb-posix:getenv name1))
844 (sb-posix:setenv name2 "name2,test1" 0)
846 (sb-posix:getenv name2))
848 (sb-posix:setenv name2 "name2,test2" 1)
850 (sb-posix:getenv name2))))