bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: texinfo-5.9.90 pretest available


From: Gavin Smith
Subject: Re: texinfo-5.9.90 pretest available
Date: Thu, 26 Feb 2015 21:34:03 +0000

On 26 February 2015 at 20:12, Ken Brown <address@hidden> wrote:
> Yes, it's an error message from gzip.  I stepped through ginstall-info in gdb 
> and found that the error message comes right after the popen call in line 847 
> of install-info.c.
>
> Maybe I'm missing something, but how could that popen call possibly DTRT?  
> "gzip -d" has been called without being given the name of the file to 
> decompress.  Don't we need something like the following?
>
> Index: install-info/install-info.c
> ===================================================================
> --- install-info/install-info.c (revision 6157)
> +++ install-info/install-info.c (working copy)
> @@ -843,7 +843,7 @@
>
>    if (*compression_program)
>      { /* It's compressed, so open a pipe.  */
> -      char *command = concat (*compression_program, " -d", "");
> +      char *command = concat (*compression_program, " -d ", 
> *opened_filename);
>        f = popen (command, "r");
>        if (! f)
>          {
>

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.

It could be worth trying the Gnulib module for "popen".

   Gnulib module: popen

   Portability problems fixed by Gnulib:
   * This function is missing on some platforms: MSVC 9.

   * Some platforms start the child with closed stdin or stdout if the
     standard descriptors were closed in the parent: Cygwin 1.5.x.

I don't know if that applies here but it could do. I suggest importing
the module to see if it makes a difference.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]