scsh-hackers
[Top] [All Lists]

[Scsh-hackers] [ scsh-Bugs-885631 ] resolve-file-name removes trailing /

To: noreply@sourceforge.net
Subject: [Scsh-hackers] [ scsh-Bugs-885631 ] resolve-file-name removes trailing /
From: "SourceForge.net" <noreply@sourceforge.net>
Date: Fri Jan 30 09:49:11 2004
List-id: Discussion among the implementors <scsh-hackers.lists.sourceforge.net>
Sender: scsh-hackers-admin@lists.sourceforge.net
Bugs item #885631, was opened at 2004-01-27 17:45
Message generated for change (Comment added) made by mainzelm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110493&aid=885631&group_id=10493

Category: run-time
Group: None
>Status: Pending
>Resolution: Later
Priority: 5
Submitted By: Schoinobates Volans (schoinobates)
>Assigned to: Olin Shivers (olin-shivers)
Summary: resolve-file-name removes trailing /

Initial Comment:
resolve-file-name removes a trailing slash, if present, but this is not 
documented.

I think that it is the wrong behaviour anyway, i.e. that it shouldn't remove 
trailing slashes.

This, in turn, creates bugs in functions that use resolve-file-name but put 
some semantics in a trailing slash, like for example the library path stuff: A 
trailing slash in SCSH_LIB_DIRS gets ignored, instead of enabling recursive 
search. If you decide to keep the current resolve-file-name behaviour, please 
fix these places. You'll probably want to give users a function that does 
~-expansion / relative-to-absolute conversion without removing trailing 
slashes, too.


--- scsh-0.6.5.orig/scsh/fname.scm
+++ scsh-0.6.5/scsh/fname.scm
@@ -169,8 +169,7 @@
        fname)))
 
 (define (resolve-file-name fname . maybe-root)
-  (let* ((root (ensure-file-name-is-nondirectory (:optional maybe-root ".")))
-        (fname (ensure-file-name-is-nondirectory fname)))
+  (let* ((root (:optional maybe-root ".")))
     (if (zero? (string-length fname))
        "/"
        (let ((c (string-ref fname 0)))


----------------------------------------------------------------------

>Comment By: Martin Gasbichler (mainzelm)
Date: 2004-01-29 10:01

Message:
Logged In: YES 
user_id=17553

What I really don't understand is the following sentence in the manual from 
which I expected enlightenment:

However, most procedures that expect a directory argument will coerce a 
file-name in directory form to file-name form if it does not have a trailing 
slash.

Now, a trailing slash is exactly the token that  characterizes a "file-name in 
directory form" so what's the proposition of the sentence above?

I guess we really need to know what Olin had in mind before we can clarify 
the manual.

----------------------------------------------------------------------

Comment By: Schoinobates Volans (schoinobates)
Date: 2004-01-27 19:03

Message:
Logged In: YES 
user_id=41822

> So I think the implementation is at least what Olin Shivers had in mind.

I never doubted that :-)

> RESOLVE-FILE-NAME works on file names which do not have trailing slashes, see 
> Section 5.1.1 of the manual.

The terminology is extremely confusing. My understanding of English is that "an 
A in B form" is still an A. And that when you say "An A", it can be in B form 
or in another form. Here, the other form has no name and is referred to as just 
"an A". But maybe it is just my udnerstanding of English that's warped.

The text itself uses "file-name form" to disambiguate. It would be clearer if 
"a file-name form" would be defined to be what now "a file-name" is. And use 
"file-name" for "either file-name form or directory form" and "file-name form" 
for what is now "file-name".

<hair splitting mode>

The documentation says:

     *  Do ~ expansion.

This doesn't say that it outputs a file-name

    * If dir is given, convert a relative file-name to an absolute file-name, 
relative to directory dir.

This says that, if given a relative file-name, it outputs an absolute 
file-name. It doesn't say what it does to a file-name in directory form...

----------------------------------------------------------------------

Comment By: Martin Gasbichler (mainzelm)
Date: 2004-01-27 18:15

Message:
Logged In: YES 
user_id=17553

RESOLVE-FILE-NAME works on file names which do not have trailing 
slashes, see Section 5.1.1 of the manual. So I think the implementation is 
at least what Olin Shivers had in mind. However, I agree that the behaviour 
is not very intuitive and I ran into this problem by myself as you can see in 
the library search code. However, I fixed this a couple of weeks ago in 
CVS.

--
Martin


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110493&aid=885631&group_id=10493


<Prev in Thread] Current Thread [Next in Thread>