Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 34754

Summary: PDL-2.4.0-r1 fails to install when TEMP environment variable is set
Product: Portage Development Reporter: Drake Wyrm <lilwyrm>
Component: UnclassifiedAssignee: Gentoo Perl team <perl>
Status: VERIFIED WONTFIX    
Severity: normal Keywords: Inclusion
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Sets one variable to fix the bug and clears the $Header:$ tag for CVS submission
removes reference to environment variable "TEMP" from several files

Description Drake Wyrm 2003-11-30 05:10:56 UTC
I tried to install Gimp (or GIMP or gimp, whatever your preference). In the list
of dependencies lies dev-perl/PDL-2.4.0-r1, which produces the following error:
#
# emerge --verbose --debug gimp
#

... <snip> ...
Writing Makefile for PDL::Primitive
Writing Makefile for PDL::Slices
Writing Makefile for PDL::Tests
ERROR from evaluation of
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Makefile.PL: ERROR from
evaluation of
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Math/Makefile.PL: couldn't
open testfile `/root/tmp/testfile.c' for writing at Core/Dev.pm line 603.
+ '[' '' '!=' builder ']'
+ make
make: *** No targets specified and no makefile found.  Stop.
+ diefunc perl-module_src_compile 49 2 'compilation failed'
+ local funcname=perl-module_src_compile lineno=49 exitcode=2
+ shift 3
+ echo

+ echo '!!! ERROR: dev-perl/PDL-2.4.0-r1 failed.'
!!! ERROR: dev-perl/PDL-2.4.0-r1 failed.
+ echo '!!! Function perl-module_src_compile, Line 49, Exitcode 2'
!!! Function perl-module_src_compile, Line 49, Exitcode 2
+ echo '!!! compilation failed'
!!! compilation failed
+ echo

+ exit 1

I grepped through the work dir for PDL-2.4.0 and noticed the following:
#
# relevant responses from:
# grep -Hrn TEMP /var/tmp/portage/PDL-2.4.0-r1/
#
/var/tmp/portage/PDL-2.4.0-r1/temp/environment:183:TEMP=/root/tmp
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/t/misc.t:32:$td = $^O =~ /MSWin/ ?
'TEMP' : 'tmp';
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/t/misc.t:33:$tempd = defined
$ENV{TEMP} ? $ENV{TEMP} :
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/IO/Pnm/Pic.pm:770:  $tmpdir  =
$ENV{"TEMP"} if defined $ENV{"TEMP"};
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/IO/Pnm/pnm.pd:76:  for
('TMP','TEMP','TMPDIR') {
...<snip>...
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Core/Dev.pm:597:  my $td =
$^O =~ /MSWin/ ? 'TEMP' : 'tmp';
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Core/Dev.pm:598:  my $tempd =
defined $ENV{TEMP} ? $ENV{TEMP} :
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Math/Makefile.PL:104:$td =
$^O =~ /MSWin/ ? 'TEMP' : 'tmp';
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/Math/Makefile.PL:105:$tempd =
defined $ENV{TEMP} ? $ENV{TEMP} :
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/MatrixOps/Makefile.PL:91:$td
= $^O =~ /MSWin/ ? 'TEMP' : 'tmp';
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Basic/MatrixOps/Makefile.PL:92:$tempd
= defined $ENV{TEMP} ? $ENV{TEMP} :
   <snip>
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/win32/win32f77.pl:69:  my $dir =
exists $ENV{TEMP} ? $ENV{TEMP} : exists $ENV{TMP} ? $ENV{TMP} :
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Graphics/TriD/TriD/VRML.pm:539: 
$this->{'Filestem'} = ($ENV{'TMP'} || $ENV{'TEMP'} || '/tmp') .
/var/tmp/portage/PDL-2.4.0-r1/work/PDL-2.4.0/Graphics/TriD/TriD/VRML.pm:568:my
$tmpdir = $ENV{'TMP'} || $ENV{'TEMP'} || '/tmp';

When I spotted the relavent lines in ebuild.sh, the fix was fairly obvious. See
attached patch.

Reproducible: Always
Steps to Reproduce:
1. emerge PDL (or, in my case, gimp)
2. wait for the crash
3. profit!!

Actual Results:  
not portage specifically, but the installation crashes

Expected Results:  
successfull installation

since you're interested...
#
# emerge --info
#
Gentoo Base System version 1.4.3.10
Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.20-gentoo-r8)
=================================================================
System uname: 2.4.20-gentoo-r8 i686 AMD Athlon(tm) processor
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-tbird -mno-sse2 -mno-sse -mmmx -m3dnow -mhard-float -O3
-funroll-loops -frerun-loop-opt -fmerge-all-constants -fmove-all-movables -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config
/usr/kde/3/share/config /var/bind /usr/X11R6/lib/X11/xkb
/usr/kde/3.1/share/config /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=athlon-tbird -mno-sse2 -mno-sse -mmmx -m3dnow -mhard-float -O3
-funroll-loops -frerun-loop-opt -fmerge-all-constants -fmove-all-movables -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox ccache autoaddcvs"
GENTOO_MIRRORS="http://128.213.5.34/gentoo/ http://mirror.tucdemonic.org/gentoo/
http://cudlug.cudenver.edu/gentoo/ http://mirrors.tds.net/gentoo
http://gentoo.seren.com/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 oss apm avi crypt cups encode foomaticdb gif jpeg kde libg++ mad mikmod
motif mpeg ncurses nls pdflib png quicktime truetype xml2 xmms xv zlib gdbm
berkdb slang readline arts svga java guile X sdl gpm tcpd pam libwww ssl perl
python imlib oggvorbis gnome gtk qt opengl mozilla 3dnow aalib acl alsa bonobo
cdr cjk cscope directfb doc dvd esd gd ggi gtk2 gtkhtml imap kerberos mbox mcal
menu mmx mozcalendar mozsvg mozxmlterm nas nptl offensive skey spell tcltk tetex
tiff usb vim-with-x wmf wxwindows Xaw3d xml"
Comment 1 Drake Wyrm 2003-11-30 05:25:51 UTC
Created attachment 21502 [details, diff]
Sets one variable to fix the bug and clears the $Header:$ tag for CVS submission

A "more right" answer would have been to patch the PDL install scripts so that
they would default to the more standard $TMP, but that would have left the
opportunity for future bugs of the same species.
Comment 2 Drake Wyrm 2003-12-02 10:07:27 UTC
Created attachment 21589 [details, diff]
removes reference to environment variable "TEMP" from several files

As the bug was reassigned from portage to perl, perhaps this patch would be
more to the liking of all involved
Comment 3 Drake Wyrm 2004-01-01 07:38:53 UTC
Comment on attachment 21589 [details, diff]
removes reference to environment variable "TEMP" from several files

>diff --recursive --unified PDL-2.4.0.orig/Basic/Core/Dev.pm PDL-2.4.0/Basic/Core/Dev.pm
>--- PDL-2.4.0.orig/Basic/Core/Dev.pm	2003-04-04 15:25:09.000000000 -0800
>+++ PDL-2.4.0/Basic/Core/Dev.pm	2003-12-01 20:13:51.000000000 -0800
>@@ -595,9 +595,9 @@
> 
>   my $HIDE = ($^O =~ /MSWin/) || !$hide ? '' : '>/dev/null 2>&1'; 
>   my $td = $^O =~ /MSWin/ ? 'TEMP' : 'tmp';
>-  my $tempd = defined $ENV{TEMP} ? $ENV{TEMP} :
>-            defined $ENV{TMP} ? $ENV{TMP} :
>+  my $tempd = defined $ENV{TMPDIR} ? $ENV{TMPDIR} :
>+            defined $ENV{TMP} ? $ENV{TMP} :
>                            &$cdir($fs->rootdir,$td);
> 
>   my ($tc,$te) = map {&$cfile($tempd,"testfile$_")} ('.c','');
>   open FILE,">$tc" or die "couldn't open testfile `$tc' for writing";
>diff --recursive --unified PDL-2.4.0.orig/Basic/Math/Makefile.PL PDL-2.4.0/Basic/Math/Makefile.PL
>--- PDL-2.4.0.orig/Basic/Math/Makefile.PL	2002-11-19 16:15:01.000000000 -0800
>+++ PDL-2.4.0/Basic/Math/Makefile.PL	2003-12-01 20:15:06.000000000 -0800
>@@ -102,9 +102,9 @@
> $dir = $fs->canonpath(cwd);
> $dir = cdir $dir, $mdir unless $dir =~ /$mmdir$/;
> $td = $^O =~ /MSWin/ ? 'TEMP' : 'tmp';
>-$tempd = defined $ENV{TEMP} ? $ENV{TEMP} :
>-            defined $ENV{TMP} ? $ENV{TMP} :
>+$tempd = defined $ENV{TMPDIR} ? $ENV{TMPDIR} :
>+            defined $ENV{TMP} ? $ENV{TMP} :
>                            cdir($fs->rootdir,$td);
> 
> foreach (@sfuncs) {
>     $source{$_} = 'system' if is_sys_func( "$_();", $libs );
>diff --recursive --unified PDL-2.4.0.orig/Basic/MatrixOps/Makefile.PL PDL-2.4.0/Basic/MatrixOps/Makefile.PL
>--- PDL-2.4.0.orig/Basic/MatrixOps/Makefile.PL	2002-11-19 18:18:44.000000000 -0800
>+++ PDL-2.4.0/Basic/MatrixOps/Makefile.PL	2003-12-01 20:15:45.000000000 -0800
>@@ -89,9 +89,9 @@
> $dir = $fs->canonpath(cwd);
> $dir = cdir $dir, $mdir unless $dir =~ /$mmdir$/;
> $td = $^O =~ /MSWin/ ? 'TEMP' : 'tmp';
>-$tempd = defined $ENV{TEMP} ? $ENV{TEMP} :
>-            defined $ENV{TMP} ? $ENV{TMP} :
>+$tempd = defined $ENV{TMPDIR} ? $ENV{TMPDIR} :
>+            defined $ENV{TMP} ? $ENV{TMP} :
>                            cdir($fs->rootdir,$td);
> 
> foreach (@sfuncs) {
>     $source{$_} = 'system' if is_sys_func( "$_();", $libs );
>diff --recursive --unified PDL-2.4.0.orig/Graphics/TriD/TriD/VRML.pm PDL-2.4.0/Graphics/TriD/TriD/VRML.pm
>--- PDL-2.4.0.orig/Graphics/TriD/TriD/VRML.pm	2000-08-08 04:18:48.000000000 -0700
>+++ PDL-2.4.0/Graphics/TriD/TriD/VRML.pm	2003-12-01 22:33:23.000000000 -0800
>@@ -536,8 +536,8 @@
>   $this->{'Type'} = $types{$mime};
>   &{$this->{'Type'}->{'setup'}} if defined $this->{'Type'}->{'setup'};
>   $this->{'Binding'} = 'local';
>-  $this->{'Filestem'} = ($ENV{'TMP'} || $ENV{'TEMP'} || '/tmp') .
>+  $this->{'Filestem'} = ($ENV{'TMPDIR'} || $ENV{'TMP'} || '/tmp') .
>     "/tridim_$urlnum"; $urlnum++;
>   return $this;
> }
> 
>@@ -565,7 +564,7 @@
> };
> 
> # set up the default parameters for VRML
>-my $tmpdir = $ENV{'TMP'} || $ENV{'TEMP'} || '/tmp';
>+my $tmpdir = $ENV{'TMPDIR'} || $ENV{'TMP'} || '/tmp';
> my $tmpname = "$tmpdir/tridvrml_$$.wrl";
> my $para = $PDL::Graphics::TriD::Settings =
>   PDL::Graphics::TriD::VRML::Parameter->new() ;
>diff --recursive --unified PDL-2.4.0.orig/IO/Pnm/Pic.pm PDL-2.4.0/IO/Pnm/Pic.pm
>--- PDL-2.4.0.orig/IO/Pnm/Pic.pm	2003-02-01 21:22:40.000000000 -0800
>+++ PDL-2.4.0/IO/Pnm/Pic.pm	2003-12-01 20:07:06.000000000 -0800
>@@ -767,7 +767,7 @@
>     # are there already VMS or Windows NT/95 users ?
>   my $tmpdir = '/tmp';
>   $tmpdir  = $ENV{"TMP"} if defined $ENV{"TMP"};
>-  $tmpdir  = $ENV{"TEMP"} if defined $ENV{"TEMP"};
>+  $tmpdir  = $ENV{"TMPDIR"} if defined $ENV{"TMPDIR"};
>   $tmpdir =~ s|/$||;  # chop off a trailing '/'
>   barf "can't locate a temp dir" unless -d $tmpdir;
>   return $tmpdir;
>diff --recursive --unified PDL-2.4.0.orig/IO/Pnm/pnm.pd PDL-2.4.0/IO/Pnm/pnm.pd
>--- PDL-2.4.0.orig/IO/Pnm/pnm.pd	2001-01-21 01:24:08.000000000 -0800
>+++ PDL-2.4.0/IO/Pnm/pnm.pd	2003-12-01 20:13:06.000000000 -0800
>@@ -73,7 +73,7 @@
>     # in the future an os indep. way
>     # are there already VMS or Windows NT/95 users ?
>   my $tmpdir = '/tmp';
>-  for ('TMP','TEMP','TMPDIR') {
>+  for ('TMP','TMPDIR') {
>      $tmpdir  = $ENV{$_} if defined $ENV{$_};
>   }
>   $tmpdir =~ s|/$||;  # chop off a trailing '/'
>diff --recursive --unified PDL-2.4.0.orig/t/misc.t PDL-2.4.0/t/misc.t
>--- PDL-2.4.0.orig/t/misc.t	2002-05-13 14:29:48.000000000 -0700
>+++ PDL-2.4.0/t/misc.t	2003-12-01 20:10:53.000000000 -0800
>@@ -30,9 +30,9 @@
> sub cdir { return $fs->catdir(@_)}
> sub cfile { return $fs->catfile(@_)}
> $td = $^O =~ /MSWin/ ? 'TEMP' : 'tmp';
>-$tempd = defined $ENV{TEMP} ? $ENV{TEMP} :
>-            defined $ENV{TMP} ? $ENV{TMP} :
>+$tempd = defined $ENV{TMPDIR} ? $ENV{TMPDIR} :
>+            defined $ENV{TMP} ? $ENV{TMP} :
>                            cdir($fs->rootdir,$td);
> $file = cfile $tempd, "iotest$$";
> 
> ############# Test rcols with filename and pattern #############
Comment 4 Drake Wyrm 2004-01-01 08:45:52 UTC
I just edited the patch for better consistency. Since the environ(5) manpage mentions TMPDIR, I chose that for the default. TMP is also common, so I used that as the fallback.
Comment 5 Drake Wyrm 2004-01-22 00:23:45 UTC
So any thoughts on this? Are the patches inadequate? Is somebody reviewing this? What's going on behind the veil?
Comment 6 Drake Wyrm 2004-03-10 06:38:55 UTC
-nudge-nudge-
Comment 7 Drake Wyrm 2004-08-02 17:03:19 UTC
Nobody seems interested in handling this, and I'm tired of looking at it.