Bug#866320: libspreadsheet-writeexcel-perl: uses deprecated POSIX::tmpnam()

gregor herrmann gregoa at debian.org
Wed Jun 28 21:31:59 UTC 2017


On Wed, 28 Jun 2017 23:20:06 +0300, Niko Tyni wrote:

> This package uses POSIX::tmpnam(), deprecated in Perl 5.22
> and removed in 5.26 (currently in experimental.)
> 
>  lib/Spreadsheet/WriteExcel/Workbook.pm:        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
>  lib/Spreadsheet/WriteExcel/Worksheet.pm:        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
> 
> It looks like this is fallback code that might not be active
> so filing at 'normal' for now.

Hm, I think it's the default case:


    # In the default case we use IO::File->new_tmpfile(). This may fail, in
    # particular with IIS on Windows, so we allow the user to specify a temp
    # directory via File::Temp.
    #
    if (defined $self->{_tempdir}) {

        # Delay loading File:Temp to reduce the module dependencies.
        eval { require File::Temp };
        die "The File::Temp module must be installed in order ".
            "to call set_tempdir().\n" if $@;


        # Trap but ignore File::Temp errors.
        eval { $fh = File::Temp::tempfile(DIR => $self->{_tempdir}) };

        # Store the failed tmp dir in case of errors.
        $tmp_dir = $self->{_tempdir} || File::Spec->tmpdir if not $fh;
    }
    else {

        $fh = IO::File->new_tmpfile();

        # Store the failed tmp dir in case of errors.
        $tmp_dir = "POSIX::tmpnam() directory" if not $fh;
    }


And $self->{_tempdir} is only set when the user/consumer explicitly
uses the set_tempdir() method.

OTOH, POSIX::tmpnam() is only called when IO::File->new_tmpfile()
fails. But still, this should be fixed, I guess.


Cheers,
gregor, forwarding upstream

-- 
 .''`.  https://info.comodo.priv.at/ - Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Bob Dylan: Not Dark Yet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: Digital Signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20170628/d3eb2464/attachment.sig>


More information about the pkg-perl-maintainers mailing list