octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63728] tempname() respects the TMP environmen


From: Rik
Subject: [Octave-bug-tracker] [bug #63728] tempname() respects the TMP environment variable and tempdir() does not
Date: 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
print_tmp.m):


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
seems hard.


(file #54290)

    _______________________________________________________

Additional Item Attachment:

File name: print_tmp.m                    Size:0 KB
    <https://file.savannah.gnu.org/file/print_tmp.m?file_id=54290>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63728>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]