GNU bug report logs -
#7617
24.0.50; `expand-file-name': removal of slashes
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Sat, 11 Dec 2010 21:49:02 UTC
Severity: normal
Found in version 24.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #80 received at 7617 <at> debbugs.gnu.org (full text, mbox):
> > And it's not clear what that would mean in terms of the
> > expansion I'm after (which is exactly the expansion of
> > `expand*' minus the slash collapsing).
>
> But after the expansion, wouldn't you remove everything up to and
> including the double slash?
No, not at all. If I wanted to remove the prefix I would use
`substitute-in-file-name'.
> If so, why do you need the expansion, if
> most of it will be thrown away? And if you don't remove the part up
> to the double slash, then why do you need to keep the double slash?
This is raw user input. I want to keep the prefix, if any, as it is (modulo ~
and any other changes `expand*' makes except for slash collapsing). I don't
ever remove the prefix. Emacs (e.g. file-name reading) handles
(ignores/removes) the prefix when the user finally hits RET.
E.g., I want this behavior, with ~ = /home/toto":
(expand-file-name "foo" "~//usr/") -> "/home/toto//usr/foo"
Likewise, if double slashes appear in the first arg I want them preserved. As I
said, "exactly the expansion of `expand*' minus the slash collapsing".
It's OK. I can go with what I have now. And I can keep looking or experiment
with other approaches such as temporarily removing the prefix (if any) and
sewing it back on.
I get the message that I haven't missed some obviously better solution. And I
get the message that the `expand*' behavior will not be changed (including,
e.g., adding an optional arg that inhibits slash collapsing).
Thanks for adding mention of slash collapsing to the doc string. I hope you
will also consider mentioning that a valid file name is expected and anything
else results in undefined behavior. Feel free to close the bug now.
This bug report was last modified 14 years and 158 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.