From 9ca04e5fe7bc37286c120bc84cfd4abf05e51327 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Sun, 3 Dec 2006 15:24:08 +0000 Subject: [PATCH] 1.0.0.16: fix SB-POSIX:READDIR to work when built with largefile * amusingly, the dirent type returned changes name when largefile support is enabled. * whitespace damage. --- NEWS | 1 + contrib/sb-posix/constants.lisp | 3 ++- contrib/sb-posix/interface.lisp | 2 +- contrib/sb-posix/posix-tests.lisp | 7 +++++-- src/compiler/parse-lambda-list.lisp | 6 +++--- src/runtime/largefile.c | 6 ++++++ tests/compiler.impure.lisp | 2 +- tests/run-program.impure.lisp | 10 +++++----- version.lisp-expr | 2 +- 9 files changed, 25 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index e8d49a3..8d37f26 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ changes in sbcl-1.0.1 relative to sbcl-1.0: variable was defined, but had an empty value (reported by Peter Van Eynde) * bug fix: non ordinary lambda-list keyword in ordinary lambda lists signal a PROGRAM-ERROR, not a BUG. + * bug fix: SB-POSIX:READDIR works when built with large file support. * optimization: loading generic functions no longer takes O(n^2) time, proportional to the amount of methods in the generic function (reported by Todd Sabin and Jeremy Brown) diff --git a/contrib/sb-posix/constants.lisp b/contrib/sb-posix/constants.lisp index cf5c767..7018fca 100644 --- a/contrib/sb-posix/constants.lisp +++ b/contrib/sb-posix/constants.lisp @@ -253,7 +253,8 @@ ;; opendir() (:structure dirent - ("struct dirent" + (#+(and linux largefile) "struct dirent64" + #-(and linux largefile) "struct dirent" (:c-string name "char *" "d_name" :distrust-length #+sunos t #-sunos nil)) t) diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 870fa14..daaae9b 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -107,7 +107,7 @@ (define-call* "rmdir" int minusp (pathname filename)) (define-call* "unlink" int minusp (pathname filename)) (define-call "opendir" (* t) null-alien (pathname filename)) -(define-call "readdir" (* dirent) +(define-call ("readdir" :largefile) (* dirent) ;; readdir() has the worst error convention in the world. It's just ;; too painful to support. (return is NULL _and_ errno "unchanged" ;; is not an error, it's EOF). diff --git a/contrib/sb-posix/posix-tests.lisp b/contrib/sb-posix/posix-tests.lisp index 7cc725b..78b4754 100644 --- a/contrib/sb-posix/posix-tests.lisp +++ b/contrib/sb-posix/posix-tests.lisp @@ -428,12 +428,15 @@ #'string<) (sort (append '("." "..") (mapcar (lambda (p) - (enough-namestring p *current-directory*)) + (let ((string (enough-namestring p *current-directory*))) + (if (pathname-name p) + string + (subseq string 0 (1- (length string)))))) (directory (make-pathname :name :wild :type :wild :defaults *current-directory*)))) - #'string<)) + #'string<)) (sb-posix:closedir dir))) t) diff --git a/src/compiler/parse-lambda-list.lisp b/src/compiler/parse-lambda-list.lisp index 5569eb3..64e5838 100644 --- a/src/compiler/parse-lambda-list.lisp +++ b/src/compiler/parse-lambda-list.lisp @@ -104,10 +104,10 @@ (compiler-error "multiple &AUX in lambda list: ~S" list)) (setq auxp t state :aux)) - (t + (t ;; It could be argued that &WHOLE and friends would be just ordinary ;; variables in an ordinary lambda-list, but since (1) it seem exceedingly - ;; unlikely that that was that the programmer actually ment (2) the spec + ;; unlikely that that was that the programmer actually ment (2) the spec ;; can be interpreted as giving as licence to signal an error[*] we do. ;; ;; [* All lambda list keywords used in the @@ -162,7 +162,7 @@ (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux morep more-context more-count) (parse-lambda-list-like-thing lambda-list) - + ;; Check validity of parameters. (flet ((need-symbol (x why) (unless (symbolp x) diff --git a/src/runtime/largefile.c b/src/runtime/largefile.c index 291f7c9..a75339f 100644 --- a/src/runtime/largefile.c +++ b/src/runtime/largefile.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -60,4 +61,9 @@ lstat_largefile(const char *file_name, struct stat *buf) { return lstat(file_name, buf); } +struct dirent64 * +readdir_largefile(DIR *dir) { + return readdir(dir); +} + #endif diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index a3d6f33..6b01a47 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -1403,7 +1403,7 @@ ;;; program-error from bad lambda-list keyword (assert (eq :ok - (handler-case + (handler-case (funcall (lambda (&whole x) (list &whole x))) (program-error () diff --git a/tests/run-program.impure.lisp b/tests/run-program.impure.lisp index a9d3632..644bc2b 100644 --- a/tests/run-program.impure.lisp +++ b/tests/run-program.impure.lisp @@ -54,10 +54,10 @@ (defparameter *cat-out* (make-synonym-stream '*cat-out-pipe*)) (with-test (:name :run-program-cat-2) - (let ((cat (run-program "/bin/cat" nil :input *cat-in* :output *cat-out* + (let ((cat (run-program "/bin/cat" nil :input *cat-in* :output *cat-out* :wait nil))) - (dolist (test '("This is a test!" - "This is another test!" + (dolist (test '("This is a test!" + "This is another test!" "This is the last test....")) (write-line test *cat-in*) (assert (equal test (read-line *cat-out*)))) @@ -65,7 +65,7 @@ ;;; The above test used to use ed, but there were buffering issues: on some platforms ;;; buffering of stdin and stdout depends on their TTYness, and ed isn't sufficiently -;;; agressive about flushing them. So, here's another test using :PTY. +;;; agressive about flushing them. So, here's another test using :PTY. (defparameter *tmpfile* "run-program-ed-test.tmp") @@ -97,7 +97,7 @@ *ed*) (unwind-protect - (with-test (:name :run-program-ed) + (with-test (:name :run-program-ed) (assert-ed nil "4") (assert-ed ".s/bar/baz/g" "") (assert-ed "w" "4") diff --git a/version.lisp-expr b/version.lisp-expr index 1154bac..3391f43 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; 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.0.15" +"1.0.0.16" -- 1.7.10.4