[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63728] tempname() respects the TMP environmen
[Octave-bug-tracker] [bug #63728] tempname() respects the TMP environment variable and tempdir() does not
Mon, 30 Jan 2023 13:57:47 -0500 (EST)
Follow-up Comment #2, bug #63728 (project octave):
The whole issue of temporary names is confusing and should probably just be
re-architected in Octave. I used this script to test (attached as
printf ("tempdir: %s\n", tempdir ());
printf ("tempname: %s\n", tempname ());
printf ("P_tmpdir: %s\n", P_tmpdir ());
I then run with
octave-7.3.0 -f print_tmp.m
so that I am sure of the Octave version and also sure that any .octaverc files
are not changing the results.
As reported, tempdir() does not follow tempname() in choice of directory.
In terms of coding, Octave is showing some of its UNIX heritage. The function
"P_tmpdir" returns the default system temporary directory (not influenced by
user's environment variables). If we really need to have this function (I
don't know, but it could be important for build/testing situations where we
don't want the user's environment to affect results) then I think it should be
renamed to something more friendly (maybe, "sys_tempdir"?) rather than the
opaque, CamelCase name "P_tmpdir". If we don't need it then I would just
remove it from Octave completely.
Next, I would have tempdir() respect TMPDIR, TMP, and TEMP environment
variables. Once that modification was done then tempname() could be modified
to just use tempdir() to determine the directory.
As it is now, the Octave interpreter is calling out to liboctave for system
functions which in turn are coded in C and used via wrappers to gnulib. That
Additional Item Attachment:
File name: print_tmp.m Size:0 KB
Reply to this item at:
Message sent via Savannah