GNU bug report logs -
#36490
26.1; directory-files-recursively breaks when it encounters a directory named "~"
Previous Next
Reported by: Erik Hahn <erik_hahn <at> gmx.de>
Date: Wed, 3 Jul 2019 18:09:01 UTC
Severity: minor
Tags: confirmed, fixed
Found in version 26.1
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
discussed"?
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
This bug report was last modified 5 years and 315 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.