bug-gnulib
[Top][All Lists]
Advanced

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

javacomp: conftest.java is deleted before compiling


From: Daiki Ueno
Subject: javacomp: conftest.java is deleted before compiling
Date: Fri, 20 Sep 2013 16:22:57 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi,

Regarding the bug report for gettext:
https://lists.gnu.org/archive/html/bug-gettext/2013-09/msg00010.html

javacomp.c has the following code to check if javac can compile some
Java programs.  First, it writes out some code snippet to a temporary
file and then call javac command on the written file.  Like this:

 write_temp_file (tmpdir, conftest_file_name,
                  get_goodcode_snippet (source_version));

 ...

 java_sources[0] = conftest_file_name;
 compile_using_javac (java_sources, 1, ...);

write_temp_file opens the file with fopen_temp and close it with
fwriteerror_temp at the end:

 static bool
 write_temp_file (struct temp_dir *tmpdir, const char *file_name,
                  const char *contents)
 {
   FILE *fp;

   register_temp_file (tmpdir, file_name);
   fp = fopen_temp (file_name, "w");
   ...
   if (fwriteerror_temp (fp))
 }

As fopen_temp uses "D" mode on Windows, which implies the file will be
deleted on close (fwriteerror_temp here).  Thus, after calling
write_temp_file, the file will be deleted immediately.  Maybe we should
use plain fopen/fwriteerror here?

Regards,
-- 
Daiki Ueno



reply via email to

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