[tex-k] tex/pdftex -recorder works incorrectly on parrallel TeX runs (race, breaks make -j)

Eddie Kohler kohler at cs.ucla.edu
Tue Mar 30 02:17:45 CEST 2010


Karl,

****
recorder_name = (string)xmalloc(strlen(kpse_program_name) + strlen(pid_str) + 5);
****

E



Karl Berry wrote:
> I made the change below (this is web2c/lib/openclose.c), let me know if
> problems.  I hope compilers won't give any guff about the cast and sprintf.
> 
> k
> 
> --- openclose.c (revision 17609)
> +++ openclose.c (working copy)
> @@ -37,12 +37,19 @@
>  static void
>  recorder_start(void)
>  {
> -    /* Alas, while we might want to use mkstemp it is not portable.
> -       So we have to be content with using a default name... */
> +    /* Alas, while we'd like to use mkstemp it is not portable,
> +       and doing the autoconfiscation (and providing fallbacks) is more
> +       than we want to cope with.  So we have to be content with using a
> +       default name.  Throw in the pid so at least parallel builds might
> +       work (Debian bug 575731).  */
>      string cwd;
> +    pid_t pid = getpid();
> +    char pid_str[MAX_INT_LENGTH];
> +    sprintf (pid_str, "%ld", (long) pid);
> 
>      recorder_name = (string)xmalloc(strlen(kpse_program_name)+5);
>      strcpy(recorder_name, kpse_program_name);
> +    strcat(recorder_name, pid_str);
>      strcat(recorder_name, ".fls");
> 
>      /* If an output directory was specified, use it instead of cwd.  */


More information about the tex-k mailing list