Ticket #4037 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

ghc/ghc-6.12.1 interacts strangely with quoted command line parameters

Reported by: guest Owned by:
Priority: low Milestone: 7.0.1
Component: Compiler Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

pkgver.hs:

{-# LANGUAGE CPP #-}
main = print PACKAGE_VERSION

PACKAGE_VERSION is expected to be a quoted string.

c:\Sources>ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1

c:\Sources>ghc --make -DPACKAGE_VERSION=\"2.4.1\" pkgver.hs -fforce-recomp
[1 of 1] Compiling Main             ( pkgver.hs, pkgver.o )
Linking pkgver.exe ...

c:\Sources>ghc-6.10.4.exe --make -DPACKAGE_VERSION=\"2.4.1\" pkgver.hs -fforce-recomp
[1 of 1] Compiling Main             ( pkgver.hs, pkgver.o )

pkgver.hs:2:7:
    Couldn't match expected type `b -> c' against inferred type `IO ()'
    In the first argument of `(.)', namely `print 2.4'
    In the expression: print 2.4 . 1
    In the definition of `main': main = print 2.4 . 1

c:\Sources>ghc-6.12.1.exe --make -DPACKAGE_VERSION=\"2.4.1\" pkgver.hs -fforce-recomp
[1 of 1] Compiling Main             ( pkgver.hs, pkgver.o )

pkgver.hs:2:7:
    Couldn't match expected type `b -> c' against inferred type `IO ()'
    In the first argument of `(.)', namely `print 2.4'
    In the expression: print 2.4 . 1
    In the definition of `main': main = print 2.4 . 1

Issue seen in the wild thanks to cabal -w flag. Building darcs with "cabal install darcs-2.4 -w ghc-6.10.4.exe" fails.

Affected 6.10.4 and 6.12.1. More info here:  http://bugs.darcs.net/issue1824

Attachments

Change History

Changed 3 years ago by guest

Attached patch escapes quotes in command line args passed between ghc-X.Y.Z.exe and ghc.exe.

Changed 3 years ago by igloo

  • description modified (diff)

Changed 3 years ago by igloo

  • status changed from new to patch
  • milestone set to 6.12.3

Thanks for the patch! We'll take a look.

Changed 3 years ago by guest

Also in 6.12.1 the wrapper end up with name "ghc-6.12.1" instead of "ghc-6.12.1.exe". That makes it unusable under Windows.

Changed 3 years ago by guest

Since I was at it I completely rewrote wrapper to support Unicode, properly handle command line arguments the Windows way and made it look for real ghc in its own directory only. I hope you like it!

Changed 3 years ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

Changed 3 years ago by igloo

  • status changed from patch to closed
  • resolution set to fixed

Thanks for the report; I've changed it so that our shared C-wrapper code is used for the ghc-$version wrapper, so arguments are now passed correctly.

Note: See TracTickets for help on using tickets.