Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12377
Closed
Open
Created Jul 10, 2016 by oherrala@trac-oherrala

getExecutablePath doesn't return absolute path on OpenBSD (and maybe other OS also)

System.Environment.getExecutablePath doesn't return absolute path to executable in OpenBSD. This happens because getExecutablePath uses argv[0] to determine path and argv[0] might not be absolute path.

My environment:

$ uname -a
OpenBSD fizbuz.pilkki.ciz.fi 6.0 GENERIC.MP#2274 amd64
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.10.3

This test program in OpenBSD:

module Main where
import System.Environment
main = getExecutablePath >>= print

returns

$ ./test
"./test"

For example in OS X the call returns absolute path:

$ ./test
"/Users/oherrala/tmp/test"

OpenBSD is one of the operating systems which gets fall back to using argv[0] to determine exec's location:

https://git.haskell.org/ghc.git/blob/HEAD:/libraries/base/System/Environment/ExecutablePath.hsc\#l152

Maybe the argv[0] result should be wrapped with realpath(3) to get absolute path?

This bug is also present in cabal-install and reported here: https://github.com/haskell/cabal/issues/3512\#issuecomment-231604356

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking