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 <nt...@debian.org>
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

Reply via email to