chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Strip all trailing slashes from directory


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Strip all trailing slashes from directory pathname parts
Date: Wed, 5 Jun 2013 23:12:10 +0200
User-agent: Mutt/1.4.2.3i

On Sun, Jun 02, 2013 at 01:02:59AM -0700, Evan Hanson wrote:
> Double argh. Continuing with my strategy of noisily doing development
> *directly on* the mailing list, here's a final version that adjusts the
> behavior of `make-pathname` with a root directory argument.
> 
> OK, I'll shut up now, I swear.

Relax :)  This last patch was again excellent, except for a small typo
in the tests which caused "make check" to fail:

(test "/x/y/z" (make-pathname '("/") "x/y/x"))
should be
(test "/x/y/z" (make-pathname '("/") "x/y/z"))

I've attached an signed-off copy with the test fixed.


While we're at it, should make-pathname take care of leading slashes
as well?

Ie, currently 
(make-pathname "/x" "//y/z") => "/x//y/z" and
(make-pathname '("/x" "//y//" "z") #f) => "/x///y/z/"

but should it be
(make-pathname "/x" "//y/z") => "/x/y/z" and
(make-pathname '("/x" "//y//" "z") #f) => "/x/y/z/"?

There's also the case of embedded slashes, like:

(make-pathname "/x" "//y//z") => "/x/y/z" ;; currently "/x//y//z"
(make-pathname '("/x" "//y//z") #f) => "/x/y/z" ;; currently "/x///y//z/"

I'm not sure it's worth attempting to try and take care
of every possible path fuckup, though.  The current chopping
of trailing slashes should take care of the worst cases, I think.

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Strip-all-trailing-slashes-from-directory-pathname-p.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]