From 4abebce5fa79f81cf2636b1c8a4e4290e7120cf0 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 9 May 2011 04:05:50 +0000 Subject: [PATCH] Permit consecutive slashes in Unix namestrings. POSIX sez it's kosher: I don't know any Unix that treats two leading slashes differently, so I won't reject that case. However, maybe the pathname abstraction needs to handle it differently if there are such Unices. --- src/runtime/unxpth.scm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/runtime/unxpth.scm b/src/runtime/unxpth.scm index e5d806494..6e3a55147 100644 --- a/src/runtime/unxpth.scm +++ b/src/runtime/unxpth.scm @@ -78,15 +78,8 @@ USA. (let ((string (car components)) (replace-head (lambda (string) - ;; If STRING has a trailing slash, and it's followed by a - ;; slash, drop the trailing slash to avoid doubling. - (let ((head (string-components string #\/))) - (append (if (and (pair? (cdr components)) - (pair? (cdr head)) - (string-null? (car (last-pair head)))) - (except-last-pair head) - head) - (cdr components)))))) + (append (string-components string #\/) + (cdr components))))) (let ((end (string-length string))) (if (or (= 0 end) (not *expand-directory-prefixes?*)) @@ -118,9 +111,8 @@ USA. directory)) (define (parse-directory-components components) - (if (there-exists? components string-null?) - (error "Directory contains null component:" components)) - (map parse-directory-component components)) + (map parse-directory-component + (delete-matching-items components string-null?))) (define (parse-directory-component component) (if (string=? ".." component) -- 2.25.1