[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Bug in MD5 egg?
From: |
felix |
Subject: |
Re: [Chicken-users] Bug in MD5 egg? |
Date: |
Fri, 11 Jun 2004 07:36:28 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 |
Alejandro Forero Cuervo wrote:
Hi.
Sometimes, when calculating a MD5 sum in a big directory with
lots of files, I get a stack overflow error. I modified my code
to contain only tail recursive calls but it didn't help so I
suspect the MD5 egg might have a bug. I took a quick peek at the
code of the MD5 egg and couldn't find the problem.
The following code *sometimes* triggers the error:
(require 'md5)
(let loop ((f (remove directory? (directory "."))))
(if (not (null? f))
(let ((in (open-input-file (car f))))
(format #t "~A: ~A~%" (car f) (md5:digest in))
(close-input-port in)
(loop (cdr f)))))
Can anyone please try this in a big directory with lots of files
(in my case it is a directory with 3600 files totaling 47m) and
confirm the error? Please do run it a few (10?) times in
different csi processes, as, strangely, the error doesn't always
occur.
Oh, if you have a fairly recent Chicken, try to invoke the
compiler with
-disable-stack-overflow-checks
This disables the checks, alternatively run the executable
(or csi, whatever you use here) with `-:o'.
From what I see in the generated compiler output of md5.scm,
the only place where a stack-overflow check occurs is in
md5:update, which couldn't really be triggered, unless
the code calling md5:digest already has built up a large stack.
What is the default nursery size on your system? (run csi
and enter ",r", or look at the value of
C_DEFAULT_TARGET_STACK_SIZE in the generated c_defaults.h
in the Chicken build directory).
cheers,
felix