Ticket #438 (new defect)

Opened 4 years ago

Last modified 17 months ago

Cabal should warn or fail if user specifies a bad configuration flag

Reported by: guest Owned by:
Priority: low Milestone:
Component: Cabal library Version: HEAD
Severity: normal Keywords:
Cc: gwern0@…, ezyang@… Difficulty: easy (<4 hours)
GHC Version: 6.10.1 Platform:

Description

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.

Change History

Changed 4 years ago by duncan

Yes.

More generally we should do this for cabal-install, though that means working out exactly which packages the -f flags apply to. Do all the -f flags apply to all packages (at least to those which have the flags)? or just the ones on the command line?

Changed 4 years ago by duncan

  • difficulty changed from normal to easy (<4 hours)

Changed 3 years ago by ezyang

  • cc ezyang@… added

Changed 17 months ago by elga

Note: See TracTickets for help on using tickets.