-
Notifications
You must be signed in to change notification settings - Fork 689
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 check flag names #4687
cabal check flag names #4687
Conversation
Do we have |
-- starts with dash | ||
invalidFlagName ('-':_) = True | ||
-- mon ascii letter | ||
invalidFlagName cs = any (\c -> not (isAscii c) && isAlpha c) cs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not warn about any non-ascii flags?
invalidFlagName cs = any (not . isAscii) cs
f7b14f7
to
f8dc46a
Compare
Currently
I.e. ATM it's simpler to disallow leading dash, as you cannot use it with current Let's see what Travis says. |
+1 on that. |
Cabal/doc/developing-packages.rst
Outdated
@@ -2162,7 +2162,8 @@ Configuration Flags | |||
|
|||
Flag section declares a flag which can be used in `conditional blocks`_. | |||
|
|||
A flag section may contain the following fields: | |||
Flag names are case-insensitive and must match ``[a-z0-9_][a-z0-9_-]*`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That limitation only applies to Hackage as a point of distribution, but outside of Hackage developers are free to name their packages, module names and flags and descriptions in a more i18n way.
Here's a perfectly valid .cabal
file including unicode package names and flag names:
name: 無
version: 0
synopsis: The canonical non-package
build-type: Simple
cabal-version: >=1.10
source-repository head
Type: git
Location: https://github.com/hvr/-.git
flag 無
description: 無
library
default-language: Haskell2010
exposed-modules: Ω
if !flag(無)
buildable:False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it to [[:alnum:]_][[:alnum:]_-]*
and add a note about Hackage format.
d79645d
to
9d50707
Compare
This flag name was changed without comment in 6e1ff78. It has caused a few problems: - commercialhaskell/stack#3345 - commercialhaskell/stackage#2755 - commercialhaskell/stackage#2759 - commercialhaskell/stackage#2842 - haskell/cabal#4686 - haskell-hvr#150 Those problems either caused or accelerated some (attempted) changes in Cabal: - haskell/cabal#4654 - haskell/cabal#4687 - haskell/cabal#4696 Those problems also caused a change in Stack: - commercialhaskell/stack#3349 In short: Cabal never had any trouble with this. Stack did. The current master version of Stack can handle flags like this, but no released versions of it can. It's not clear when the next version of Stack will be released. In the meantime, no Stack users can use this package. This commit changes the offending flag to something that Stack can handle. By using a flag that Stack can handle, Stack users can once again use this package, and it can return to Stackage. There are no apparent downsides to using a more compatible flag name.
Related to #4686
Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!