Cabal: `cabal init` fails if folder name exists on hackage

Created on 12 Sep 2019  路  3Comments  路  Source: haskell/cabal

Describe the bug

If cabal init is run inside a folder that has the same name as a package on hackage, cabal throws an error: Error: no package name provided.

To Reproduce

mkdir lens
cd lens
cabal init

This also happens for a hidden folder (.lens).

It does not happen if the folder name does not exist on hackage:

mkdir doesnotexistonhackage
cd doesnotexistonhackage
cabal init

Expected behavior
I would except cabal to at least give a more precise error message or better proceed with only a warning.

System information

  • cabal-install version 3.0.0.0

Most helpful comment

This appears to be a regression; previously cabal init would complain to you about this during the interactive questionnaire:

This package name is already used by another package on hackage. Do you want to choose a different name? [default: y] 

All 3 comments

I second this. I just got this error as well and it's very confusing and gives no indication of what is actually going on

I was just bit by this one and if I hadn't found the issue googling it could have wasted a bit of time.

This appears to be a regression; previously cabal init would complain to you about this during the interactive questionnaire:

This package name is already used by another package on hackage. Do you want to choose a different name? [default: y] 
Was this page helpful?
0 / 5 - 0 ratings