[Hackage] #438: Cabal should warn or fail if user specifies a bad configuration flag

Hackage trac at galois.com
Tue Dec 23 23:29:31 EST 2008

#438: Cabal should warn or fail if user specifies a bad configuration flag
  Reporter:  guest          |        Owner:        
      Type:  defect         |       Status:  new   
  Priority:  low            |    Milestone:        
 Component:  Cabal library  |      Version:  HEAD  
  Severity:  normal         |     Keywords:        
Difficulty:  normal         |   Ghcversion:  6.10.1
  Platform:                 |  
 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 at 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.

Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/438>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects

More information about the cabal-devel mailing list