~ chicken-core (chicken-5) 7818de84946260fabbaffbc971ac77583832ce83
commit 7818de84946260fabbaffbc971ac77583832ce83 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Thu Dec 13 20:27:09 2012 +0100 Commit: Mario Domenech Goulart <mario.goulart@gmail.com> CommitDate: Fri Dec 14 13:19:52 2012 -0200 handle case in make-pathname when the directory-argument is #f and the file-argument begins with a path separator (reported by kon) Fixes #959 Signed-off-by: Mario Domenech Goulart <mario.goulart@gmail.com> diff --git a/files.scm b/files.scm index 0b288825..2fc2bbdc 100644 --- a/files.scm +++ b/files.scm @@ -198,7 +198,8 @@ EOF (##sys#check-string ext loc) (string-append dir - (if (and (fx>= (##sys#size file) 1) + (if (and (fx>= (##sys#size dir) 1) + (fx>= (##sys#size file) 1) (*char-pds? (##core#inline "C_subchar" file 0))) (##sys#substring file 1 (##sys#size file)) file) diff --git a/tests/path-tests.scm b/tests/path-tests.scm index 45893485..6b9fc458 100644 --- a/tests/path-tests.scm +++ b/tests/path-tests.scm @@ -79,3 +79,5 @@ (test "x//y/z.q" (make-pathname "x//y/" "z.q")) (test "x\\y/z.q" (make-pathname "x\\y" "z.q")) (test 'error (handle-exceptions _ 'error (make-pathname '(#f) "foo"))) +(test "/x/y/z" (make-pathname #f "/x/y/z")) +(test "/x/y/z" (make-pathname "/x" "/y/z"))Trap