On Thu, Dec 11, 2008 at 10:30:25AM +0100, Taco Hoekwater wrote: > > > Khaled Hosny wrote: > > On Wed, Dec 10, 2008 at 10:49:29AM +0100, Taco Hoekwater wrote: > >> * A small fix for a crash that could happen when using > >> external OCPs. > > > > Thanks for the fix. Another issue, with external OCPs, luatex easily > > exceeds maximum open files limit on linux an segfaults. A 20 pages > > ConTeXt file has around 3000 /tmp/__aleph__{in,out}* open files. I had > > to increase the max. limit to get around this. > > There was a missing fclose() in run_external_ocp. Fixed in SVN.
This actually fixes half the issue, luatex were keeping to open instants of each output file and one of each input file, now it keeps one of each. It turned out that each input and output file is opened twice because mkstemp() opens the newly created file and returns a file descriptor. The attached patch, almost copied from Omega's omegabis.c file, takes care of this. Regards, -- Khaled Hosny Arabic localizer and member of Arabeyes.org team
--- luatex.c.old 2008-12-19 03:03:48.000000000 +0200 +++ luatex.c 2008-12-19 03:02:56.000000000 +0200 @@ -101,6 +101,8 @@ char *out_file_name; FILE *in_file; FILE *out_file; + int in_file_fd; + int out_file_fd; char command_line[400]; int i; unsigned c; @@ -119,12 +121,13 @@ tempenv = "c:/tmp"; /* "/tmp" is not good if we are on a CD-ROM */ in_file_name = concat(tempenv, "/__aleph__in__XXXXXX"); mktemp(in_file_name); + in_file = fopen(in_file_name, FOPEN_WBIN_MODE); #else in_file_name = strdup("/tmp/__aleph__in__XXXXXX"); - mkstemp(in_file_name); + in_file_fd = mkstemp(in_file_name); + in_file = fdopen(in_file_fd, FOPEN_WBIN_MODE); #endif /* WIN32 */ - in_file = fopen(in_file_name, FOPEN_WBIN_MODE); for (i = 1; i <= otp_input_end; i++) { c = otp_input_buf[i]; @@ -171,15 +174,16 @@ #ifdef WIN32 out_file_name = concat(tempenv, "/__aleph__out__XXXXXX"); mktemp(out_file_name); + out_file = fopen(out_file_name, FOPEN_RBIN_MODE); #else out_file_name = strdup("/tmp/__aleph__out__XXXXXX"); - mkstemp(out_file_name); + out_file_fd = mkstemp(out_file_name); + out_file = fdopen(out_file_fd, FOPEN_RBIN_MODE); #endif sprintf(command_line, "%s <%s >%s\n", external_ocp_name + 1, in_file_name, out_file_name); system(command_line); - out_file = fopen(out_file_name, FOPEN_RBIN_MODE); otp_output_end = 0; otp_output_buf[otp_output_end] = 0; while ((c_in = fgetc(out_file)) != -1) {
signature.asc
Description: Digital signature
_______________________________________________ dev-context mailing list dev-context@ntg.nl http://www.ntg.nl/mailman/listinfo/dev-context