zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Vin Shelton" <acs@alumni.princeton.edu>, cygwin@cygwin.com
Cc: zsh-workers@sunsite.dk
Subject: Re: gunzip 1.3.5 error reading from stdin on Cygwin
Date: Sun, 29 Oct 2006 09:52:23 -0800	[thread overview]
Message-ID: <061029095227.ZM8389@torch.brasslantern.com> (raw)
In-Reply-To: <20a807210610290514k7f17abdfja21c611b45ff468b@mail.gmail.com>

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);

-- 


      reply	other threads:[~2006-10-29 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29 13:14 Vin Shelton
2006-10-29 17:52 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=061029095227.ZM8389@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=acs@alumni.princeton.edu \
    --cc=cygwin@cygwin.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).