Ticket #438 (new defect)
Cabal should warn or fail if user specifies a bad configuration flag
|Reported by:||guest||Owned by:|
|Cc:||gwern0@…, ezyang@…||Difficulty:||easy (<4 hours)|
Let us take the example of Yi.
Yi specifies a flag:
flag ghcAPI Description: Enable linking with GHC API for advanced features. Default: False
The advanced features are nice indeed, and I wish to use them. So I configure thusly:
gwern@craft:33763~/bin/yi>runhaskell Setup configure --user -fghc-api Configuring yi-0.5.3...
(Or perhaps I specify -fghcapi, or -fghc-API. There are a lot of quite reasonable permutations, and I suspect I have made every one of them over the past few months.)
The point is, the flag is *wrong*. Completely wrong. If we turn on --verbose, we notice that
Flags chosen: testing=True, hacking=False, cocoa=False, pango=False, gtk=False, vty=True, ghcapi=False
The user is not going to get what she requested. Worse, the user has no idea! Everything looks dandy! There is not the slightest indication that something bad has happened. Half an hour later when Yi has compiled and installed, any user trying to use the Shim.* modules in their yi.hs is in for an unpleasant surprise.
So the basic point here is: if the user specifies a flag, and the flag doesn't match any flags in the cabal file, *something* is wrong. Either the cabal file is damaged in someway, or the user mistyped. I think an error would be perfectly reasonable here, in the same way that missing fields is a reasonable reason for erroring out; but at a minimum a warning is warranted.