From: Florian Krohm Date: Sat, 21 Jun 2014 20:25:30 +0000 (+0000) Subject: ms_print ought to create temporary files in a proper directory as X-Git-Tag: svn/VALGRIND_3_10_0~360 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31caca50d59867d92c38c81543c98cc53a396e64;p=thirdparty%2Fvalgrind.git ms_print ought to create temporary files in a proper directory as specified with --with-tmpdir at configuration time or with TMPDIR at runtime. Doing so fixes the symptom reported in BZ #332765. Also fix an incorrect error message. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14077 --- diff --git a/NEWS b/NEWS index 6c2cac1071..f139f3cf56 100644 --- a/NEWS +++ b/NEWS @@ -143,6 +143,7 @@ where XXXXXX is the bug number as listed below. client requests 332276 Implement additional Xen hypercalls 332658 ldrd.w r1, r2, [PC, #imm] does not adjust for 32bit alignment +332765 Fix ms_print to create temporary files in a proper directory 333072 drd: Add semaphore annotations 333145 Tests for missaligned PC+#imm access for arm 333228 AAarch64 Missing instruction encoding: mrs %[reg], ctr_el0 diff --git a/configure.ac b/configure.ac index 14c4fbf2d0..e87a2e4c66 100644 --- a/configure.ac +++ b/configure.ac @@ -801,6 +801,7 @@ AC_ARG_WITH(tmpdir, tmpdir="$withval", tmpdir="/tmp") AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory]) +AC_SUBST(VG_TMPDIR, [$tmpdir]) #---------------------------------------------------------------------------- diff --git a/docs/internals/3_9_BUGSTATUS.txt b/docs/internals/3_9_BUGSTATUS.txt index 8b06171cce..93263c8fcc 100644 --- a/docs/internals/3_9_BUGSTATUS.txt +++ b/docs/internals/3_9_BUGSTATUS.txt @@ -108,8 +108,6 @@ For bugs reported before this time, see 3_8_BUGSTATUS.txt === Tools/Massif ======================================================= -332765 ms_print reports bad error if temp file can't be created - in current directory === Tools/Cachegrind =================================================== diff --git a/massif/ms_print.in b/massif/ms_print.in index e6ffdbff8d..5696653e0a 100755 --- a/massif/ms_print.in +++ b/massif/ms_print.in @@ -51,8 +51,13 @@ my $graph_y = 20; # Input file name my $input_file = undef; +# Where to create tmp files. See also function VG_(tmpdir) in m_libcfile.c. +my $tmp_dir = $ENV{"TMPDIR"}; +$tmp_dir = "@VG_TMPDIR@" if (! $tmp_dir); +$tmp_dir = "/tmp" if (! $tmp_dir); + # Tmp file name. -my $tmp_file = "ms_print.tmp.$$"; +my $tmp_file = "$tmp_dir/ms_print.tmp.$$"; # Version number. my $version = "@VERSION@"; @@ -390,7 +395,7 @@ sub read_input_file() # Print snapshot list header to $tmp_file. #------------------------------------------------------------------------- open(TMPFILE, "> $tmp_file") - || die "Cannot open $tmp_file for reading\n"; + || die "Cannot open $tmp_file for writing\n"; my $time_column = sprintf("%14s", "time($time_unit)"); my $column_format = "%3s %14s %16s %16s %13s %12s\n";