Hi Rod,

slugimage in Debian fails to build (with current Perl):

* Chris Lamb <la...@debian.org> [2015-12-28 23:56]:
>   Running test ./slugos/large-flashdisk... --- 
> ./slugos/large-flashdisk.expected      2006-12-28 08:41:44.000000000 +0100
>   +++ /tmp/do-test.380        2015-12-29 00:50:02.270030213 +0100
>   @@ -1 +1,4 @@
>   +Calling POSIX::tmpnam() is deprecated at ../slugimage line 996.
>   +Calling POSIX::tmpnam() is deprecated at ../slugimage line 1009.
>   +Calling POSIX::tmpnam() is deprecated at ../slugimage line 1017.
>    Ran out of flash space in <Flashdisk> - 0x00010 bytes too large.
>   not ok
>   Running test ./slugos/standard... Calling POSIX::tmpnam() is deprecated at 
> ../slugimage line 996.
>   Calling POSIX::tmpnam() is deprecated at ../slugimage line 1009.
>   Calling POSIX::tmpnam() is deprecated at ../slugimage line 1017.
>   ok
>   Makefile:5: recipe for target 'test' failed
>   make[1]: *** [test] Error 1
>   make[1]: Leaving directory 
> '/home/lamby/temp/cdt.20151229004955.DQkH00QubC/slugimage-0.0+r104'
>   dh_auto_test: make -j1 test returned exit code 2
>   debian/rules:12: recipe for target 'build' failed
>   make: *** [build] Error 2

I converted to tempfile (File::Temp) and that also solves the
testsuite failure.

Can you commit this patch to SVN?  I can make an upload (unless Marc
wants to do it).

-- 
Martin Michlmayr
http://www.cyrius.com/
Use tempfile from File::Temp rather tha tmpname from POSIX
which is considered obsolete.

Index: slugimage
===================================================================
--- slugimage	(revision 114)
+++ slugimage	(working copy)
@@ -40,7 +40,7 @@
 use warnings;
 
 use Getopt::Long qw(:config no_ignore_case);
-use POSIX qw(tmpnam);
+use File::Temp qw(tempfile);
 
 my($debug) = 0;
 my($quiet) = 0;
@@ -1005,34 +1005,34 @@
     # don't touch RedBoot and SysConf anyway.  If no Trailer is specified,
     # put in one.
     if (not defined $redboot and not -e "RedBoot") {
-	$redboot = tmpnam();
-	open TMP, ">$redboot" or die "Cannot open file $redboot: $!";
+	my $tmp;
+	($tmp, $redboot) = tempfile();
 	push @cleanup, $redboot;
 	# The RedBoot partition is 256 * 1024 = 262144; the trailer we add
 	# is 70 bytes.
-	print TMP "\0"x(262144-70);
+	print $tmp "\0"x(262144-70);
 	# Upgrade tools check for an appropriate Sercomm trailer.
 	for my $i (@sercomm_redboot_trailer) {
-	    print TMP pack "S", $i;
+	    print $tmp pack "S", $i;
 	}
-	close TMP;
+	close $tmp
     }
     if (not defined $sysconf and not -e "SysConf") {
-	$sysconf = tmpnam();
-	open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!";
+	my $tmp;
+	($tmp, $sysconf) = tempfile();
 	push @cleanup, $sysconf;
 	# The SysConf partition is 128 * 1024 = 131072
-	print TMP "\0"x131072;
-	close TMP;
+	print $tmp "\0"x131072;
+	close $tmp;
     }
     if (not defined $trailer and not -e "Trailer") {
-	$trailer = tmpnam();
-	open TMP, ">$trailer" or die "Cannot open file $trailer: $!";
+	my $tmp;
+	($tmp, $trailer) = tempfile();
 	push @cleanup, $trailer;
 	for my $i (@sercomm_flash_trailer) {
-	    print TMP pack "S", $i;
+	    print $tmp pack "S", $i;
 	}
-	close TMP;
+	close $tmp;
     }
 
     # If the microcode was not specified, then don't complain that it's missing.

Reply via email to