This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] Fix handling of temporary files


PING!

On Thu, Apr 19, 2012 at 01:18, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> Hi,
>
> the attached patch implements some fixes for handling STATUS="SCRATCH" files.
>
> - Currently, we check GFORTRAN_TMPDIR, TMP, and TEMP environment
> variables, but not the POSIX and GNU standard TMPDIR. As specifying a
> temporary directory depending on the compiler used to create an
> application doesn't make much sense, the patch just uses the standard
> TMPDIR (on Windows TMP and TEMP are used, and on MingW/Cygwin those
> variables are still checked)
>
> - The patch tries to create a temporary file in the first possible
> directory, and tries the next directory in the list if the current one
> fails, and so on. Document this search logic.
>
> - Use the macro P_tmpdir which is available on many systems.
>
> - If the program is privileged, we shouldn't trust path style
> environment variables. The patch fixes this for TMPDIR and also for
> the logic figuring out where addr2line is.
>
> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> gcc/fortran ChangeLog:
>
> 2012-04-19 ÂJanne Blomqvist Â<jb@gcc.gnu.org>
>
> Â Â Â Â* gfortran.texi (GFORTRAN_TMPDIR): Rename to TMPDIR, explain
> Â Â Â Âalgorithm for choosing temp directory.
>
>
> libgfortran ChangeLog:
>
> 2012-04-19 ÂJanne Blomqvist Â<jb@gcc.gnu.org>
>
> Â Â Â Â* config.h.in: Regenerated.
> Â Â Â Â* configure: Regenerated.
> Â Â Â Â* configure.ac: Add checks for getegid and __secure_getenv.
> Â Â Â Â* io/unix.c (P_tmpdir): Fallback definition for macro.
> Â Â Â Â(tempfile_open): New function.
> Â Â Â Â(tempfile): Use secure_getenv, call tempfile_open to try each
> Â Â Â Âdirectory in turn.
> Â Â Â Â* libgfortran.h (DEFAULT_TMPDIR): Remove macro.
> Â Â Â Â(secure_getenv): New macro/prototype.
> Â Â Â Â* runtime/environ.c (secure_getenv): New function.
> Â Â Â Â(variable_table): Rename GFORTRAN_TMPDIR to TMPDIR.
> Â Â Â Â* runtime/main.c (find_addr2line): Use secure_getenv.
>
> --
> Janne Blomqvist



-- 
Janne Blomqvist


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]