haskell / haskell/cabal

Single-file scripts, invoked by absolute path outside of a package, fail on Windows

Open
#9,357 0 comments 1 reaction 0 assignees View on GitHub
cabal-install: cmd/run platform: windows re: scripts type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Imagine that you have `#!/usr/bin/env cabal` script somewhere outside of a package, say, `C:\Foo.hs`. Now if the current folder is another, completely unrelated Cabal project and you execute `C:\Foo.hs`, it ends up calling `cabal run C:\Foo.hs` and tries to resolve it as component `\Foo.hs` of a package `C` in the current environment, which obviously fails.

Some relevant source code:

https://github.com/haskell/cabal/blob/a260cde00be9d0febd24dae958f7b45484249107/cabal-install/src/Distribution/Client/CmdRun.hs#L307-L331

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.