haskell / haskell/cabal

Can't build from short-path aliases on Windows

Open
#7,170 1 comment 0 reactions 0 assignees View on GitHub
platform: windows type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

If you are in a current directory which is a short-path-name on Windows, e.g. `C:\LONGIS~1`, then `cabal new-build` doesn't work.

**To Reproduce**
Steps to reproduce the behavior:

```
c:\>mkdir longish_path
c:\>cd LONGIS~1
c:\LONGIS~1>cabal init
Warning: The package list for 'hackage.haskell.org' is 71 days old.
Run 'cabal update' to get the latest list of available packages.

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Generating CHANGELOG.md...
Generating Main.hs...
Generating longish-path.cabal...

Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.
c:\LONGIS~1>cabal new-build
cabal: No targets given and there is no package in the current directory. Use
the target 'all' for all packages in the project or specify packages or
components by name or location. See 'cabal build --help' for more details on
target options.
```

**Expected behavior**
I expected it to work.

**System information**
- Windows 10

```
c:\LONGIS~1>cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure on Windows 10 using cabal-install 3.2.0.0, following the short-path alias steps in the issue. Trace the cabal new-build path handling for the current directory; done means a package initialized under C:\LONGIS~1 builds successfully instead of reporting that no package exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.