emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: expand-file-name leaves "/../" in expansions at times


From: Chong Yidong
Subject: Re: expand-file-name leaves "/../" in expansions at times
Date: Tue, 17 Apr 2007 10:54:21 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux)

Jason Rumney <address@hidden> writes:

> Chong Yidong wrote:
>>   Convert filename name to absolute, and canonicalize it.
>>
>> All your examples are consistent with this behavior.  The important
>> thing is that DEFAULT-DIRECTORY is only consulted if the filename is
>> relative.
>>   
> But shouldn't the "and canonicalize it" step involve replacing the ../
> with the actual directories they represent?

Hmm, that's true.  It seems that Emacs treats both / and /../ as
semi-independent canonical directories, which is a little
counter-intuitive.

(expand-file-name "/../a")
"/../a"

(expand-file-name "/../../a")
"/a"

On the other hand, I just checked, and this behavior seems to have
been around since at least Emacs 20.  Glancing through the source
code, this behavior seems to be deliberate---something to do with the
"superroot directory".  Maybe someone on this list can elucidate?





reply via email to

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