Ticket #479 (new enhancement)

Opened 4 years ago

Last modified 4 years ago

Enforce build-type Simple

Reported by: SamB Owned by:
Priority: normal Milestone:
Component: Cabal library Version: 1.6.0.1
Severity: normal Keywords:
Cc: Difficulty: easy (<4 hours)
GHC Version: Platform:

Description (last modified by SamB) (diff)

When a package claims to have "build-type Simple", it would be good to enforce that the Setup program actually does what it should. The simplest way to do this would be to enforce that everything after the shabang line exactly match (modulo line-end conventions?) a standard script. (One each for Setup.hs and Setup.lhs.)

Change History

  Changed 4 years ago by SamB

  • description modified (diff)

  Changed 4 years ago by duncan

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

It's not just build-type Simple, the Configure and Make build types are also prescribed, though perhaps the latter should not be.

For build-type Simple we'd require that the Setup.hs contain exactly:

import Distribution.Simple
main = defaultMain

Though to not annoy people perhaps we'd have to allow Setup.lhs. Though people might still get annoyed that they are not allowed #! lines or comments or whatever. Generally there is a great risk of annoying people.

follow-up: ↓ 4   Changed 4 years ago by SamB

Well, that's why I said "after the shabang line".

in reply to: ↑ 3   Changed 4 years ago by duncan

Replying to SamB:

Well, that's why I said "after the shabang line".

If I had my way we'd ban the shebang line too. :-)

  Changed 4 years ago by guest

This has potential for annoying a lot of people. There's quite some variation in the Setup.[l]hs files. Here is a fictional example, a combination of several real Setup.hs scripts:

module Main (main) where

-- I usually compile this with "ghc --make -o setup Setup.hs"

import Distribution.Simple (defaultMain)

main :: IO ()
main = defaultMain

Setup.lhs files usually include a shebang.

Note: See TracTickets for help on using tickets.