Skip to content

Can't build from short-path aliases on Windows #7170

Open

Description

@ndmitchell

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

Activity

  1. jneira commented on Sep 17, 2021

    @jneira
    Member

    Reproduced with cabal-3.6.0.0, increase verbosity does not help:

    D:\ws\haskell\REALLY~1>cabal build -v3
    File monitor 'config' changed: first run
    Project settings changed, reconfiguring...
    creating D:\ws\haskell\REALLY~1\dist-newstyle
    creating D:\ws\haskell\REALLY~1\dist-newstyle\cache
    this build was affected by the following (project) config files:
    
    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.
    

    From https://ss64.com/nt/syntax-filenames.html

    Prior to Windows 95 in 1995, Windows only supported short 8.3 filenames.

    Microsoft disabled the generation of short filenames (8.3) by default starting with Windows 8 / Server 2012. If they exist you can use the parameter extensions %~sp1 to expand %1 to return an 8.3 pathname.

    In any directory containing more than 25,000 files there is a significant performance cost ~ 6,000 files per hour vs 2 million files per hour.

    @ndmitchell did you test is in a windows machine with windows 7 or older? or did you enable shortened paths on purpose to avoid long path problems?
    imho if it only affects old windows versions this could not have a high priority as you can enable long path support in newer windows versions (a better option than enable shortened paths)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions