-
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
Restrict flag names to ASCII #4696
Conversation
Oh dear... can you please state the rationale for disallowing Unicode in the .cabal spec, when this is the exact opposite of my agenda? Specifically, what problem does this solve? |
The unicode flag should be specified as @hvr, should one be able to write
what Cabal spec says? |
@hvr: I decided to open this pull request based on #4686 (comment):
@phadej: I didn't know flag names could be quoted. Thanks! I'll see how this branch handles quoted flags with Unicode characters in them. |
Putting the flag name in quotes changes the result, but it still fails for what seems like an unrelated reason:
I don't know; maybe that's the expected output. |
I think we're conflating two things here. There's the .cabal specification, which specifies what a .cabal file supports, and then there's (seemingly arbitrary) restrictions imposed by Hackage, which are policy restrictions. So while Unicode package names aren't allowed on Hackage for usability, portability, and standardisation reasons (since Hackage is our central point of distribution for Cabal users); there's no reason why I shouldn't be able to i18n my executable/package/module/flag names (if you've ever been to German or French software shops, you may know what I mean). And in fact, I've got a couple open unicode-related Cabal issues I still have on my agenda. Here's an example of a
And your suggested change would deny me this. PS: @phadej, yes (in this context) I'd expect to be able to use executables whose names aren't limited to the ASCII subset :-) PS2: Note that the Haskell Report is specified very Unicode-friendly; identifiers (including module names) are deliberately allowed to use more than just the ASCII subset. |
Hmm, it is a good argument against this change. Though I still think that keeping Hackage-accepted and Cabal-accepted formats as close as possible is a desirable goal. |
@23Skidoo Well, it's the same format, Hackage just restricts the allowed charset for interop reasons; it doesn't restrict the format (ok, actually it does restrict the format somewhere else for different reasons, but let's not go there). |
I am suggesting that Cabal and Hackage agree with each other. Either: (a) it's useful to have Unicode flag names, and therefore Hackage should allow them; or (b) it's troublesome to deal with Unicode flag names, and therefore Cabal should disallow them. My preference is for restricting Cabal rather than broadening Hackage, but ultimately I just want them to be the same. Put another way: Either these German/French software shops should be able to release their software as-is on Hackage or they should have to use ASCII for compatibility's sake. And to support my ASCII viewpoint: Do you want to allow flag names like |
@tfausak if you give me such a false dilemma, I'd go with (a) PS: Note that I don't agree to either (a) nor (b) because I consider this a false dilemma. |
Great! How can I propose changing Hackage to allow flag names with Unicode characters? |
@tfausak it's a little known fact, but Hackage already allows it; the point of the recently introduced flag warning was to discourage this before somebody noticed (the main goal of |
I'm confused now.
Why does |
I think that what @hvr meant is that Hackage will stop doing that once the production server has been rebuilt against a version of Cabal that includes that check. |
So we discussed this with @hvr a bit more and decided that it could be useful to have a |
I can't say I'm a fan of strictness pragmas, but if that's the only way forward here then so be it. |
I am interested in seeing the spec/idea, but at this point I don't think strictness pragmatic are the right solution. |
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.
This pull request restricts flag names to ASCII (see #4686). It's not done yet, though. I have a few issues with it:
ReadP
-based parser and aParsec
-based parser. Having both seems like a good way for them to get out of sync with each other. I don't know enough about Haskell's parsers to be able to combine them.For an example of the second point, consider this Cabal file:
It build successfully even though I expected it to fail to parse.
For an example of the third point, consider this Cabal file:
It fails, but the error isn't quite what I expected:
I am not familiar enough with Cabal's code base to quickly diagnose these problems. I'd appreciate some help sorting them out.