On 2/27/2015 2:00 AM, Eli Zaretskii wrote:
Date: Thu, 26 Feb 2015 21:34:03 +0000
From: Gavin Smith <[email protected]>
Cc: Eli Zaretskii <[email protected]>, Karl Berry <[email protected]>, Texinfo
<[email protected]>
I checked the 5.2 release and it was done differently. The code looked like:
if (*compression_program)
{ /* It's compressed, so fclose the file and then open a pipe. */
char *command = concat (*compression_program," -cd <", *opened_filename);
if (fclose (f) < 0)
pfatal_with_name (*opened_filename);
f = popen (command, "r");
if (f)
*is_pipe = 1;
else
pfatal_with_name (command);
}
The ChangeLog entry on 2014-02-19 explains:
* install-info/install-info.c (open_possibly_compressed_file):
Work even if the file name contains arbitrary shell
metacharacters, for example:
install-info --info-dir="/d/a b/info" "/d/a b/info/emacs.info.gz"
Do this by running the decompressor on standard
input, rather than by having the shell open the file.
Return either stdin or a pipe.
Don't bother with IS_PIPE arg; no longer needed.
All callers changed. Check for freopen failure.
I wonder if there is a problem with Cygwin with two processes having
the same file open at once, or else.
Ken, could this have something to do with text vs binary I/O mode?
Perhaps the stdin that gzip inherits is not in binary mode, or
something like that?
No, it turns out that it has to do with buffered I/O. See the thread starting
here:
https://cygwin.com/ml/cygwin/2015-02/msg00887.html
Replacing the fseek in line 841 by another call to freopen fixes the problem. I
don't know if that's the best solution.
Ken