[Issue 23794] New: Remove std.path.expandTilde
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 18 20:06:50 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23794
Issue ID: 23794
Summary: Remove std.path.expandTilde
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: witold.baryluk+d at gmail.com
Initially, I was thinking: std.path.expandTilde should use HOME env var, not
getpwnam_r
This is how most tools use it. Including bash, zsh. Programming languages
should not even care.
But that is only when using "~".
If one does "~john" a user database needs to be queried.
Using `getpwnam_r` is not just inconsistent with other tools, it also causes
now to link to getpwnam_r, which requires dynamic linking, because it pull
entire glibc NSS and PAM machinery, preventing static linking.
I would even say more. Remove expandTilde completely from Phobos.
It does not solve anything. When you for example run a binary from bash with
tilde, tilde is expanded by bash itself before full path (without tilde) is
passed to the binary. Thus supporting tilde rather moot. If one puts a file
with tilde into something like a config file (and is read directly by D
program), that STILL requires a code to handle this specially, by actually
calling expandTilde.
Please remove std.path.expandTilde.
If somebody wants to write the shell itself in D (where supporting ~ would be
useful), it should be done in the shell code itself, not standard library.
--
More information about the Digitalmars-d-bugs
mailing list