[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] make-pathname bugfix
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] make-pathname bugfix |
Date: |
Thu, 13 Dec 2012 20:32:14 +0100 (CET) |
The attached patch is an attempt to fix #959, reported by Kon:
"make-pathname" incorrectly removes the pathname separator in
a case like this:
(make-pathname #f "/usr/local/foo")
cheers,
felix
>From bf20c4848f3cee8ae82b46ada50f75ad538f9d9e Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Thu, 13 Dec 2012 20:27:09 +0100
Subject: [PATCH] handle case in make-pathname when the directory-argument is #f
and the file-argument begins with a path separator (reported by kon)
---
files.scm | 3 ++-
tests/path-tests.scm | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/files.scm b/files.scm
index 0b28882..2fc2bbd 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 4589348..6b9fc45 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"))
--
1.7.0.4
- [Chicken-hackers] [PATCH] make-pathname bugfix,
Felix <=