Skip to content

cabal init fails if folder name exists on hackage #6236

Closed

Description

@menelaos

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

Activity

  1. naglalakk commented on Sep 14, 2019

    @naglalakk

    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

  2. codygman commented on Nov 10, 2019

    @codygman

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

  3. hvr commented on Nov 10, 2019

    @hvr
    Member

    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] 
    
  4. fgaz commented on May 27, 2021

    @fgaz
    Member

    @emilypi #7344 fixes this, right?

  5. reopened this on May 27, 2021
  6. jneira commented on Jul 13, 2021

    @jneira
    Member

    i would close it when the mentioned pr is released

  7. gbaz commented on Jul 13, 2021

    @gbaz
    Collaborator

    As a general practice I would recommend closing tickets when the prs resolving them are merged, not when a cabal with the pr merged is actually released. It makes ticket management much saner.

  8. 4 remaining items

  9. weihsiu commented on Mar 10, 2022

    @weihsiu

    this error is back. using cabal-install version 3.6.2.0

  10. Mikolaj commented on Mar 10, 2022

    @Mikolaj
    Member

    Hi @weihsiu,

    I think we had a wrong milestone set, suggesting the fix has been merged to 3.6.2, while it's slated for 3.8.

    Could you perhaps try with the master branch?

  11. weihsiu commented on Mar 10, 2022

    @weihsiu

    np, i just wanted to report the issue. as long as it will be fixed, i am cool.

  12. rkuprov commented on Mar 11, 2023

    @rkuprov

    The issue is alive as of 2023.03.10

  13. ulysses4ever commented on Mar 11, 2023

    @ulysses4ever
    Collaborator

    @rkuprov what version of cabal are you using?

  14. rkuprov commented on Mar 11, 2023

    @rkuprov

    cabal --version cabal-install version 3.6.2.0 compiled using version 3.6.2.0 of the Cabal library

  15. rkuprov commented on Mar 11, 2023

    @rkuprov

    Had to do the init --interactive and force ignore the warning about the package already present on Hackage.

  16. emilypi commented on Mar 11, 2023

    @emilypi
    Member

    @rkuprov use a version of cabal that was released in the last 2 years and you'll be set.

  17. rkuprov commented on Mar 11, 2023

    @rkuprov

    My bad. I wrongly assumed that GHCup would use everything latest.

  18. ulysses4ever commented on Mar 11, 2023

    @ulysses4ever
    Collaborator

    @rkuprov unfortunately, ghcup has its own notion of recommended release, which it uses to pick default versions, and the lead maintainer @hasufell explicitly refused to bump recommended cabal to 3.8 citing several regressions on 3.8. In my opinion, there were many more bug fixes in that release that justify a handful of regression, but oh well...

  19. hasufell commented on Mar 12, 2023

    @hasufell
    Member

    Correct. GHCup is a distribution channel just like nixpkgs, brew or some ubuntu ppa. As such it has absolute autonomy regarding which versions are recommended.

    To always and only get upstream bindists, you can use a different channel: https://github.com/haskell/ghcup-metadata/blob/develop/ghcup-vanilla-0.0.7.yaml

    In this channel I can make latest and recommended equivalent, but we will close bug reports as WONTFIX if you use that channel.

    Check out the configuration: https://github.com/haskell/ghcup-hs/blob/c20deceaa8189a1f3034335759b84132f9a9ef82/data/config.yaml#L59

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: cmd/initstatus: fixed in mastertype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions