[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: javacomp: conftest.java is deleted before compiling
From: |
Daiki Ueno |
Subject: |
Re: javacomp: conftest.java is deleted before compiling |
Date: |
Sun, 22 Sep 2013 21:23:24 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Eric Blake <address@hidden> writes:
> That's not the first time I've encountered a problem with mingw's
> temporary files being deleted on close. See this m4 commit:
>
> git.sv.gnu.org/cgit/m4.git/commit/?id=11199a26
>
> So yes, it sounds like we need to avoid temporary files if we want them
> to persist past the close. Are you up to writing a patch along those lines?
I'm attaching a patch, though I wonder if the delete-on-close flag is
really useful - if temporary files don't persist, does it make sense to
check write errors in fwriteerror_temp?
Also, I found cleanup_temp_dir is missing in a few places in
javacomp.c. See the second patch for that.
Regards,
--
Daiki Ueno
>From 54c6e156989df415c53d44fb516d3b545b2ed80a Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Sun, 22 Sep 2013 18:50:43 +0900
Subject: [PATCH 1/2] javacomp: make conftest.java persist after write
* lib/javacomp.c (write_temp_file): Use plain fopen/fwriteerror instead of
fopen_temp/fwriteerror_temp to make the file persist after the call of this
function.
---
lib/javacomp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/javacomp.c b/lib/javacomp.c
index fca7343..d37c924 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -497,7 +497,7 @@ write_temp_file (struct temp_dir *tmpdir, const char
*file_name,
FILE *fp;
register_temp_file (tmpdir, file_name);
- fp = fopen_temp (file_name, "w");
+ fp = fopen (file_name, "w");
if (fp == NULL)
{
error (0, errno, _("failed to create \"%s\""), file_name);
@@ -505,7 +505,7 @@ write_temp_file (struct temp_dir *tmpdir, const char
*file_name,
return true;
}
fputs (contents, fp);
- if (fwriteerror_temp (fp))
+ if (fwriteerror (fp))
{
error (0, errno, _("error while writing \"%s\" file"), file_name);
return true;
--
1.8.3.2
>From 95b6e3e2a7b9e63963bd55e1ae4d8c505e89784c Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Sun, 22 Sep 2013 19:05:57 +0900
Subject: [PATCH 2/2] javacomp: add missing cleanup of temporary directories
* lib/javacomp.c (is_envjavac_gcj43_usable)
(is_envjavac_nongcj_usable, is_gcj43_usable, is_javac_usable):
Cleanup temporary directory used to compile test programs.
---
lib/javacomp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/javacomp.c b/lib/javacomp.c
index d37c924..4829654 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -858,6 +858,8 @@ is_envjavac_gcj43_usable (const char *javac,
free (compiled_file_name);
free (conftest_file_name);
+ cleanup_temp_dir (tmpdir);
+
resultp->tested = true;
}
@@ -1301,6 +1303,8 @@ is_envjavac_nongcj_usable (const char *javac,
free (compiled_file_name);
free (conftest_file_name);
+ cleanup_temp_dir (tmpdir);
+
resultp->tested = true;
}
@@ -1638,6 +1642,8 @@ is_gcj43_usable (const char *source_version,
free (compiled_file_name);
free (conftest_file_name);
+ cleanup_temp_dir (tmpdir);
+
resultp->tested = true;
}
@@ -2033,6 +2039,8 @@ is_javac_usable (const char *source_version, const char
*target_version,
free (compiled_file_name);
free (conftest_file_name);
+ cleanup_temp_dir (tmpdir);
+
resultp->tested = true;
}
--
1.8.3.2