Opened 5 years ago

Closed 5 years ago

#3410 closed bug (fixed)

ghc fails to parse versioned GPL and LGPL license from package configuration

Reported by: int-e Owned by: simonmar
Priority: high Milestone: 6.12.1
Component: Compiler Version: 6.11
Keywords: Cc: aslatter@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I used this shell script to reproduce the problem:

#! /bin/sh

DIR=$(mktemp -d); cd ${DIR}; trap "cd /; rm -r ${DIR}" EXIT

echo "[]" > P
ghc-pkg -f P register - > /dev/null <<EOF
name: dummy-gpl
license: GPL
EOF
ghc-pkg -f P register - > /dev/null <<EOF
name: dummy-lgpl
license: LGPL-3
EOF
ghc -package-conf P -e 'putStrLn "success"' || echo fail

which fails like this:

ghc-stage2: P:1:163: parse error on input `Nothing'
fail

It turns out that ghc-pkg uses Cabal's code to manipulate the package configuration, while ghc comes with its own parser in ParsePkgConf.y - possible reasons include: historic reasons, better error messages, better performance.

See also this recent thread: http://www.haskell.org/pipermail/glasgow-haskell-users/2009-July/017600.html

Attachments (2)

ghc-tweak-ParsePkgConf.dpatch (27.7 KB) - added by int-e 5 years ago.
Fix: Extend ghc's parser to cover versioned licenses.
ghc-rewrite-ParsePkgConf.dpatch (34.0 KB) - added by int-e 5 years ago.
Alternative fix: Use Cabal's Read instance for InstalledPackageInfo_ for parsing package configurations in ghc as well. Upside: Less code. Downsides: The code is slower (I don't have hard numbers for that) and it breaks T1969 (but that's expected - the package.conf file there needs to be updated to reflect the new format)

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by int-e

Fix: Extend ghc's parser to cover versioned licenses.

Changed 5 years ago by int-e

Alternative fix: Use Cabal's Read instance for InstalledPackageInfo_ for parsing package configurations in ghc as well. Upside: Less code. Downsides: The code is slower (I don't have hard numbers for that) and it breaks T1969 (but that's expected - the package.conf file there needs to be updated to reflect the new format)

comment:1 Changed 5 years ago by guest

  • Cc aslatter@… added

comment:2 Changed 5 years ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 6.12.1
  • Owner set to simonmar
  • Priority changed from normal to high

The binary package DB (#593) will fix this. I have it working, but it's in the queue to be pushed after some other changes to the package system, so I can't push it right away.

comment:3 Changed 5 years ago by simonmar

Fixed

Fri Sep 11 04:49:28 PDT 2009  Simon Marlow <marlowsd@gmail.com>
  * Remove the old package.conf parser, use read instead (fixed #3410)

comment:4 Changed 5 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.