diff libinterp/corefcn/variables.cc @ 26677:33f79d94f21f

Create any BIST temporary files in writable temporary directory (bug #55565). * help.cc: Call tempname with DIR argument of P_tmpdir to generate a name in temporary directory. Save PATH variable before unwind_protect. Use addpath() to put P_tmpdir on PATH variable for length of BIST test. Use path() in unwind_protect_cleanup to restore the PATH variable. * variables.cc (Fexist): Call tempname() without argument so that name is created in P_tmpdir() directory.
author Rik <rik@octave.org>
date Mon, 04 Feb 2019 13:47:15 -0800
parents cf9e10ce3351
children 2b6aa96a5c82
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Mon Feb 04 18:27:12 2019 +0000
+++ b/libinterp/corefcn/variables.cc	Mon Feb 04 13:47:15 2019 -0800
@@ -472,13 +472,13 @@
 
 ## Don't search path for absolute filenames
 %!test
-%! tname = tempname (pwd ());
+%! tname = tempname ();
 %! unwind_protect
 %!   ## open/close file to create it, equivalent of touch
 %!   fid = fopen (tname, "w");
 %!   fclose (fid);
 %!   [~, fname] = fileparts (tname);
-%!   assert (exist (fullfile (pwd (), fname), "file"), 2);
+%!   assert (exist (fullfile (P_tmpdir (), fname), "file"), 2);
 %! unwind_protect_cleanup
 %!   unlink (tname);
 %! end_unwind_protect