-
Notifications
You must be signed in to change notification settings - Fork 697
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 prints error message forever when using invalid license #6619
Conversation
When choosing non adequate license error message is printed in a loop
Hey @v0d1ch, thanks for taking a look at this (and sorry for the delay)! With your change what's the behaviour if init is run in interactive mode without a license being specified from the CLI? The current behaviour is it will re-prompt if you don't select a valid choice, for example:
Agreed that hiding the parse error message and showing something more user friendly is out of scope here, it would require changing the command line argument parsing in |
- Always ask for SPDX expression, we can "convert" them to old format - No default license - cabal-version is asked using CabalSpecVersion type - seems to fix what haskell#6619 tries to fix: ``` % /code/shared-haskell/cabal/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-install-3.3.0.0/x/cabal/build/cabal/cabal init -l 'FOO AND BAR' Cannot parse license: FOO AND BAR CallStack (from HasCallStack): error, called at ./Distribution/ReadE.hs:42:24 in Cabal-3.3.0.0-inplace:Distribution.ReadE ``` an error, but it doesn't loop.
- Always ask for SPDX expression, we can "convert" them to old format - No default license - cabal-version is asked using CabalSpecVersion type - seems to fix what haskell#6619 tries to fix: ``` % /code/shared-haskell/cabal/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-install-3.3.0.0/x/cabal/build/cabal/cabal init -l 'FOO AND BAR' Cannot parse license: FOO AND BAR CallStack (from HasCallStack): error, called at ./Distribution/ReadE.hs:42:24 in Cabal-3.3.0.0-inplace:Distribution.ReadE ``` an error, but it doesn't loop.
- Always ask for SPDX expression, we can "convert" them to old format - No default license - Add cabal-version: 3.0 to the list - cabal-version is asked using CabalSpecVersion type - seems to fix what haskell#6619 tries to fix: ``` % /code/shared-haskell/cabal/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-install-3.3.0.0/x/cabal/build/cabal/cabal init -l 'FOO AND BAR' Cannot parse license: FOO AND BAR CallStack (from HasCallStack): error, called at ./Distribution/ReadE.hs:42:24 in Cabal-3.3.0.0-inplace:Distribution.ReadE ``` an error, but it doesn't loop.
I think #6661 fixes the looping issue as a side-effect. The command line parser doesn't produce an |
- Always ask for SPDX expression, we can "convert" them to old format - No default license - Add cabal-version: 3.0 to the list - cabal-version is asked using CabalSpecVersion type - seems to fix what haskell#6619 tries to fix: ``` % /code/shared-haskell/cabal/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-install-3.3.0.0/x/cabal/build/cabal/cabal init -l 'FOO AND BAR' Cannot parse license: FOO AND BAR CallStack (from HasCallStack): error, called at ./Distribution/ReadE.hs:42:24 in Cabal-3.3.0.0-inplace:Distribution.ReadE ``` an error, but it doesn't loop.
- Always ask for SPDX expression, we can "convert" them to old format - No default license - Add cabal-version: 3.0 to the list - cabal-version is asked using CabalSpecVersion type - seems to fix what haskell#6619 tries to fix: ``` % /code/shared-haskell/cabal/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-install-3.3.0.0/x/cabal/build/cabal/cabal init -l 'FOO AND BAR' Cannot parse license: FOO AND BAR CallStack (from HasCallStack): error, called at ./Distribution/ReadE.hs:42:24 in Cabal-3.3.0.0-inplace:Distribution.ReadE ``` an error, but it doesn't loop.
fixes #6227
When choosing non adequate license error message is printed in a loop.
I fixed that behavior and now we get something like this:
The issue where the user sees the exception on failed parsing is still there:
I don't know if we want to prevent this from happening.
In my mind users should't see these kinds of exceptions but maybe it should be a separate issue.