Menu

#147 \input| doesn't work correctly on Mac OS X

Future
closed
nobody
Mac OS X (1)
1
2019-04-25
2018-01-29
Anonymous
No

If I typeset the following noinput.tex test file with “xetex -shell-escape noinput”

---\input"|echo $(date)”\relax---

---\input"|echo $(date)”\relax---

\bye

the console output is

xetex -shell-escape noinput
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xetex)
\write18 enabled.
entering extended mode
(./noinput.tex (|echo $(date)---) (|echo $(date)---) [1] >

Note the missing newline. No PDF file is produced. If I call it as

xetex -shell-escape -no-pdf noinput && xdvipdfmx noinput

then a PDF file is produced, but only the first \input| command shows output. The
second one seems to just produce a \par. The console output, in this case, is

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xetex)
\write18 enabled.
entering extended mode
(./noinput.tex (|echo $(date)) (|echo $(date)) [1] )
Output written on noinput.xdv (1 page, 288 bytes).
Transcript written on noinput.log.
noinput -> noinput.pdf
[1]
3338 bytes written

The log file shows nothing suspicious.

Tested on Mac OS X 10.10 (Yosemite), 10.12 (Sierra), 10.13 (HighSierra). On other platforms the behavior is as expected.

1 Attachments

Discussion

  • Enrico Gregorio

    Enrico Gregorio - 2018-01-29

    Sorry for the anonymous, I forgot to log in.

     
  • Hironobu Yamashita

    Same on my Mac (OS X 10.11.6 El Capitan), x86_64-darwin self build (source from r46522).

    I get a similar result from the following:

    %#!xetex test.tex
    ---\immediate\openin10="|kpsewhich latex.ltx"\relax---
    \closein10
    \bye
    

    When I comment out \closein10, the problem disappears. I guess something wrong is happening when closing the pipe, as xdvipdfmx gets XeTeX output through pipe if -no-pdf is not effective.

     

    Last edit: Hironobu Yamashita 2018-02-02
  • Hironobu Yamashita

    The followings are tested on OS X 10.11.6 El Capitan:

    By embedding some debug codes into pipe open/close procedure,

    Index: web2c/lib/texmfmp.c
    ===================================================================
    --- web2c/lib/texmfmp.c (revision 46524)
    +++ web2c/lib/texmfmp.c (working copy)
    @@ -2046,6 +2046,7 @@
           for (i=0; i<NUM_PIPES; i++) {
             if (pipes[i]==NULL) {
               pipes[i] = *f_ptr;
    
    +          fprintf(stdout,"PIPE %d (openinorpipe): %s\n", i,((const_string)(nameoffile+1))+1);
               break;
             }
           }
    @@ -2091,6 +2092,7 @@
           for (i=0; i<NUM_PIPES; i++) {
             if (pipes[i]==NULL) {
               pipes[i] = (*f)->f;
    +          fprintf(stdout,"PIPE %d (uopeninorpipe): %s\n", i,((const_string)(nameoffile+1))+1);
               break;
             }
           }
    @@ -2139,6 +2141,7 @@
           for (i=0; i<NUM_PIPES; i++) {
             if (pipes[i]==NULL) {
               pipes[i] = *f_ptr;
    +          fprintf(stdout,"PIPE %d (uopenoutorpipe): %s\n", i,((const_string)(nameoffile+1))+1);
               break;
             }
           }
    @@ -2164,6 +2167,7 @@
           if (pipes[i] == f) {
             if (f) {
               pclose (f);
    +          fprintf(stdout,"PIPE %d (closefileorpipe): %s\n", i,((const_string)(nameoffile+1))+1);
     #ifdef WIN32
               Poptr = NULL;
     #endif
    Index: web2c/xetexdir/XeTeX_ext.c
    ===================================================================
    --- web2c/xetexdir/XeTeX_ext.c  (revision 46524)
    +++ web2c/xetexdir/XeTeX_ext.c  (working copy)
    @@ -2724,6 +2724,7 @@
             }
     #else
             *fptr = popen(cmd, "w");
    +        fprintf(stdout,"PIPE DVI OUTPUT started.\n");
     #endif
             free(cmd);
             return (*fptr != 0);
    @@ -2738,6 +2739,7 @@
                 return errno;
         } else {
             return pclose(fptr);
    +        fprintf(stdout,"PIPE DVI OUTPUT ended.\n");
         }
         return 0;
     }
    

    By processing the following source (pipe0.tex),

    ---\immediate\openin10="|kpsewhich latex.ltx"\relax---
    ---\immediate\openin12="|kpsewhich latex.ltx"\relax---
    \closein12
    \closein10
    ---\immediate\openin14="|kpsewhich latex.ltx"\relax---
    ---\immediate\openin13="|kpsewhich latex.ltx"\relax---
    \closein14
    \closein13
    \bye
    

    XeTeX log output contains

    PIPE 0 (uopeninorpipe): kpsewhich latex.ltx
    PIPE 1 (uopeninorpipe): kpsewhich latex.ltx
    PIPE 2 (uopeninorpipe): kpsewhich latex.ltx
    PIPE 3 (uopeninorpipe): kpsewhich latex.ltx
     [1PIPE DVI OUTPUT started.
    

    The expected output can be obtained from pdfTeX, Aleph, pTeX etc:

    PIPE 0 (openinorpipe): kpsewhich latex.ltx
    PIPE 1 (openinorpipe): kpsewhich latex.ltx
    PIPE 1 (closefileorpipe): kpsewhich latex.ltx
    PIPE 0 (closefileorpipe): kpsewhich latex.ltx
    PIPE 0 (openinorpipe): kpsewhich latex.ltx
    PIPE 1 (openinorpipe): kpsewhich latex.ltx
    PIPE 0 (closefileorpipe): kpsewhich latex.ltx
    PIPE 1 (closefileorpipe): kpsewhich latex.ltx
    

    So, it seems that XeTeX is failing to close the correct pipe. (Actually, the closing is done separately by uclose() defined in XeTeX_ext.c)

     

    Last edit: Hironobu Yamashita 2018-02-03
  • Hironobu Yamashita

    I wrote a patch to fix this issue; working fine on my Mac.

     
  • Jonathan Kew

    Jonathan Kew - 2018-02-03

    Thanks for looking into this! Patch applied.

     
  • Jonathan Kew

    Jonathan Kew - 2018-02-03
    • status: open --> closed
     
  • Jonathan Kew

    Jonathan Kew - 2018-02-03

    Fixed in 49e5f5ec9383e4cb2d54c64436974720c30d3d6d for version 0.99999.

     
  • Hironobu Yamashita

    Thanks for checking; your commit acfb33ced483f900bc7986087eb8d416ed8812e2 is correctly installed (TeX Live svn r46526). Hope #145 fixed as well for TL18.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB