[PATCH] don't override TMPDIR with /tmp on cygwin, cleanup TMPDIR/TM...

Christian Lohmaier (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 30 11:31:15 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3701

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/01/3701/1

don't override TMPDIR with /tmp on cygwin, cleanup TMPDIR/TMP handling

on cygwin, configure forced TMPDIR to /tmp, regardless whether it is set
or not. And while it respects an existing value of TMP, TMP is only used
in a few places. Changes the ones that explicitly check for TMP to
prefer TMPDIR, and don't duplicate configure's check in other scripts.

Change-Id: Ia8ac3f8d92e5f971c5237b85f66f7c0a58932930
---
M config_host.mk.in
M configure.ac
M solenv/bin/modules/installer/parameter.pm
M solenv/bin/modules/installer/windows/msiglobal.pm
M solenv/bin/ooinstall
5 files changed, 10 insertions(+), 33 deletions(-)



diff --git a/config_host.mk.in b/config_host.mk.in
index 82dfd50..7354e06 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -536,7 +536,6 @@
 export TELEPATHY_LIBS=$(gb_SPACE)@TELEPATHY_LIBS@
 export THES_SYSTEM_DIR=@THES_SYSTEM_DIR@
 export TLS=@TLS@
- at x_Cygwin@ export TMP=@TMP_DIRECTORY@
 export TMPDIR=@TEMP_DIRECTORY@
 export TYPO_EXTENSION_PACK=@TYPO_EXTENSION_PACK@
 export UNIXWRAPPERNAME=@UNIXWRAPPERNAME@
diff --git a/configure.ac b/configure.ac
index bc20dec..aaffe36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11858,22 +11858,15 @@
 PERL="$formatted_path"
 AC_SUBST(PERL)
 
-if test "$build_os" = "cygwin"; then
-    TEMP_DIRECTORY=`cygpath -m "/tmp"`
-    if test -n "$TMP"; then
-        TMP_DIRECTORY="$TMP"
-    else
-        TMP_DIRECTORY="$TEMP_DIRECTORY"
-    fi
+if test -n "$TMPDIR"; then
+    TEMP_DIRECTORY="$TMPDIR"
 else
-    if test -n "$TMPDIR"; then
-        TEMP_DIRECTORY="$TMPDIR"
-    else
-        TEMP_DIRECTORY="/tmp"
-    fi
+    TEMP_DIRECTORY="/tmp"
+fi
+if test "$build_os" = "cygwin"; then
+    TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
 fi
 AC_SUBST(TEMP_DIRECTORY)
-AC_SUBST(TMP_DIRECTORY)
 
 # setup the PATH for the environment
 if test -n "$LO_PATH_FOR_BUILD"; then
diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm
index deda9d3..3ca159f 100644
--- a/solenv/bin/modules/installer/parameter.pm
+++ b/solenv/bin/modules/installer/parameter.pm
@@ -366,11 +366,9 @@
 
     # setting and creating the temppath
 
-    if (( $ENV{'TMP'} ) || ( $ENV{'TEMP'} ) || ( $ENV{'TMPDIR'} ))
+    if ( $ENV{'TMPDIR'} )
     {
-        if ( $ENV{'TMP'} ) { $installer::globals::temppath = $ENV{'TMP'}; }
-        elsif ( $ENV{'TEMP'} )  { $installer::globals::temppath = $ENV{'TEMP'}; }
-        elsif ( $ENV{'TMPDIR'} )  { $installer::globals::temppath = $ENV{'TMPDIR'}; }
+        $installer::globals::temppath = $ENV{'TMPDIR'};
         $installer::globals::temppath =~ s/\Q$installer::globals::separator\E\s*$//;    # removing ending slashes and backslashes
         $installer::globals::temppath .= $installer::globals::separator . 'ooopackaging';
         installer::systemactions::create_directory_with_privileges($installer::globals::temppath, "777");
diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm
index 6087d1d..2029f71 100644
--- a/solenv/bin/modules/installer/windows/msiglobal.pm
+++ b/solenv/bin/modules/installer/windows/msiglobal.pm
@@ -684,7 +684,6 @@
         $infoline = "ERROR: We cannot create transformations yet (we cannot use cscript.exe when cross-compiling)\n";
         push( @installer::globals::logfileinfo, $infoline);
     }
-    my $tmpdir = $ENV{TMPDIR};    # Variable %TEMP% will be set to it for WiLangId.vbs to work
     my $wilangid = $ENV{WINDOWS_SDK_HOME} . "/Samples/SysMgmt/Msi/scripts/WiLangId.vbs";
 
     my $from = cwd();
@@ -837,7 +836,7 @@
         }
     }
 
-    $systemcall = "TEMP=" . $tmpdir . " " . $cscript . " " . $wilangid . " " . $basedbname . " Package " . $templatevalue;
+    $systemcall = "TEMP=$ENV{'TMPDIR'} $cscript $wilangid $basedbname Package $templatevalue";
 
     $returnvalue = system($systemcall);
 
@@ -1225,11 +1224,6 @@
     $infoline = "chdir: $to \n";
     push( @installer::globals::logfileinfo, $infoline);
 
-    # changing the tmp directory, because makecab.exe generates temporary cab files
-    my $origtemppath = "";
-    if ( $ENV{'TMP'} ) { $origtemppath = $ENV{'TMP'}; }
-    $ENV{'TMP'} = $installer::globals::temppath;    # setting TMP to the new unique directory!
-
     my $maxmakecabcalls = 3;
     my $allmakecabcalls = $#{$localpackjobref} + 1;
 
@@ -1292,9 +1286,6 @@
     }
 
     installer::logger::include_timestamp_into_logfile("Performance Info: Execute packaging end");
-
-    # setting back to the original tmp directory
-    $ENV{'TMP'} = $origtemppath;
 
     chdir($from);
     $infoline = "chdir: $from \n";
diff --git a/solenv/bin/ooinstall b/solenv/bin/ooinstall
index b9d52e5..4902dda 100755
--- a/solenv/bin/ooinstall
+++ b/solenv/bin/ooinstall
@@ -33,12 +33,8 @@
 
 if (defined($ENV{TMPDIR})) {
     $tmp_dir = $ENV{TMPDIR};
-} elsif (defined($ENV{TMP})) {
-    $tmp_dir = $ENV{TMP};
-} else {
-    $tmp_dir = '/tmp';
 }
-if (!-d $tmp_dir) {die "Set TMP or TMPDIR!\n";}
+if (!-d $tmp_dir) {die "Set TMPDIR!\n";}
 
 # Workaround for system Mozilla
 if ($ENV{'SYSTEM_MOZILLA'} eq 'YES') {

-- 
To view, visit https://gerrit.libreoffice.org/3701
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8ac3f8d92e5f971c5237b85f66f7c0a58932930
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>



More information about the LibreOffice mailing list