Skip Menu |

This queue is for tickets about the JE CPAN distribution.

Report information
The Basics
Id: 56016
Status: stalled
Priority: 0/
Queue: JE

People
Owner: Nobody in particular
Requestors: cp.montanari [...] tiscali.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.044
Fixed in: (no value)



Subject: infinit loops in parsing of complex scripts
when trying parsing ___ 'http://l.yimg.com/eu/eu/fi/fu/ygma004.js', yah(0^0) stuff. \~/ the parser is finding an infinite loop... may be it is pushing this package bundaries a little far!
On Sun Mar 28 03:36:50 2010, ptizoom wrote: Show quoted text
> when trying parsing > ___ > 'http://l.yimg.com/eu/eu/fi/fu/ygma004.js', yah(0^0) stuff. > \~/ > the parser is finding an infinite loop... > > may be it is pushing this package bundaries a little far!
Possibly. As I have limited web access, could you send me this JavaScript file (either by attaching it to this ticket or sending it to sprout [at a server named] cpan.org)?
From: cp.montanari [...] tiscali.co.uk
Here, please see the attached JS. I assume it is the problem, as there is at least one previous script being parsed. It could be that I miss a few initialisation parameters. Anyway I start with the following naive code: use WWW::Scripter; $ua = new WWW::Scripter; $ua->use_plugin('JavaScript'); $YAHOO_CURRENCY_URL = 'http://uk.finance.yahoo.com/q/bc?s=%s%s=X&t=5y&l=on&z=m&q=l&c='; $r = sprintf($YAHOO_CURRENCY_URL, ("EUR","GBP")); $d = $ua->get($r); On Sun Mar 28 15:03:33 2010, SPROUT wrote: Show quoted text
> On Sun Mar 28 03:36:50 2010, ptizoom wrote:
> > when trying parsing > > ___ > > 'http://l.yimg.com/eu/eu/fi/fu/ygma004.js', yah(0^0) stuff. > > \~/ > > the parser is finding an infinite loop... > > > > may be it is pushing this package bundaries a little far!
> > Possibly. As I have limited web access, could you send me this > JavaScript file (either by attaching > it to this ticket or sending it to sprout [at a server named] > cpan.org)?
Subject: ygma004.js
Download ygma004.js
application/javascript 27.5k

Message body not shown because it is not plain text.

On Mon Mar 29 03:01:02 2010, ptizoom wrote: Show quoted text
> Here, please see the attached JS. > > I assume it is the problem, as there is at least one previous script > being parsed. It could be that I miss a few initialisation parameters. > > Anyway I start with the following naive code: > > use WWW::Scripter; > $ua = new WWW::Scripter; > $ua->use_plugin('JavaScript'); > $YAHOO_CURRENCY_URL = > 'http://uk.finance.yahoo.com/q/bc?s=%s%s=X&t=5y&l=on&z=m&q=l&c='; > $r = sprintf($YAHOO_CURRENCY_URL, ("EUR","GBP")); > $d = $ua->get($r);
So that I can reproduce it, could you send me that page, along with all the scripts it uses? Also, have you tried just letting it run? I suspect it is just slow and will finish eventually. You could also run it with ‘$ENV{YES_I_WANT_JE_TO_OPTIMISE} = 1’ to make use of the experimental run-time engine. It runs faster, but parses JS code more slowly. I think it might actually help in this case, as that JavaScript file parses in less than a second for me; I suspect it runs slowly.
CC: cp.montanari [...] tiscali.co.uk
Subject: Re: [rt.cpan.org #56016] infinit loops in parsing of complex scripts
Date: Tue, 6 Apr 2010 07:19:25 +0100
To: Father Chrysostomos via RT <bug-JE [...] rt.cpan.org>
From: christian Montanari <cp.montanari [...] tiscali.co.uk>
Thanks for the help. before I send all the stuff attached to the page,I thought that: -I might need some basic libraries to run this? how about hooking the js.jar ? -also, how to printout compiler activities and show the last lines beeing (multi)processed? can I use log4j.jar? On Sun, Apr 04, 2010 at 09:04:05PM -0400, Father Chrysostomos via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=56016 > > > On Mon Mar 29 03:01:02 2010, ptizoom wrote:
> > Here, please see the attached JS. > > > > I assume it is the problem, as there is at least one previous script > > being parsed. It could be that I miss a few initialisation parameters. > > > > Anyway I start with the following naive code: > > > > use WWW::Scripter; > > $ua = new WWW::Scripter; > > $ua->use_plugin('JavaScript'); > > $YAHOO_CURRENCY_URL = > > 'http://uk.finance.yahoo.com/q/bc?s=%s%s=X&t=5y&l=on&z=m&q=l&c='; > > $r = sprintf($YAHOO_CURRENCY_URL, ("EUR","GBP")); > > $d = $ua->get($r);
> > So that I can reproduce it, could you send me that page, along with all the scripts it uses? > > Also, have you tried just letting it run? I suspect it is just slow and will finish eventually. You > could also run it with ???$ENV{YES_I_WANT_JE_TO_OPTIMISE} = 1??? to make use of the > experimental run-time engine. It runs faster, but parses JS code more slowly. I think it might > actually help in this case, as that JavaScript file parses in less than a second for me; I suspect > it runs slowly. >
On Tue Apr 06 02:19:44 2010, ptizoom wrote: Show quoted text
> Thanks for the help. > before I send all the stuff attached to the page,I thought that: > > -I might need some basic libraries to run this? > how about hooking the js.jar ? > > -also, how to printout compiler activities and show the last lines > beeing (multi)processed? > can I use log4j.jar?
I don’t know what either of those libraries is, but since they end with ‘.jar’, I suspect they have something to do with Java (am I right?), which is an area with which I am very unfamiliar. To save the scripts attached to the page, you can use Firefox’s ‘Web page, complete’ option when saving the page. Alternately you could use an LWP handler to print all the URLs: $w = new WWW::Scripter; $w->add_handler(request_send => sub { print "Fetching ",shift->uri, "\n" }; To see which lines of JavaScript are being run with JE, a bit of elaborate hackery is required, as JE doesn’t have such a feature yet: use Hook::WrapSub 'wrap_subs'; require JE::Code; wrap_subs sub { return if $_[0][1] eq 'statements' or $_[0][1] eq 'function'; my @pos = @{$_[0][0]}; my $substr = substr ${$JE::Code::code->{source}}, $pos[0], $pos[1]-$pos[0]; $substr =~ /[\n\r]\s*\S/ and substr $substr,$-[0] =>= "...\n"; $JE::Code::pos = $pos[0]; print JE::Code::add_line_number( 'Executing [ ' . $substr . " ]" ); }, 'JE::Code::Statement::eval';
Subject: Re: [rt.cpan.org #56016] infinit loops in parsing of complex scripts
Date: Tue, 13 Apr 2010 07:43:40 +0100
To: Father Chrysostomos via RT <bug-JE [...] rt.cpan.org>
From: christian Montanari <cp.montanari [...] tiscali.co.uk>
Thanks, this is helpfull, quite clever for a javadonotknowhowitworks. I shall investigate further with those hooks and keep you informed. tada for now.Christian. On Sun, Apr 11, 2010 at 03:46:32PM -0400, Father Chrysostomos via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=56016 > > > On Tue Apr 06 02:19:44 2010, ptizoom wrote:
> > Thanks for the help. > > before I send all the stuff attached to the page,I thought that: > > > > -I might need some basic libraries to run this? > > how about hooking the js.jar ? > > > > -also, how to printout compiler activities and show the last lines > > beeing (multi)processed? > > can I use log4j.jar?
> > I don???t know what either of those libraries is, but since they end with ???.jar???, I suspect they > have something to do with Java (am I right?), which is an area with which I am very unfamiliar. > > To save the scripts attached to the page, you can use Firefox???s ???Web page, complete??? option > when saving the page. Alternately you could use an LWP handler to print all the URLs: > $w = new WWW::Scripter; > $w->add_handler(request_send => sub { print "Fetching ",shift->uri, "\n" }; > > To see which lines of JavaScript are being run with JE, a bit of elaborate hackery is required, > as JE doesn???t have such a feature yet: > > use Hook::WrapSub 'wrap_subs'; > require JE::Code; > wrap_subs > sub { > return if $_[0][1] eq 'statements' or $_[0][1] eq 'function'; > my @pos = @{$_[0][0]}; > my $substr > = substr ${$JE::Code::code->{source}}, $pos[0], $pos[1]-$pos[0]; > $substr =~ /[\n\r]\s*\S/ and substr $substr,$-[0] =>= "...\n"; > $JE::Code::pos = $pos[0]; > print JE::Code::add_line_number( > 'Executing [ ' > . $substr > . " ]" > ); > }, > 'JE::Code::Statement::eval';