[Top][All Lists]

[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)


Regarding the bug report for gettext:

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?

Daiki Ueno

reply via email to

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