[Hackage] #389: ld-options not properly escaped when passing them to ghc

Hackage trac at galois.com
Mon Nov 3 09:38:31 EST 2008


#389: ld-options not properly escaped when passing them to ghc
----------------------------------+-----------------------------------------
  Reporter:  duncan               |        Owner:           
      Type:  defect               |       Status:  new      
  Priority:  normal               |    Milestone:  Cabal-1.6
 Component:  Cabal library        |      Version:  1.0      
  Severity:  normal               |     Keywords:           
Difficulty:  very easy (<1 hour)  |   Ghcversion:  6.8.3    
  Platform:                       |  
----------------------------------+-----------------------------------------
 In constructing the `ghc` command line, the `ldOptions` are passed
 directly to `ghc` without any escaping. Obviously they should be escaped
 with the `-optl` prefix.

 This bug has been in Cabal since support for ld options was introduced in
 version 0.4, which was released in January 2005. We got away with it for
 nearly four years because ghc understands most common ld options like
 `-lfoo` or `-Lbar`.

 It cropped up because recent versions of `libcurl` (at least in Ubuntu
 Intrepid) supply a `pkg-config` file which instructs clients to use `-Wl
 ,-Bsymbolic-functions` when linking to `libcurl`. Obviously this is not a
 flag that ghc understands. The bug manifests itself as:
 {{{
 ghc-6.8.3: unrecognised flags: -Wl,-Bsymbolic-functions
 }}}

 The fix is of course trivial:
 {{{
 -    ++ ldOptions bi
 +    ++ ["-optl" ++ opt | opt <- ldOptions bi]
 }}}

 Thanks to kowey for discovering it and helping diagnose the source of the
 problem. It'll be fixed in Cabal-1.6.0.2.

 I thought I'd document it here partly because it's interesting to find
 such a bug that went undiscovered for so long.

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


More information about the cabal-devel mailing list