From: Jim W. <jw...@dr...> - 2011-02-18 20:18:05
|
I've also come across a fix for a rare sporadic (specifically random -- see below) error in the test MKSTEMP.NULL-TERMINATE in contrib/sb-posix/posix-tests.lisp. This test does the following: (deftest mkstemp.null-terminate (let* ((default (make-pathname :directory '(:absolute "tmp"))) (filename (namestring (make-pathname :name "mkstemp-1" :type "XXXXXX" :defaults default))) ;; The magic 64 is the filename length that happens to ;; trigger the no null termination bug at least on my ;; machine on a certain build. (n (- 64 (length (sb-ext:string-to-octets filename))))) (multiple-value-bind (fd temp) (sb-posix:mkstemp (make-pathname :name "mkstemp-1" :type (format nil "~AXXXXXX" (make-string n :initial-element #\x)) :defaults default)) (let ((pathname (sb-ext:parse-native-namestring temp))) (unwind-protect (values (integerp fd) (pathname-name pathname)) (delete-file temp))))) t "mkstemp-1") And the vast majority of the time, this works quite correctly -- the PATHNAME-NAME of the generated file is indeed "mkstemp-1". However, on some platforms (including Solaris, FWIW), the character "." is one of the characters mkstemp can use when filling in an "XXXXXX" template. When this (randomly) occurs during the running of this test, PATHNAME-NAME, of course breaks on the last such random "." character, and the test fails in a way which will not repeat until the next time such a character is randomly chosen. I'll put together a patch for this some time today. This is low priority for this weekend's release, though -- it has only a 6/63 = 2/21 or so chance of affecting any given test. ;-) -- Jim Wise jw...@dr... |