System.Environment.withProgName strips everything before the last slash
The documentation for
withProgName name act - while executing action act, have getProgName return name.
% 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 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. :-(