Bug#863071: debconf: POSIX::tmpnam() is deprecated in Perl 5.24 and will be removed in 5.26

2017-05-21 Thread Niko Tyni
Package: debconf
Version: 1.5.60
Severity: important
User: debian-p...@lists.debian.org
Usertags: perl-5.24-transition perl-5.26-transition bcn2017

Debconf::TmpFile uses POSIX::tmpnam(), which was deprecated
in Perl 5.24:

 % perl -MPOSIX -e 'POSIX::tmpnam()'
 Calling POSIX::tmpnam() is deprecated at -e line 1.

It is removed totally in Perl 5.26 (currently in experimental,
targeted for buster):

 Unimplemented: POSIX::tmpnam(): use File::Temp instead at -e line 1.

I've confirmed that debconf crashes with this on Perl 5.26 when
dpkg-reconfiguring console-setup on a small enough terminal that the
textboxes need scrolling. It only happens with the dialog frontend,
not whiptail.

The 5.24 deprecation warning is not visible to the user at least
with the dialog frontend, so this has gone unnoticed until now.

While harmless now, if this goes into stretch, it has implications
for stretch -> buster upgrades: debconf will then need to be upgraded
strictly before perl-base, probably by making perl-base Break (or
even Conflict with?) older debconf versions. 

It would be nice if we could avoid this, so a fix for stretch would be
appreciated. Anything using File::Temp that works on 5.24 should do.

OTOH Ubuntu has already released with this issue so we may want to
do the Breaks/Conflict thing to help their upgrades anyway?

Feel free to downgrade the severity if it seems inflated.

Greetings for the Debian Perl Sprint in Lloret de Mar,
-- 
Niko Tyni   nt...@debian.org



Bug#863071: debconf: POSIX::tmpnam() is deprecated in Perl 5.24 and will be removed in 5.26

2017-05-21 Thread Niko Tyni
Control: tag -1 patch

On Sun, May 21, 2017 at 12:49:25PM +0300, Niko Tyni wrote:
> Package: debconf
> Version: 1.5.60
> Severity: important
> User: debian-p...@lists.debian.org
> Usertags: perl-5.24-transition perl-5.26-transition bcn2017
> 
> Debconf::TmpFile uses POSIX::tmpnam(), which was deprecated
> in Perl 5.24:

> I've confirmed that debconf crashes with this on Perl 5.26 when
> dpkg-reconfiguring console-setup on a small enough terminal that the
> textboxes need scrolling. It only happens with the dialog frontend,
> not whiptail.

The 5.24 warning can be seen with the 'editor' backend, and the issue
makes that one break totally on 5.26, regardless of the terminal size:

  # dpkg-reconfigure -plow debconf
  Unimplemented: POSIX::tmpnam(): use File::Temp instead at 
/usr/share/perl5/Debconf/TmpFile.pm line 16.
  # echo $?
  255

Proposed, lightly tested patch attached. Niels said on IRC
that it would be good to fix this for stretch, so presumably
it's OK for an unblock by the release team.
-- 
Niko Tyni   nt...@debian.org
>From 5d71ee167785694fe502fce9ff6fa36cc36c94bd Mon Sep 17 00:00:00 2001
From: Niko Tyni 
Date: Sun, 21 May 2017 13:25:38 +0300
Subject: [PATCH] Use File::Temp instead of the deprecated POSIX::tmpnam() in
 Debconf::TmpFile

File::Temp is in perl-base since jessie, so using it here should be fine.

We no longer need to handle the sysopen() part ourselves.

Closes: #863071
---
 Debconf/TmpFile.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Debconf/TmpFile.pm b/Debconf/TmpFile.pm
index 66b77ba..3b4832d 100644
--- a/Debconf/TmpFile.pm
+++ b/Debconf/TmpFile.pm
@@ -10,6 +10,7 @@ package Debconf::TmpFile;
 use strict;
 use IO::File;
 use Fcntl;
+use File::Temp;
 
 =head1 DESCRIPTION
 
@@ -32,8 +33,7 @@ my $filename;
 sub open {
 	my $fh; # will be autovivified
 	my $ext=shift || '';
-	do { $filename=POSIX::tmpnam().$ext }
-	until sysopen($fh, $filename, O_WRONLY|O_TRUNC|O_CREAT|O_EXCL, 0600);
+	($fh, $filename) = File::Temp::tempfile(SUFFIX => $ext);
 	return $fh;
 }
 
-- 
2.11.0



Bug#863071: [Debconf-devel] Bug#863071: debconf: POSIX::tmpnam() is deprecated in Perl 5.24 and will be removed in 5.26

2017-05-21 Thread Colin Watson
On Sun, May 21, 2017 at 01:48:54PM +0300, Niko Tyni wrote:
> On Sun, May 21, 2017 at 12:49:25PM +0300, Niko Tyni wrote:
> > Debconf::TmpFile uses POSIX::tmpnam(), which was deprecated
> > in Perl 5.24:
> 
> > I've confirmed that debconf crashes with this on Perl 5.26 when
> > dpkg-reconfiguring console-setup on a small enough terminal that the
> > textboxes need scrolling. It only happens with the dialog frontend,
> > not whiptail.
> 
> The 5.24 warning can be seen with the 'editor' backend, and the issue
> makes that one break totally on 5.26, regardless of the terminal size:
> 
>   # dpkg-reconfigure -plow debconf
>   Unimplemented: POSIX::tmpnam(): use File::Temp instead at 
> /usr/share/perl5/Debconf/TmpFile.pm line 16.
>   # echo $?
>   255
> 
> Proposed, lightly tested patch attached. Niels said on IRC
> that it would be good to fix this for stretch, so presumably
> it's OK for an unblock by the release team.

Thanks; applied in 1.5.61, with the amendment that I bumped the
Pre-Depends on perl-base to 5.20.1-3~ to account for this.

Please do also add the appropriate Breaks (or Conflicts if necessary,
but I suspect that's overkill and it may be harmful) to perl-base 5.26;
it isn't uncommon for people to try skip upgrades which mostly work even
if they're unsupported, and I wouldn't want to see them broken due to
something we could have avoided.

I think Debconf::TmpFile should in fact just be replaced entirely by
File::Temp at this point, but let's stick with the minimal patch for
now.

-- 
Colin Watson   [cjwat...@debian.org]



Bug#863071: [Debconf-devel] Bug#863071: debconf: POSIX::tmpnam() is deprecated in Perl 5.24 and will be removed in 5.26

2017-05-21 Thread Niko Tyni
On Sun, May 21, 2017 at 06:21:55PM +0100, Colin Watson wrote:
> On Sun, May 21, 2017 at 01:48:54PM +0300, Niko Tyni wrote:

> > Proposed, lightly tested patch attached. Niels said on IRC
> > that it would be good to fix this for stretch, so presumably
> > it's OK for an unblock by the release team.
> 
> Thanks; applied in 1.5.61, with the amendment that I bumped the
> Pre-Depends on perl-base to 5.20.1-3~ to account for this.

Thanks!

> Please do also add the appropriate Breaks (or Conflicts if necessary,
> but I suspect that's overkill and it may be harmful) to perl-base 5.26;
> it isn't uncommon for people to try skip upgrades which mostly work even
> if they're unsupported, and I wouldn't want to see them broken due to
> something we could have avoided.

Breaks added in git. We'll see how it goes.
-- 
Niko