Problems with System.getEnv when compiling with "-T"

Dear nhc team, when accessing environment variables in a program compiled for tracing, the resulting strings always seem a little bit "too short". Consider the following program "Moo.hs": | import System | main = do host <- getEnv "HOST" | print host When compiled without option "-T", it outputs on my system as expected /tmp> hmake Moo nhc98 -c -o Moo.o Moo.hs nhc98 -o Moo Moo.o /tmp> ./Moo "nakalele" /tmp> whereas, when compiled with "-T", I get: /tmp> hmake -T Moo nhc98 -T -c -o Moo.T.o Moo.hs nhc98 -T -o Moo Moo.T.o /tmp> ./Moo "nakalel" /tmp> This is nhc98-1.12 by the way built from the source distribution on a Suse Linux PC. /tmp> uname -a Linux nakalele 2.2.19 #7 SMP Wed May 23 15:25:41 CEST 2001 i686 unknown Cheers, Matthias -- Matthias Neubauer | Universität Freiburg, Institut für Informatik | tel +49 761 203 8060 Georges-Köhler-Allee 79, 79110 Freiburg i. Br., Germany | fax +49 761 203 8242

Matthias Neubauer
when accessing environment variables in a program compiled for tracing, the resulting strings always seem a little bit "too short".
Thanks for the fine bug report. Here is a one-line patch to fix it. The patch is also now available on the nhc98 web/FTP site. After applying the patch, you should just need to `make traceruntime' and re-install. Regards, Malcolm Index: src/hat/runtime/getconstr.c =================================================================== RCS file: /usr/src/master/nhc/src/hat/runtime/getconstr.c,v retrieving revision 1.13 diff -u -r1.13 getconstr.c --- src/hat/runtime/getconstr.c 2001/11/02 14:59:08 1.13 +++ src/hat/runtime/getconstr.c 2002/04/17 15:04:07 @@ -16,7 +16,7 @@ NodePtr np; char *sp; - for (sp = s; *sp != '\0'; sp++); + for (sp = s; *sp++ != '\0';); np = mkNil(); for (; --sp >= s;) np = mkCons(mkChar(*sp), np);
participants (2)
-
Malcolm Wallace
-
Matthias Neubauer