[mythtv-commits] Ticket #6095: imdb.pl can yield uninitialized variable error
MythTV
mythtv at cvs.mythtv.org
Thu Jan 8 09:50:07 UTC 2009
#6095: imdb.pl can yield uninitialized variable error
----------------------------------------------+-----------------------------
Reporter: James Reinders <renders at acm.org> | Owner: awithers
Type: defect | Status: new
Priority: minor | Milestone: unknown
Component: mythvideo | Version: 0.21-fixes
Severity: medium | Mlocked: 0
----------------------------------------------+-----------------------------
During a imdb lookup, a pop-up dialog box appears indicating a perl error.
Clicking OK is required to get the dialog box to leave, but does not seem
to affect the actual imdb lookup from working eventually. It should be
fixed.
The error message is:
Use of uninitialized value in pattern match (m//) at
/usr/share/mythtv/mythvideo/scripts/imdb.pl line 327.
This is caused by the result of a get operation not being checked for
being undefined before usage. This happens in several places in this
script. This particular failure is the result of a get in line 323 which
is used in line 327.
For reference - here is the portion, with line numbers, of the imdb.pl
code on my system (unmodified file - latest and greatest Mythbuntu - Linux
version 2.6.24-22-generic (buildd at vernadsky) (gcc version 4.2.3 (Ubuntu
4.2.3-2ubuntu7)) #1 SMP Mon Nov 24 18:32:42 UTC 2008)
{{{
319 # try looking on nexbase
320 if ($uri eq "" && $response =~ m/<a
href="([^"]*)">([^"]*?)nexbase/i) {
321 if ($1 ne "") {
322 if (defined $opt_d) { print "# found nexbase poster page: $1 \n"; }
323 my $cinres = get $1;
324 if (defined $opt_d) { printf("# got %i bytes\n", length($cinres));
}
325 if (defined $opt_r) { printf("%s", $cinres); }
326
327 if ($cinres =~ m/<a id="photo_url" href="([^"]*?)" ><\/a>/i) {
328 if (defined $opt_d) { print "# nexbase url retreived\n"; }
329 $uri = $1;
330 }
331 }
332 }
}}}
The problem is clear - line 323 does a get operation, but does not check
for success.
The variable can actually be undefined - and in this case it is, and line
327 causes an error as a result.
PERLDOC shows and example for using get as follows:
{{{
my $content = get $url;
die "Couldn't get $url" unless defined $content;
}}}
This script ( /usr/share/mythtv/mythvideo/scripts/imdb.pl ) needs to test
the result of get url constructs in a number of places it appears. Line
323/327 being a place we've seen the results of not checking.
{{{
Please include all output in bug reports.
MythTV Version : 18207
MythTV Branch : branches/release-0-21-fixes
Library API : 0.21.20080304-1
Network Protocol : 40
Options compiled in:
linux profile using_oss using_alsa using_arts using_jack using_backend
using_dbox2 using_dvb using_firewire using_frontend using_hdhomerun
using_iptv using_ivtv using_joystick_menu using_libfftw3 using_lirc
using_opengl_vsync using_opengl_video using_v4l using_x11 using_xrandr
using_xv using_xvmc using_xvmcw using_xvmc_vld using_glx_proc_addr_arb
using_bindings_perl using_bindings_python using_opengl
using_ffmpeg_threads using_libavc_5_3 using_live
}}}
Here are the detailed logs from the particular failure I saw:
Here are the detailed logs...
On the first attempt - the info was fetched, but the poster download timed
out. There is NO uninitalized variable error, but the poster fetch timed
out:
2009-01-08 00:02:53.345 Video Data Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -D 04549\
21'
2009-01-08 00:02:54.096 Title:The Pursuit of Happyness
Year:2006
ReleaseDate:
Director:Gabriele Muccino
Plot:A struggling salesman takes custody of his son as he's poised to
begin a life-changing professional \
endeavor.
UserRating:
MovieRating:Rated PG-13 for some language.
Runtime:117
Writers:
Cast:Will Smith,Jaden Smith,Thandie Newton,Brian Howe,James Karen,Dan
Castellaneta,Kurt Fuller,Takayo Fis\
cher,Kevin West,George Cheung,David Michael Silverman,Domenic Bove,Geoff
Callan,Joyful Raven,Scott Klace
Genres: Biography,Drama
Countries: USA
2009-01-08 00:02:54.103 Poster Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -P 0454921'
2009-01-08 00:02:55.587 Use of uninitialized value in pattern match (m//)
at /usr/share/mythtv/mythvideo/\
scripts/imdb.pl line 327.
2009-01-08 00:03:13.730 http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwODQ3NjI0MQ@\
@._V1._SX100_SY133_.jpg
2009-01-08 00:03:13.731 Copying 'http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwOD\
Q3NjI0MQ@@._V1._SX100_SY133_.jpg' ->
'/home/katie/.mythtv/MythVideo/0454921.jpg'...
2009-01-08 00:03:13.732 dest_file =
/home/katie/.mythtv/MythVideo/0454921.jpg
2009-01-08 00:03:43.734 Copying of 'http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTc\
wODQ3NjI0MQ@@._V1._SX100_SY133_.jpg' timed out
2009-01-08 00:03:43.734 Get: The operation has been processed but has been
stopped before it finished, an\
d is waiting to be processed.: Operation stopped by the user
Next - I ask it to load again, just like before I enter the IMDB number
manually - this time there is an uninitalized variable error, and the
poster fetch times out:
2009-01-08 00:04:36.614 Video Data Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -D 04549\
21'
2009-01-08 00:04:37.370 Title:The Pursuit of Happyness
Year:2006
ReleaseDate:
Director:Gabriele Muccino
Plot:A struggling salesman takes custody of his son as he's poised to
begin a life-changing professional \
endeavor.
UserRating:
MovieRating:Rated PG-13 for some language.
Runtime:117
Writers:
Cast:Will Smith,Jaden Smith,Thandie Newton,Brian Howe,James Karen,Dan
Castellaneta,Kurt Fuller,Takayo Fis\
cher,Kevin West,George Cheung,David Michael Silverman,Domenic Bove,Geoff
Callan,Joyful Raven,Scott Klace
Genres: Biography,Drama
Countries: USA
2009-01-08 00:04:37.377 Poster Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -P 0454921'
2009-01-08 00:04:39.175 Use of uninitialized value in pattern match (m//)
at /usr/share/mythtv/mythvideo/\
scripts/imdb.pl line 327.
2009-01-08 00:11:22.171 http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwODQ3NjI0MQ@\
@._V1._SX100_SY133_.jpg
2009-01-08 00:11:22.171 Copying 'http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwOD\
Q3NjI0MQ@@._V1._SX100_SY133_.jpg' ->
'/home/katie/.mythtv/MythVideo/0454921.jpg'...
2009-01-08 00:11:22.172 dest_file =
/home/katie/.mythtv/MythVideo/0454921.jpg
2009-01-08 00:11:52.177 Copying of 'http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTc\
wODQ3NjI0MQ@@._V1._SX100_SY133_.jpg' timed out
2009-01-08 00:11:52.177 Get: The operation has been processed but has been
stopped before it finished, an\
d is waiting to be processed.: Operation stopped by the user
I did this several more times - exact same result - error and timeout.
Finally - apparently just better luck - the poster is fetched, even in the
presence of the uninitialized variable:
2009-01-08 00:13:50.383 Video Data Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -D 04549\
21'
2009-01-08 00:13:51.138 Title:The Pursuit of Happyness
Year:2006
ReleaseDate:
Director:Gabriele Muccino
Plot:A struggling salesman takes custody of his son as he's poised to
begin a life-changing professional \
endeavor.
UserRating:
MovieRating:Rated PG-13 for some language.
Runtime:117
Writers:
Cast:Will Smith,Jaden Smith,Thandie Newton,Brian Howe,James Karen,Dan
Castellaneta,Kurt Fuller,Takayo Fis\
cher,Kevin West,George Cheung,David Michael Silverman,Domenic Bove,Geoff
Callan,Joyful Raven,Scott Klace
Genres: Biography,Drama
Countries: USA
2009-01-08 00:13:51.160 Poster Query: Executing
'/usr/share/mythtv/mythvideo/scripts/imdb.pl -P 0454921'
2009-01-08 00:13:52.601 Use of uninitialized value in pattern match (m//)
at /usr/share/mythtv/mythvideo/\
scripts/imdb.pl line 327.
2009-01-08 00:13:54.943 http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwODQ3NjI0MQ@\
@._V1._SX100_SY133_.jpg
2009-01-08 00:13:54.944 Copying 'http://ia.media-
imdb.com/images/M/MV5BMTczOTI0NTczOV5BMl5BanBnXkFtZTcwOD\
Q3NjI0MQ@@._V1._SX100_SY133_.jpg' ->
'/home/katie/.mythtv/MythVideo/0454921.jpg'...
2009-01-08 00:13:54.945 dest_file =
/home/katie/.mythtv/MythVideo/0454921.jpg
2009-01-08 00:13:55.056 Get: The operation has been processed
succesfully.:
2009-01-08 00:13:55.136 Put: The operation has been processed
succesfully.:
2009-01-08 00:13:55.137 Error: StopWaitBackground called with no active
message.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/6095>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list