Snellman)
* bug fix: on x86 and x86-64 backtraces were sometimes truncated
after alien stack frames.
+ * bug fix: strings passed to mk{s,d}temp lacked null termination
changes in sbcl-1.0.21 relative to 1.0.20:
* new feature: the compiler is able to track the effective type of a
(let* ((external-format sb-alien::*default-c-string-external-format*)
(arg (sb-ext:string-to-octets
(filename template)
- :external-format external-format)))
+ :external-format external-format
+ :null-terminate t)))
(sb-sys:with-pinned-objects (arg)
;; accommodate for the call-by-reference
;; nature of mks/dtemp's template strings.
;; FIXME: We'd rather return pathnames, but other
;; SB-POSIX functions like this return strings...
(let ((pathname (sb-ext:octets-to-string
- arg :external-format external-format)))
+ arg :external-format external-format
+ :end (1- (length arg)))))
,(if values
'(values result pathname)
'pathname))))))
(values (equal "mktemp" (pathname-name pathname))
(not (equal "XXXXXX" (pathname-type pathname)))))
t t)
+
+#-win32
+(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")
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.21.32"
+"1.0.21.33"