#1 2007-03-28 19:41:48

debugger
Member
Registered: 2007-03-17
Posts: 44

Updater: Cannot update plugins.

Hi Tian,

I have a problem with IMDB plugin. I have read that there is an update solving the problem. But I cannot update plugins. I run

Code:

$ gcstar -u -w 
Proxy to use (just press enter if none): <I enter my proxy>

gcstar waits for a long time (~ 3 min), the prints:

Code:

No update have been found

and returns code 1.
   
I am pretty sure my proxy is correct -- it works for my browser (and works for gcstar also -- some pluging work very good, even IMDB plugin can download info from the net, but cannot parse it).

I debugged the code (line numbers may slightly differ because I inserted few prints to debug the code):

Code:

84:             my $self = shift;
  DB<1> n
GCRealUpdater::getIndex(/home/lnezhdan/gcstar/bin/../lib/gcstar/GCUpdater.pm:85):
85:             my $response = $self->{browser}->get($self->{baseUrl}.$INDEX_FILE, ':content_file' => $self->{baseInstallation}.$INDEX_FILE);
  DB<1> x $self->{baseUrl}.$INDEX_FILE
0  'http://www.gcstar.org/update/1.1.1/list.php'
  DB<2> n
GCRealUpdater::getIndex(/home/lnezhdan/gcstar/bin/../lib/gcstar/GCUpdater.pm:86):
86:             $self->abort($self->{lang}->{UpdateNone}) if !$response->is_success;
  DB<2> x $response
0  HTTP::Response=HASH(0x2c35950)
   '_content' => '500 Can\'t connect to www.gcstar.org:80 (connect: timeout)
'
   '_headers' => HTTP::Headers=HASH(0x2c35990)
      'client-date' => 'Wed, 28 Mar 2007 19:38:02 GMT'
      'client-warning' => 'Internal response'
      'content-type' => 'text/plain'
   '_msg' => 'Can\'t connect to www.gcstar.org:80 (connect: timeout)'
   '_rc' => 500
   '_request' => HTTP::Request=HASH(0x2a24d20)
      '_content' => ''
      '_headers' => HTTP::Headers=HASH(0x2a3dfb0)
         'user-agent' => 'libwww-perl/5.805'
      '_method' => 'GET'
      '_uri' => URI::http=SCALAR(0x1653c60)
         -> 'http://www.gcstar.org/update/1.1.1/list.php'
  DB<3> c
No update have been found
Debugged program terminated.  Use q to quit or R to restart,
  use o inhibit_exit to avoid stopping after program termination,
  h q, h R or h o to get additional info.  
  DB<3>

I would like to highlight 3 points:

1. We definetely have an error (Can't connect to www.gcstar.org:80 (connect: timeout)), but gcstar does not report it to the user, but just prints "No update has been found". It is wrong. Unexperienced user may think there is no updates. I believe program should report error to the user.

2. Do you have any idea why connection is timed out? I have internet connection, I am behind corporate firewall, but proxy works well:

Code:

$ lwp-download http://www.gcstar.org/update/1.1.1/list.php
Saving to 'list.php.txt'...
1.05 KB received

Web browser and cgstar plugings also works well...

3. I would suggest to use value of HTTP_proxy environment variable instead of (or in addition to) requesting the user each time for proxy. Many Perl programs use this variable, why don't you use it also?

Regards,
debugger.

Last edited by debugger (2007-03-28 19:44:01)

Offline

 

#2 2007-03-28 20:11:20

debugger
Member
Registered: 2007-03-17
Posts: 44

Re: Updater: Cannot update plugins.

Hi Tian,

I found a bug. :-)

Take a look to file CGUpdater.pm:

Code:

sub createBrowser
{
    my ($self, $proxy) = @_;

    $self->{browser} = LWP::UserAgent->new;
    $self->{browser}->proxy(['http'], $self->{proxy}) if $proxy;
}

You checks $proxy, but uses $self->{ proxy } which is undefined at this moment... :-( So LWP library tries to get file without any proxy and fails.

Last edited by debugger (2007-03-28 20:17:07)

Offline

 

#3 2007-03-28 20:23:09

debugger
Member
Registered: 2007-03-17
Posts: 44

Re: Updater: Cannot update plugins.

After small fix -- replacing $self->{proxy} with $proxy in createBrowser() subroutine, I am able to update some plugins. But I still have a problem due to bugs in gcstar. :-(

Code:

$ ./gcstar -u 
Proxy to use (just press enter if none): <my proxy>
1 / 34 : GCPlugins/GCbooks/GCBDGest.pm
Saving in .../gcstar/lib/gcstar/GCPlugins/GCbooks/GCBDGest.pm
2 / 34 : GCPlugins/GCbooks/GCAmazon.pm
Saving in .../gcstar/lib/gcstar/GCPlugins/GCbooks/GCAmazon.pm
3 / 34 : GCPlugins/GCbooks/GCAmazonFR.pm
Saving in .../gcstar/lib/gcstar/GCPlugins/GCbooks/GCAmazonFR.pm
...
32 / 34 : GCLang/SV/GCModels/GCgames.pm
Saving in .../gcstar/lib/gcstar/GCLang/SV/GCModels/GCgames.pm
File not found
33 / 34 : GCLang/SV/GCModels/GCmusics.pm
Saving in .../gcstar/lib/gcstar/GCLang/SV/GCModels/GCmusics.pm
File not found
34 / 34 : GCLang/SV/GCstar.pm
Saving in .../gcstar/lib/gcstar/GCLang/SV/GCstar.pm
File not found

About a half of plugins updated successfully, but the rest did not updated. The reason is simple -- my installation does not have directory gcstar/lib/GCLang/SV/. Updater should create missing directories.

Offline

 

#4 2007-03-28 20:38:55

debugger
Member
Registered: 2007-03-17
Posts: 44

Re: Updater: Cannot update plugins.

Tian,

Sorry bor bothering you, but I would like to say again -- masking errors is a wrong programming practice. Take a look (GCUpdater.pm again):

Code:

    sub updateNext
    {
        my $self = shift;
        
        my $file = $self->{filesList}->[$self->{next}];
        print "Saving in ",$self->{baseInstallation}.$file,"\n";
        my $response = $self->{browser}->get($self->{baseUrl}.$file, ':content_file' => $self->{baseInstallation}.$file);
        print $self->{lang}->{UpdateFileNotFound},"\n" if !$response->is_success;
        $self->{next}++;
    }

In my case $response after get() request is:

Code:

  DB<4> x $response
0  HTTP::Response=HASH(0x2c70d90)
   '_content' => ''
   '_headers' => HTTP::Headers=HASH(0x2ce5fa0)
      'client-date' => 'Wed, 28 Mar 2007 20:25:23 GMT'
   '_msg' => 'Cannot write to \'gcstar/lib/gcstar/GCLang/SV/GCExport/GCExportCSV.pm\': No such file or directory'
   '_rc' => 500
   '_request' => HTTP::Request=HASH(0x2ce5a90)
      '_content' => ''
      '_headers' => HTTP::Headers=HASH(0x2c5eb80)
         'user-agent' => 'libwww-perl/5.805'
      '_method' => 'GET'
      '_uri' => URI::http=SCALAR(0x2ce56b0)
         -> 'http://www.gcstar.org/update/1.1.1/GCLang/SV/GCExport/GCExportCSV.pm'
  DB<5> x $self->{lang}->{UpdateFileNotFound}
0  'File not found'

So, we have nice error message from LWP module: "Cannot write to 'gcstar/lib/gcstar/GCLang/SV/GCExport/GCExportCSV.pm': No such file or directory". Potentially, it can be athnor error (like time out). But gcstar in case of *any* error will print exactly the same: "File not found" (probably in another language). That is wrong. Translating messages to other languages is important -- nobody knows all the languages (I speak only two, for example), but replacing original error message with another one is wrong. Much more better approach is printing both. E. g:

Code:

Cannot write to 'gcstar/lib/gcstar/GCLang/SV/GCExport/GCExportCSV.pm': No such file or directory
Cannot update GCExportCSV.pm

While last one may be printed in current language for gcstar.

Or:

Code:

Cannot update GCExportCSV.pm: Cannot write to 'gcstar/lib/gcstar/GCLang/SV/GCExport/GCExportCSV.pm': No such file or directory

Best regards,
debugger.

Offline

 

#5 2007-03-29 12:22:08

Tian
Administrator
From: France
Registered: 2006-12-08
Posts: 1647
Website

Re: Updater: Cannot update plugins.

Hello,

Thank you for these remarks and investigations.

Concerning the proxy bug, it has been fixed in the CVS version but in none of the delivered ones.

For the creation of directories and the change of error message, I will do that as soon as time permits. But if you already have a patch for this, do not hesitate to submit it wink

Offline

 

#6 2007-04-02 11:34:15

Tian
Administrator
From: France
Registered: 2006-12-08
Posts: 1647
Website

Re: Updater: Cannot update plugins.

I did the mentioned fixes in the CVS version.

Offline

 



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.