symbols incorrectly GC'ed

Bug #308348 reported by Andreas Rottmann
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
High
Abdulaziz Ghuloum

Bug Description

I'm not sure whether this is a bug in Ikarus, or the xitomatl srfi's or lack of my understanding of R6RS libraries, but I encountered this strange behavior (sorry for the non-minimal example, but the code beyond the SRFIs is basically just aliasing 2 of this SRFIs under a different name, and one providing a naive implementation of define-values):

~$ mkdir bug-p && cd bug-p
~/bug-p$ mkdir xitomatl && cd xitomatl
~/bug-p/xitomatl$ bzr branch lp:~ikarus-libraries-team/ikarus-libraries/srfi
[...]
~/bug-p$ wget http://rottyforge.yi.org/~rotty/tmp/spells-ik-bug.tar.gz # tarball is also attached to the bug report
~/bug-p$ tar -xzf spells-ik-bug.tar.gz
~/bug-p$ cat problem.sps
(import (spells define-values) (spells char-set) (spells strings))
~/bug-p$ ikarus --r6rs-script problem.sps # Note this doesn't give any error message
~/bug-p$ cd ..
~$ export IKARUS_LIBRARY_PATH=`pwd`/bug-p
~$ ikarus --r6rs-script bug-p/problem.sps # I'd expect this to behave in exactly the same way as above, but:
Unhandled exception:
 Condition components:
   1. &who: check-substring-spec
   2. &message: "unbound identifier"
   3. &undefined
   4. &trace: #<syntax check-substring-spec>

Related branches

Revision history for this message
Andreas Rottmann (rotty) wrote :
Revision history for this message
Derick Eddington (derick-eddington) wrote : Re: [Bug 308348] [NEW] Strange problem with "aliasing" libraries

With 32-bit revision 1719, I get something different:

[d@eep:~/bug-p]-> ikarus --r6rs-script problem.sps
Unhandled exception:
 Condition components:
   1. &who: let-string-start+end
   2. &message: "unbound identifier"
   3. &undefined
   4. &trace: #<syntax let-string-start+end>
[d@eep:~/bug-p]-> cd ../
[d@eep:~]-> export IKARUS_LIBRARY_PATH=`pwd`/bug-p
[d@eep:~]-> ikarus --r6rs-script bug-p/problem.sps
Unhandled exception:
 Condition components:
   1. &who: let-string-start+end
   2. &message: "unbound identifier"
   3. &undefined
   4. &trace: #<syntax let-string-start+end>
[d@eep:~]->

I haven't investigated the SRFIs yet.

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

On Dec 15, 2008, at 9:29 PM, Derick Eddington wrote:

> I haven't investigated the SRFIs yet.

I think this is coming from SRFI-14. I wonder if resolve/include is
doing something funny or if I somehow broke it.

Aziz,,,

Revision history for this message
Derick Eddington (derick-eddington) wrote :

I don't think it has to do with your aliased libraries, because the same
problem happens when the (xitomatl srfi ---) are used directly:

[d@eep:~/bug-p]-> echo $IKARUS_LIBRARY_PATH
/home/d/bug-p
[d@eep:~/bug-p]-> ikarus
Ikarus Scheme version 0.0.3+ (revision 1719, build 2008-12-15)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (import (spells define-values) (xitomatl srfi char-set) (xitomatl srfi strings))
Unhandled exception
 Condition components:
   1. &who: let-string-start+end
   2. &message: "unbound identifier"
   3. &undefined
   4. &trace: #<syntax let-string-start+end>
>

It is strange because both let-string-start+end and check-substring-spec
are from (xitomatl srfi strings), but if I comment-out one of the other
imports, it works:

[d@eep:~/bug-p]-> ikarus
Ikarus Scheme version 0.0.3+ (revision 1719, build 2008-12-15)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (import #;(spells define-values) (xitomatl srfi char-set) (xitomatl srfi strings))
> (string-join '("a" "b" "c") ":")
"a:b:c"
>
[d@eep:~/bug-p]-> ikarus
Ikarus Scheme version 0.0.3+ (revision 1719, build 2008-12-15)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (import (spells define-values) #;(xitomatl srfi char-set) (xitomatl srfi strings))
> (string-join '("a" "b" "c") ":")
"a:b:c"
>
[d@eep:~/bug-p]->

Seems it has something to do with the datum comment in the export clause
of xitomatl/srfi/strings.sls, because deleting it makes the problem go
away:

[d@eep:~/bug-p]-> ikarus
Ikarus Scheme version 0.0.3+ (revision 1719, build 2008-12-15)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (import (spells define-values) (xitomatl srfi char-set) (xitomatl srfi strings))
Unhandled exception
 Condition components:
   1. &who: let-string-start+end
   2. &message: "unbound identifier"
   3. &undefined
   4. &trace: #<syntax let-string-start+end>
>
[d@eep:~/bug-p]-> cp xitomatl/srfi/strings.sls xitomatl/srfi/strings.sls--prev
[... edited file ...]
[d@eep:~/bug-p]-> diff -u xitomatl/srfi/strings.sls--prev xitomatl/srfi/strings.sls
--- xitomatl/srfi/strings.sls--prev 2008-12-15 19:52:46.000000000 -0800
+++ xitomatl/srfi/strings.sls 2008-12-15 19:52:57.000000000 -0800
@@ -64,13 +64,6 @@
     ; R5RS re-exports:
     string? make-string string-length string-ref string-set!
     string string-append list->string
- ; Low-level routines:
- #;(make-kmp-restart-vector string-kmp-partial-search kmp-step
- string-parse-start+end
- string-parse-final-start+end
- let-string-start+end
- check-substring-spec
- substring-spec-ok?)
     )
   (import
     (except (rnrs) error string-copy string-for-each string->list
[d@eep:~/bug-p]-> ikarus
Ikarus Scheme version 0.0.3+ (revision 1719, build 2008-12-15)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (import (spells define-values) (xitomatl srfi char-set) (xitomatl srfi strings))
> (string-join '("a" "b" "c") ":")
"a:b:c"
> (string->char-set "abc")
#[:char-set ...]
> (define-values (x y) (values 1 2))
> (list x y)
(1 2)
>

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: Strange problem with "aliasing" libraries

I'm suspecting that the problem lies in the new symbol table. Investigating ...

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Definitely a bug in the symbol table. This test exhibits it.

(let ()
  (define random-string
    (lambda (n)
      (list->string
       (map (lambda (n)
              (integer->char (+ (char->integer #\a) (random 26))))
            (make-list n)))))
  (let ([str1 (random-string 70)]
        [str2 (random-string 70)])
    (printf "sym1=~s\n" (string->symbol str1))
    (do ((i 0 (+ i 1))) ((= i 1024)) (collect))
    (let ([sym1 (string->symbol str1)])
      (printf "sym1=~s\n" (string->symbol str1))
      (printf "sym2=~s\n" (string->symbol str2))
      (let ([sym3 (string->symbol str1)])
        (printf "sym3=~s\n" (string->symbol str1))
        (assert (eq? sym1 sym3))))))

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Added a fix in revision 1720. Can you please confirm the fix?

Changed in ikarus:
status: Confirmed → Fix Committed
Revision history for this message
Andreas Rottmann (rotty) wrote :

Yes, the problem went away with 1720. Thanks for the quick fix!

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.