[Top][All Lists]

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

bug#36490: 26.1; directory-files-recursively breaks when it encounters a

From: Lars Ingebrigtsen
Subject: bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~"
Date: Mon, 08 Jul 2019 23:08:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Actually, the doc string of expand-file-name is either wrong, or the
implementation is.

It says:

An initial ‘~/’ expands to your home directory.
An initial ‘~USER/’ expands to USER’s home directory.

Assuming the "An initial" refers to the first parameter, then

(expand-file-name "~/" "/tmp/")
=> "/home/larsi/"

works as advertised, but

(expand-file-name "~" "/tmp/")
=> "/home/larsi"

is a different thing: "~" is a perfectly valid file name, so having this
function map that to something else is just...  wrong.

(expand-file-name "~larsi" "/tmp/")
=> "/home/larsi"

is the same: Also wrong and undocumented.

The doc string continues with further confusion:

See also the function ‘substitute-in-file-name’.

See it for...  what?  For further expansions this function is going to
do?  Fortunately not:

(expand-file-name "$HOME" "/tmp/")
=> "/tmp/$HOME"

So that's probably just meant as "that's also a function that does file
name stuff, but it has nothing to do with this ~ thing we just

So what to do here?  I think the current, undocumented

(expand-file-name "~" "/tmp/")
=> "/home/larsi"

must surely be an error, and that should be fixed instead of the
callers?  Opinions?

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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