System.Environment.withProgName strips everything before the last slash
The documentation for withProgName
says:
withProgName name act - while executing action act, have getProgName return name.
However:
% ghc -e 'System.Environment.withProgName "Hello / World///." System.Environment.getProgName'
"."
I discovered this while trying to work around bug #3199 (closed) like this:
main = do
exe <- readSymbolicLink "/proc/self/exe"
withProgName exe main'
...
So... I need to re-exec my program. Fortunately, there is argv[0]
containing exactly the information I need. Unfortunately, Haskell doesn't let me access it. Fortunately, Linux provides the full path to my program in a special file and Haskell lets me "fix" the program name at startup. Unfortunately, this functionality is broken: withProgName
only takes the part after the last slash. Back to square one. :-(
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |