Bug#923223: XML::Parser::parsefile() uses 2-argument open

gregor herrmann gregoa at debian.org
Wed Feb 27 16:16:03 GMT 2019


On Wed, 27 Feb 2019 15:35:23 +0100, Gianfranco Costamagna wrote:

> Hello, the latest update of libxml-parser-perl seems to have broken
> xmltv testsuite, and now it is failing to build from source.

Ack.
 
> I suspect the testsuite of xmltv might just need updates, but I
> don't know if the package is really broken, and how much in the
> archive is now not building anymore due to this change.

Right, that's a good question :)
 
> Can you please clarify if this is something we should deal with in xmltv or not?

Not sure yet … Xavier is looking into libxml-parser-perl, I took a
look at xmltv:

> /usr/bin/tv_imdb --quiet --imdbdir '/tmp/Tl8eCfv0EW' --with-keywords --with-plot < t/data-tv_imdb/Movie1-case-insensitive.xml > '/tmp/Tl8eCfv0EW/Movie1-case-insensitive.xml-output.xml' 2>&1 failed: 2, 0, 0

1) A fix for the xmltv testsuite is trivial:

#v+
--- a/t/test_tv_imdb.t
+++ b/t/test_tv_imdb.t
@@ -86,9 +86,9 @@
     my $output="$tmpDir/".File::Basename::basename($input)."-output.xml";
 
     # Make temporary directory and split into it.
-    my $cmd="$cmds_dir/tv_imdb --quiet --imdbdir '$tmpDir' --with-keywords --with-plot < $input > '$output' 2>&1";
+    my $cmd="$cmds_dir/tv_imdb --quiet --imdbdir '$tmpDir' --with-keywords --with-plot $input > '$output' 2>&1";
     if ( $input=~m/movies-only/ ) {
-	$cmd="$cmds_dir/tv_imdb --movies-only --quiet --imdbdir '$tmpDir' --with-keywords --with-plot < $input > '$output' 2>&1";
+	$cmd="$cmds_dir/tv_imdb --movies-only --quiet --imdbdir '$tmpDir' --with-keywords --with-plot $input > '$output' 2>&1";
     }
     #print STDERR "\nRUN:$cmd\n";
     my $r = system($cmd);
#v-

2) This fix would also suite the documentation of tv_imdb which says:

tv_imdb --imdbdir <dir> [--help] [--quiet]
       [--with-keywords] [--with-plot]
       [--movies-only] [--actors NUMBER]
       [--stats] [--debug]
       [--output FILE] [FILE...]

(so: pass FILE as an argument, not: read from STDIN, as the testsuite
does)

3) What the code in tv_imdb does is:

@ARGV = ('-') if not @ARGV;

XMLTV::parsefiles_callback(\&encoding_cb, \&credits_cb,
               \&channel_cb, \&programme_cb,
               @ARGV);
(which ends with '$t->parsefile($f);' in XMLTV)


So it seems that XML::Parser's parsefile was able to handle '-' with
the 2-args-open() and fails to do so with the 3-args-open(). This is
a regression at first glance; although the documentation for open()
only mentions "<-" or "-" for STDIN in the (one-args- and)
two-args-form. But yeah, this has the potential to break more code
out there …



Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   NP: Tom Waits: Top Of The Hill
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: Digital Signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20190227/809e1779/attachment-0001.sig>


More information about the pkg-perl-maintainers mailing list