unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* VM stack overflow while calling sxml-match within let* or car
@ 2011-03-14  9:42 nalaginrut
  2011-03-14 17:40 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: nalaginrut @ 2011-03-14  9:42 UTC (permalink / raw)
  To: guile-devel

hi all, I found a strange problem while I's using sxml module.
For example, I have a regular xml file,and convert it to a sxml format:

---------------------------
(*TOP* (*PI* xml "version=\"1.0\" encoding=\"UTF-8\"") (note "
    " (to "Tove") "
    " (from "Jani") "
    " (heading "Reminder") "
    " (body "Don't forget me this weekend!") "
"))
---------------------------

While I's trying "sxml-match" to get some value:
=======================================
(sxml-match 
  (car ((sxpath '(note to)) nn)) 
  [(to ,cv) (list cv)] [,otherwise #f])
=======================================
The result is OK.

But I want do some extension operation, like:

============
(let* (to (sxml-match .........) ...
or
(car (sxml-match ........) ...
============

Guile will crash and say:
../../module/sxml/xpath.scm:111:0: In procedure nodeset?:
../../module/sxml/xpath.scm:111:0: Throw to key `vm-error' with args
`(vm-run "VM: Stack overflow" ())'.


Is it a bug?

-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-14  9:42 VM stack overflow while calling sxml-match within let* or car nalaginrut
@ 2011-03-14 17:40 ` Ludovic Courtès
  2011-03-27 11:30   ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2011-03-14 17:40 UTC (permalink / raw)
  To: NalaGinrut; +Cc: Jim Bender, guile-devel

Hi,

[Cc: Jim Bender.]

I can reproduce the problem:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define sxml '(*TOP* (*PI* xml "version=\"1.0\" encoding=\"UTF-8\"") (note "
    " (to "Tove") "
    " (from "Jani") "
    " (heading "Reminder") "
    " (body "Don't forget me this weekend!") "
")))
scheme@(guile-user)> (sxml-match (car ((sxpath '(note to)) sxml)) ((to ,cv) (list cv)) (,_ #f))
$7 = ("Tove")
--8<---------------cut here---------------end--------------->8---

So far so good, but then:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define x (sxml-match '(to "Trove") ((to ,cv) (list cv)) (,_ #f)))
module/ice-9/boot-9.scm:1514:2: In procedure #<procedure 24d4140 at module/ice-9/boot-9.scm:1515:2 (module)>:
module/ice-9/boot-9.scm:1514:2: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow" ())'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
--8<---------------cut here---------------end--------------->8---

(And Guile crashes upon ,bt.)

Removing the catch-all clause makes the problem vanish:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (define x (sxml-match '(to "Trove") ((to ,cv) (list cv))))
scheme@(guile-user)> x
$4 = ("Trove")
--8<---------------cut here---------------end--------------->8---

So that looks like a real bug, needing further investigation...

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-14 17:40 ` Ludovic Courtès
@ 2011-03-27 11:30   ` Andy Wingo
  2011-03-27 11:56     ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Wingo @ 2011-03-27 11:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel, Jim Bender

On Mon 14 Mar 2011 18:40, ludo@gnu.org (Ludovic Courtès) writes:

> I can reproduce the problem:

Me too.  How weird.

scheme@(guile-user)> (sxml-match '(to "Trove") ((to ,cv) (list cv)) (,_ #f))
$5 = ("Trove")
scheme@(guile-user)> (define x (sxml-match '(to "Trove") ((to ,cv) (list cv)) (,_ #f)))
module/ice-9/boot-9.scm:1514:2: In procedure #<procedure e5ebe0 at module/ice-9/boot-9.scm:1515:2 (module)>:
module/ice-9/boot-9.scm:1514:2: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow" ())'.

The second is the same as the first, only it's in a `define'.

> (And Guile crashes upon ,bt.)

Here too.  I wonder if this indicates some compilation bug.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-27 11:30   ` Andy Wingo
@ 2011-03-27 11:56     ` Andy Wingo
  2011-03-27 13:04       ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Wingo @ 2011-03-27 11:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel, Jim Bender

On Sun 27 Mar 2011 13:30, Andy Wingo <wingo@pobox.com> writes:

>> (And Guile crashes upon ,bt.)
>
> I wonder if this indicates some compilation bug.

Indeed it does; it's a bug in Guile, not sxml-match.

The following expression exhibits this bug:

(car
 (letrec ((f (lambda ()
               (call-with-prompt
                'p
                (lambda () #t)
                (lambda (k) #f)))))
   (f)))

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-27 11:56     ` Andy Wingo
@ 2011-03-27 13:04       ` Andy Wingo
  2011-03-27 14:25         ` nalaginrut
  2011-03-27 15:04         ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Wingo @ 2011-03-27 13:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Jim Bender, guile-devel

On Sun 27 Mar 2011 13:56, Andy Wingo <wingo@pobox.com> writes:

> On Sun 27 Mar 2011 13:30, Andy Wingo <wingo@pobox.com> writes:
>
>>> (And Guile crashes upon ,bt.)
>>
>> I wonder if this indicates some compilation bug.
>
> Indeed it does; it's a bug in Guile, not sxml-match.
>
> The following expression exhibits this bug:
>
> (car
>  (letrec ((f (lambda ()
>                (call-with-prompt
>                 'p
>                 (lambda () #t)
>                 (lambda (k) #f)))))
>    (f)))

Fixed in git.  Thanks for the amusing bug, Mr. Turing!

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-27 13:04       ` Andy Wingo
@ 2011-03-27 14:25         ` nalaginrut
  2011-03-27 15:04         ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: nalaginrut @ 2011-03-27 14:25 UTC (permalink / raw)
  To: Andy Wingo; +Cc: Ludovic Courtès, Jim Bender, guile-devel

> On Sun 27 Mar 2011 13:56, Andy Wingo <wingo@pobox.com> writes:
> 
> > On Sun 27 Mar 2011 13:30, Andy Wingo <wingo@pobox.com> writes:
> >
> >>> (And Guile crashes upon ,bt.)
> >>
> >> I wonder if this indicates some compilation bug.
> >
> > Indeed it does; it's a bug in Guile, not sxml-match.
> >
> > The following expression exhibits this bug:
> >
> > (car
> >  (letrec ((f (lambda ()
> >                (call-with-prompt
> >                 'p
> >                 (lambda () #t)
> >                 (lambda (k) #f)))))
> >    (f)))
> 
> Fixed in git.  Thanks for the amusing bug, Mr. Turing!
> 
> Andy

Well~it's a nice news. My code was modified to an more ugly style to
make it work because of this bug. But I think it's cure now. :-)

-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: VM stack overflow while calling sxml-match within let* or car
  2011-03-27 13:04       ` Andy Wingo
  2011-03-27 14:25         ` nalaginrut
@ 2011-03-27 15:04         ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2011-03-27 15:04 UTC (permalink / raw)
  To: Andy Wingo; +Cc: Jim Bender, guile-devel

Hi!

Andy Wingo <wingo@pobox.com> writes:

> On Sun 27 Mar 2011 13:56, Andy Wingo <wingo@pobox.com> writes:
>
>> On Sun 27 Mar 2011 13:30, Andy Wingo <wingo@pobox.com> writes:
>>
>>>> (And Guile crashes upon ,bt.)
>>>
>>> I wonder if this indicates some compilation bug.
>>
>> Indeed it does; it's a bug in Guile, not sxml-match.
>>
>> The following expression exhibits this bug:
>>
>> (car
>>  (letrec ((f (lambda ()
>>                (call-with-prompt
>>                 'p
>>                 (lambda () #t)
>>                 (lambda (k) #f)))))
>>    (f)))
>
> Fixed in git.  Thanks for the amusing bug, Mr. Turing!

Woow, interesting bug, good catch!

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-27 15:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14  9:42 VM stack overflow while calling sxml-match within let* or car nalaginrut
2011-03-14 17:40 ` Ludovic Courtès
2011-03-27 11:30   ` Andy Wingo
2011-03-27 11:56     ` Andy Wingo
2011-03-27 13:04       ` Andy Wingo
2011-03-27 14:25         ` nalaginrut
2011-03-27 15:04         ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).