'rts' package loading (Re: Validate fails)

Claus Reinke claus.reinke at talk21.com
Tue May 20 09:09:50 EDT 2008


> I hacked ghci024 to work, by having GHCi sort the output of :show packages, 
> and fixing ghci024.py to match.  Please shout if I've done something bogus.

it would be easy enough to put 'rts' at the right place without
sorting everything but, as i said, the bogus thing is that 'rts' is 
not quite like the other packages (it is never loaded, it just
secretly appears as if it had been loaded):

$ ../ghc-6.9.20080514/bin/ghcii.sh -package ghc
GHCi, version 6.9.20080514: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.1 ... linking ... done.
Loading package containers-0.1 ... linking ... done.
Loading package filepath-1.1 ... linking ... done.
Loading package old-locale-1.0 ... linking ... done.
Loading package old-time-1.0 ... linking ... done.
Loading package directory-1.0 ... linking ... done.
Loading package hpc-0.5 ... linking ... done.
Loading package bytestring-0.9 ... linking ... done.
Loading package packedstring-0.1 ... linking ... done.
Loading package pretty-1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package Win32-2.1 ... linking ... done.
Loading package process-1.0 ... linking ... done.
Loading package Cabal-1.5.1 ... linking ... done.
Loading package random-1.0 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package ghc-6.9.20080514 ... linking ... done.
Prelude> :show packages
active package flags:
  -package ghc
packages currently loaded:
  ghc-6.9.20080514
  haskell98
  random-1.0
  Cabal-1.5.1
  process-1.0
  Win32-2.1
  template-haskell
  pretty-1.0
  packedstring-0.1
  bytestring-0.9
  hpc-0.5
  directory-1.0
  old-time-1.0
  old-locale-1.0
  filepath-1.1
  containers-0.1
  array-0.1
  base
  rts
  integer
  ghc-prim
Prelude> :show linker
----- Linker state -----
Pkgs: [ghc-6.9.20080514, haskell98, random-1.0, Cabal-1.5.1, process-1.0,
       Win32-2.1, template-haskell, pretty-1.0, packedstring-0.1, bytestring-0.9,
       hpc-0.5, directory-1.0, old-time-1.0, old-locale-1.0, filepath-1.1,
       containers-0.1, array-0.1, base, integer, ghc-prim, rts]
Objs: []
BCOs: []

if loading of 'rts' was reported the same way as for any other
package, both this inconsistency and the test issue would disappear.
this would be the real fix, i think.

the workaround i had in mind would simply add 'rts' relative to
'base' rather than at the end, changing only the test:

$ darcs diff -u tests/ghc-regress/ghci/scripts/ghci024.py
--- old-testsuite-1/tests/ghc-regress/ghci/scripts/ghci024.py   2008-05-20 14:00:42.453125000 +0100
+++ new-testsuite/tests/ghc-regress/ghci/scripts/ghci024.py     2008-05-20 14:00:42.484375000 +0100
@@ -14,9 +14,11 @@
   packagelist = []
   for l in packages.splitlines():
     if re.match('^Loading package',l):
-      packagelist += [re.sub(r'^Loading package (\S*) .*$',r'\1',l)]
+      package = re.sub(r'^Loading package (\S*) .*$',r'\1',l)
+      if re.match('^base',package):
+        packagelist += ['rts']
+      packagelist += [package]
   packagelist.reverse()
-  packagelist += ['rts']

   if config.unregisterised :
     mangling = 'no-'
@@ -229,9 +231,9 @@
 active package flags: none
 packages currently loaded:
   base
+  rts
   integer
   ghc-prim
-  rts
 -- :set -package ghc
 active package flags:
   -package ghc


inserting the 'rts' where it is expected seems easier than putting it
at the end, then sorting the whole list in the test and in ghci. not 
sure whether any useful information is lost by sorting (i found it
mildly interesting that the package "list" is really a stack, or that
'rts' appears in different positions in ':show packages' and ':show 
linker'), so if the 'rts' loading issue can't be fixed, this might do.

claus

>> on ghci024:
>> the issue is that 'rts' is the only package not appearing in the output
>> of 'ghci -package ghc'. originally, the test tacked it on to the 
>> packagelist
>> where it would be expected to appear in the output of ':show packages'.
>> 
>> now, there are more "internal" packages ('integer','ghc-prim'), and
>> 'rts' would have to be inserted at the right place (after 'base'?) instead
>> of added to the end (packagelist += ['rts']).
>> 
>> it would be better to get rid of the inconsistency, though:
>> either have 'rts' appear in the output of 'ghci -package ghc'
>> or drop 'rts' from the output of ':show packages'.
>> 
>> since the whole idea of having an 'rts' package would seem to have it 
>> behave as closely to other packages as possible, the first option is 
>> probably the one intended?
> 



More information about the Cvs-ghc mailing list