RE: Reading 8bit characters from a socket fails

1999-07-02 Thread Simon Marlow


 rm -f PrelBase.o ; if [ ! -d PrelBase ]; then mkdir PrelBase; 
 else find PrelBase -name '*.o' -print | xargs rm -f __rm_food 
 ; fi ;
 ../../../ghc/driver/ghc -recomp -cpp -fglasgow-exts -fvia-C 
 -Rghc-timing -O -split-objs -odir PrelBase  -H10m 
 -optCrts-M128M -c PrelBase.lhs -o PrelBase.o -osuf o
 make[3]: *** [PrelBase.o] Error 1
 make[2]: *** [all] Error 1
 make[1]: *** [all] Error 1
 make: *** [all] Error 1

This smells like the glibc-2.1 problem.  We've now got a RH 6 machine (Dual
PIII-500 ... mmm, yummy), so I'll take a look at this today.

Cheers,
Simon



Re: Reading 8bit characters from a socket fails

1999-07-02 Thread Michael Weber

On Fri, Jul 02, 1999 at 01:59:25 -0700, Simon Marlow wrote:
  rm -f PrelBase.o ; if [ ! -d PrelBase ]; then mkdir PrelBase; 
  else find PrelBase -name '*.o' -print | xargs rm -f __rm_food 
  ; fi ;
  ../../../ghc/driver/ghc -recomp -cpp -fglasgow-exts -fvia-C 
  -Rghc-timing -O -split-objs -odir PrelBase  -H10m 
  -optCrts-M128M -c PrelBase.lhs -o PrelBase.o -osuf o
  make[3]: *** [PrelBase.o] Error 1
  make[2]: *** [all] Error 1
  make[1]: *** [all] Error 1
  make: *** [all] Error 1
 
 This smells like the glibc-2.1 problem. 

*hmm* if this is a linux system, I'd bet it is a memory
overcommitment/trashing problem. Linux just shot ghc, because there is too
less memory. The original poster said something about 32Megs... IMHO you'll
need 128M++, otherwise the machine gets into serious swapping if you try to
compile 4.04 with 4.04, for example... :-) for older versions, it's
_slightly_ better.

 We've now got a RH 6 machine (Dual PIII-500 ... mmm, yummy), so I'll take a
 look at this today.

Sounds great... did you follow the 'zombie problem' mails of Kirstin and me,
when telling make to do more than one job at a time? The subject was 
"smp and make"...


Cheers,
Michael



RE: Reading 8bit characters from a socket fails

1999-07-02 Thread Simon Marlow

 Sounds great... did you follow the 'zombie problem' mails of 
 Kirstin and me,
 when telling make to do more than one job at a time? The subject was 
 "smp and make"...

Haven't looked into it yet, but it's on my ToDo list...

Simon



Reading 8bit characters from a socket fails

1999-07-01 Thread Marcin 'Qrczak' Kowalczyk

When reading from a socket using hGetLine, 8bit characters cause
fatal error, e.g.:

Fail: Prelude.Enum.toEnum{Char}: out of range: -77

-- 
 __("Marcin Kowalczyk * [EMAIL PROTECTED] http://kki.net.pl/qrczak/
 \__/  GCS/M d- s+:-- a22 C++$ UL++$ P+++ L++$ E-
  ^^W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP-+ t
QRCZAK  5? X- R tv-- b+++ DI D- G+ e h! r--%++ y-



RE: Reading 8bit characters from a socket fails

1999-07-01 Thread Simon Marlow


  When reading from a socket using hGetLine, 8bit characters cause
  fatal error, e.g.:
  
  Fail: Prelude.Enum.toEnum{Char}: out of range: -77
 
 I think I found it. The bug always occurs in NoBuffering mode.
 
 --- ghc/lib/std/cbits/readFile.c.orig Sun Feb  7 23:03:38 1999
 +++ ghc/lib/std/cbits/readFile.c  Thu Jul  1 11:09:54 1999
 @@ -258,7 +258,7 @@
  {
  IOFileObject* fo= (IOFileObject*)ptr;
  int count,rc=0;
 -char c;
 +unsigned char c;
  
  /* Check if someone hasn't zapped us */
  if ( fo == NULL || fo-fd == -1)
 
 I can't check whether it works, because ghc-4.02 does not compile
 for me. Fortunately I can use LineBuffering for my sockets.

Committed, thanks.

What problem are you having getting ghc-4.02 to compile?

Cheers,
Simon



Re: Reading 8bit characters from a socket fails

1999-07-01 Thread Marcin 'Qrczak' Kowalczyk

Thu, 1 Jul 1999 06:15:11 -0700, Simon Marlow [EMAIL PROTECTED] pisze:

 What problem are you having getting ghc-4.02 to compile?

[...]

===fptools== Recursively making `all' in std exts concurrent misc posix ...
PWD = /qrnik2/part/BUILD/fptools/ghc/lib


==fptools== make all --no-print-directory -r;
 in /qrnik2/part/BUILD/fptools/ghc/lib/std

rm -f PrelBase.o ; if [ ! -d PrelBase ]; then mkdir PrelBase; else find PrelBase -name 
'*.o' -print | xargs rm -f __rm_food ; fi ;
../../../ghc/driver/ghc -recomp -cpp -fglasgow-exts -fvia-C -Rghc-timing -O 
-split-objs -odir PrelBase  -H10m -optCrts-M128M -c PrelBase.lhs -o PrelBase.o -osuf o
make[3]: *** [PrelBase.o] Error 1
make[2]: *** [all] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1

../../../ghc/driver/ghc after some work simply exits with status 1.
When I run ghc instead (from $PATH) in this place with those arguments,
it exited with status 0, but did not create PrelBase.o either.

I had to add -optCrts=128M, according to docs, because otherwise it
failed earlier with heap overflow. Thus compiling ghc uses over 70MB
of memory. I have only 32MB of physical memory, so it swaps a lot
and takes about half a day until it fails.

(I also couldn't boot from .hc files, but it was 45 days ago and
I don't remember the details now; maybe I did something wrong.
I could not compile happy, but also I don't remember the details.
Maybe I will try again later.)

-- 
 __("Marcin Kowalczyk * [EMAIL PROTECTED] http://kki.net.pl/qrczak/
 \__/  GCS/M d- s+:-- a22 C++$ UL++$ P+++ L++$ E-
  ^^W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP-+ t
QRCZAK  5? X- R tv-- b+++ DI D- G+ e h! r--%++ y-



Re: Reading 8bit characters from a socket fails

1999-07-01 Thread Marcin 'Qrczak' Kowalczyk

1 Jul 1999 00:00:52 GMT, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze:

 When reading from a socket using hGetLine, 8bit characters cause
 fatal error, e.g.:
 
 Fail: Prelude.Enum.toEnum{Char}: out of range: -77

I think I found it. The bug always occurs in NoBuffering mode.

--- ghc/lib/std/cbits/readFile.c.orig   Sun Feb  7 23:03:38 1999
+++ ghc/lib/std/cbits/readFile.cThu Jul  1 11:09:54 1999
@@ -258,7 +258,7 @@
 {
 IOFileObject* fo= (IOFileObject*)ptr;
 int count,rc=0;
-char c;
+unsigned char c;
 
 /* Check if someone hasn't zapped us */
 if ( fo == NULL || fo-fd == -1)

I can't check whether it works, because ghc-4.02 does not compile
for me. Fortunately I can use LineBuffering for my sockets.

A test program:

import IO
main = do
hSetBuffering stdin NoBuffering
getChar = putChar

It fails when a character with high bit set is entered.

-- 
 __("Marcin Kowalczyk * [EMAIL PROTECTED] http://kki.net.pl/qrczak/
 \__/  GCS/M d- s+:-- a22 C++$ UL++$ P+++ L++$ E-
  ^^W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP-+ t
QRCZAK  5? X- R tv-- b+++ DI D- G+ e h! r--%++ y-