Bug 23794 – Remove std.path.expandTilde

Status
NEW
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-03-18T20:06:50Z
Last change time
2024-12-01T16:41:10Z
Assigned to
No Owner
Creator
Witold Baryluk
Moved to GitHub: phobos#10517 →

Comments

Comment #0 by witold.baryluk+d — 2023-03-18T20:06:50Z
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.
Comment #1 by robert.schadek — 2024-12-01T16:41:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10517 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB