Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=20120113;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-transfer-encoding;
        bh=52KoLaLdrgkl9KG7qsVKdxlWFgRDLC2TOKCPdh+gqxg=;
        b=QUcIZdzfCiSS+kSwh915egBoBTWPEhfuQ36VHdeJ7/QO9rA1iu6YZVj1r8mIGhERyp
         TvBPftkpO1LKKlGrliJ16L014I77KF9Py0EMo0+2f6dnzpW+dg3tg9i1n5NHpDlaDmPc
         DmLA3BoQamYvaK7xVR/InOmN4ZOSnHZpFh2TGIMuSlwieikDYU827XdRptRrXk5bTexf
         zalQdTdcVJYvlo3IbzyuJbPPdRt6L6TDKBEFz4lqsPb7Stb8cHzgtclrQ6SbqFpi1Tef
         krBKEQvdjDZRRhFCLRjDBUl8T+7S+fyM73+xvsRJ/EV1PwjM2wtVICHBGFkzLeWvmtju
         HIow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-transfer-encoding;
        bh=52KoLaLdrgkl9KG7qsVKdxlWFgRDLC2TOKCPdh+gqxg=;
        b=Pk+5g5lyloAKOHX5yTxXDDS6K8qGua2hg2FntB3kZaOMckWFVOKv/v3rfUJkgTjz/n
         Id0KsSYk6wNcYHn3JhBTpVW99QMynhtuGVO2SL50c/G+n8P0hHw9P8QbLRKlWx+bupIV
         +sM7woUkAXj4QDnryO8fs/rhGaMKTxEkhpdn/gh+xWCdlZna5OmHn2xdmv7CCeeE6Moz
         +Xbdv7uxiI2qDjafp1NxkbGrrSu5HQ4ioGrCkevifFFG0GaQC4KlmEkj2/fbhIlEgbFB
         rs6hh+t/ywE3k1q/vIJ3kYLWBiW/7aK7NQ/B9lM3g3W7qFF57u+7Y3FnPoKKgotHgACv
         +1kQ==
X-Gm-Message-State: AOPr4FU51Ld+WtfSvUpenQ38kwAj/FPt062C7XTb4ibJffh6T7gXDBI13Mk68O1D1iMpjw==
X-Received: by 10.194.166.228 with SMTP id zj4mr32157142wjb.83.1461532986098;
        Sun, 24 Apr 2016 14:23:06 -0700 (PDT)
Subject: Re: Possible ZSH bug with IO direction
To: zsh-workers@zsh.org
References: <571BBF3C.50402@matrix.ai>
 <160423151436.ZM6912@torch.brasslantern.com>
 <20160424131748.441d605f@pwslap01u.europe.root.pri>
 <160424113644.ZM3576@torch.brasslantern.com>
 <20160424200132.7d0d00bc@ntlworld.com>
From: m0viefreak <m0viefreak.cm@googlemail.com>
Message-ID: <571D3938.20905@googlemail.com>
Date: Sun, 24 Apr 2016 23:23:04 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101
 Thunderbird/38.7.2
MIME-Version: 1.0
In-Reply-To: <20160424200132.7d0d00bc@ntlworld.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 38331

On 24.04.2016 21:01, Peter Stephenson wrote:
> On Sun, 24 Apr 2016 11:36:44 -0700
> Bart Schaefer <schaefer@brasslantern.com> wrote:
>> On Apr 24,  1:17pm, Peter Stephenson wrote:
>> }
>> } Mounting the filesystem within Cygwin as binary works here.
>>
>> Really?  That contradicts what the main.c comment asserts.
> 
> So it seems like "binary" isn't quite what it's cracked up to be.
> 
> The alternative might be to do something similar in the lower levels of
> zsh, i.e. map \r\n to \n when reading shell input.  If done in input.c
> it's no worse than doing it in the OS abstraction, and doesn't affect
> fd's used by othe programmes.

I think the cygwin_premain0 in main.c is very dangerous.

In fact, bash had the same problem years ago and the hook was removed.
See http://cygwin.com/ml/cygwin/2006-10/msg00989.html for details.


Another example I found:

$ zcat < mc.1.gz > /dev/null
gzip: stdin: invalid compressed data--crc error
gzip: stdin: invalid compressed data--length error

zcat is forced to use O_TEXT and fails to decompress the file whil using
$ zcat mc.1.gz'
directy works just fine.



IMHO cygwin_premain0 should be removed completely. As a result,of
course, scripts created in windows editors such as notepad, that contain
CRLF line endings, could lead to syntax errors, but surely that's less
of a problem and easily fixable using a proper editor.

