zsh-workers
 help / color / mirror / code / Atom feed
* Re: gunzip 1.3.5 error reading from stdin on Cygwin
@ 2006-10-29 13:14 Vin Shelton
  2006-10-29 17:52 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Vin Shelton @ 2006-10-29 13:14 UTC (permalink / raw)
  To: cygwin; +Cc: zsh-workers

(added cc: to zsh-workers.  The original message can be found at
http://www.mail-archive.com/cygwin@cygwin.com/msg73620.html )

Vin Shelton wrote:
> After upgrading my system this morning, I'm getting an error running
> gunzip when it reads from stdin.
>
> Steps to reproduce:
>
>     wget ftp://ftp.gnu.org/gmp/gmp-4.2.1.tar.gz
>     gunzip < gmp-4.2.1.tar.gz >/dev/null
>
> This sequence yields the following errors:
>
>     gunzip: stdin: invalid compressed data--crc error
>
>     gunzip: stdin: invalid compressed data--length error
>
>
> Interestingly,
>
>     gunzip gmp-4.2.1.tar.gz
>
> works.

I've narrowed this down a little bit.  It only happens under zsh;
under bash, the recipe works without error.  Thinkging that for some
reason, stdin was being opened in a text mode, I tried setting
CYGWIN=binmode before starting zsh, but that had no effect on this
problem.

I believe the upgrade that broke this was the most recent
gettext/libintl upgrade.  In order to link against the most recent
libintl, I have rebuilt zsh from source (both from the cygwin source
tarball and also from the latest zsh sources in CVS), but still the
problem persists.

I would appreciate any help that can be offered.

Thanks,
  Vin

-- 
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gunzip 1.3.5 error reading from stdin on Cygwin
  2006-10-29 13:14 gunzip 1.3.5 error reading from stdin on Cygwin Vin Shelton
@ 2006-10-29 17:52 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2006-10-29 17:52 UTC (permalink / raw)
  To: Vin Shelton, cygwin; +Cc: zsh-workers

On Oct 29,  5:14am, Vin Shelton wrote:
} Subject: Re: gunzip 1.3.5 error reading from stdin on Cygwin
}
} I've narrowed this down a little bit.  It only happens under zsh;
} under bash, the recipe works without error.

In zsh's main.c is this comment:

 * Cygwin supports the notion of binary or text mode access to files
 * based on the mount attributes of the filesystem.  If a file is on
 * a binary mounted filesystem, you get exactly what's in the file, CRLF's
 * and all.  If it's on a text mounted filesystem, Cygwin will strip out
 * the CRs.  This presents a problem because zsh code doesn't allow for
 * CRLF's as line terminators.  So, we must force all open files to be
 * in text mode reguardless of the underlying filesystem attributes.
 * However, we only want to do this for reading, not writing as we still
 * want to write files in the mode of the filesystem.  To do this,
 * we have two options: augment all {f}open() calls to have O_TEXT added to
 * the list of file mode options, or have the Cygwin runtime do it for us.
 * I choose the latter. :)
 *
 * Cygwin's runtime provides pre-execution hooks which allow you to set
 * various attributes for the process which effect how the process functions.
 * One of these attributes controls how files are opened.  I've set
 * it up so that all files opened RDONLY will have the O_TEXT option set,
 * thus forcing line termination manipulation.  This seems to solve the
 * problem (at least the Test suite runs clean :).
 *
 * Note: this may not work in later implementations.  This will override
 * all mode options passed into open().  Cygwin (really Windows) doesn't
 * support all that much in options, so for now this is OK, but later on
 * it may not, in which case O_TEXT will have to be added to all opens calls
 * appropriately.

The actual code is:

    static struct __cygwin_perfile pf[] =
    {
        {"", O_RDONLY | O_TEXT},
        {NULL, 0}
    };
    cygwin_internal (CW_PERFILE, pf);

-- 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-29 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-29 13:14 gunzip 1.3.5 error reading from stdin on Cygwin Vin Shelton
2006-10-29 17:52 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).