Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cabal init fails with 'no package name provided' if name is already taken on hackage #7273

Closed
Mistuke opened this issue Feb 6, 2021 · 13 comments · Fixed by #7344
Closed

Comments

@Mistuke
Copy link
Collaborator

Mistuke commented Feb 6, 2021

Describe the bug
When I do cabal init this doesn't prompt me for anything and just dies.

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...
Error: no package name provided.

explicitly specifying interactive mode gets:

Should I generate a simple project with sensible defaults? [default: y] y

Guessing dependencies...

Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Warning: Setup.hs already exists, backing up old version in Setup.hs.save0
Generating CHANGELOG.md...
Warning: CHANGELOG.md already exists, backing up old version in CHANGELOG.md.save0
Error: no package name provided.

and the cabal file is never created. Only

CHANGELOG.md  Main.hs  Setup.hs

To Reproduce
Steps to reproduce the behavior:

$ cabal init

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior
A clear and concise description of what you expected to happen.

System information

  • Operating system: Windows 10 (bash or powershell)
  • cabal, ghc versions: 3.2.0.0 and 8.8.4

Additional context
Add any other context about the problem here.

@fgaz
Copy link
Member

fgaz commented Feb 7, 2021

Does this happen in any directory or just in ones with specific names?

@Mistuke
Copy link
Collaborator Author

Mistuke commented Feb 7, 2021

@fgaz wow.. it's... very interesting... I've tried in a number of directories and they work, but if I create a directory named monarch anywhere... cabal init fails with the error above..

@jhrcek
Copy link
Contributor

jhrcek commented Feb 7, 2021

It's probably because there already is package with the name like that on hackage: http://hackage.haskell.org/package/monarch
I saw issue like that in the past: #6236

@Mistuke
Copy link
Collaborator Author

Mistuke commented Feb 7, 2021

Oh wow, that does sound like the issue indeed

@Mistuke
Copy link
Collaborator Author

Mistuke commented Feb 7, 2021

The fix seems relatively recent. I'll try cabal 3.4 rc5

@emilypi
Copy link
Member

emilypi commented Feb 8, 2021

Yeah, this is the dumb "if the package name already exists, it'll crap out with no reasonable error" workflow. I'm adding this to my work on #7265

@andreasabel
Copy link
Member

andreasabel commented Feb 18, 2021

Please update the title of this issue to something less generic, e.g. "Cabal init fails with 'no package name provided' if name is already taken on hackage".

@emilypi emilypi mentioned this issue Mar 30, 2021
11 tasks
@emilypi emilypi changed the title Cabal init doesn't seem to work Cabal init fails with 'no package name provided' if name is already taken on hackage May 14, 2021
@KristianBalaj
Copy link

This issue is still appearing with cabal 3.4.1.0

I named the directory streaming and the cabal init failed with the error.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 19, 2022

Hi @KristianBalaj,

Hi! It works fine on master branch (to be released as 3.8; I haven't tried with 3.6.2). It asks you whether you want to name the package so anyway and then proceeds fine. Please confirm.

@KristianBalaj
Copy link

@Mikolaj
The following is the behaviour with cabal 3.4.1.0, it does not ask for anything:

image

@Mikolaj
Copy link
Member

Mikolaj commented Jan 20, 2022

@KristianBalaj: thank you for checking. I guess you need to upgrade?

@KristianBalaj
Copy link

Yeah sure, I was just reporting that in that version of cabal it is still an issue.

@Mikolaj
Copy link
Member

Mikolaj commented Jan 20, 2022

Thank you again. I guess you may need (regardless of upgrading) to run cabal init in interactive mode to enable the choice. No needed on the master branch, which is interactive by default now.

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

Successfully merging a pull request may close this issue.

7 participants