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,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc;
        bh=+SJWc05asqZFTFPOmiFjME6W64L/cPaXKeyfcJS+n3E=;
        b=nM36/lgmQids1ecn03V+8rYWZrXMSnWmmPyl0QvmeG3fiA/U6sNQ+Xmi6fUxDXIUXv
         WtLwLzDLZsAEe8HQGxO9aKEiVHxzDh5ZIRFc3YorCULW3XXCmuOYMIANDDumPaJMF/4m
         /EyH3y0A0JSg/qqJtXGtu/kPBii5sjnaxC+xEPPpWEb/CYCh12NyxNtAgzvvmvemKh44
         pI9JVfLZlmaH+DQIPjK/amHyTUfeGAozcz7aIqhCtCPzMSdD6hgrBJB0a3q+tS1tbCEB
         CfB8FMuQ5lYscRNXhSCUbcyqBPajK8/TZs+uUcSl5QnXZpxsYTKHKkz3hY/qvHFOw23F
         AmgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:cc;
        bh=+SJWc05asqZFTFPOmiFjME6W64L/cPaXKeyfcJS+n3E=;
        b=bvIAxamvV7autUmYOJjDk+HfERWnpOkaT8KnGtLAcuFZPJwehgRv1nMmNvoZcyjb33
         LfgRcWW/JKTZ6apKiNcFB2O+GaRhcEiTt6Wm4nbgxJZANgugOE3QqB7+RoHxPCZoI/R3
         AlLF6LSHybBTwdHSqKkCWzwvXI8hV+gWoLWiMOrCFCYuARBvonfqoAEyeNZ4aH72UkQR
         D2Up+8Ry7PU+NWiR9Y0I3hiOgO9o0C2EuI2rYNsoPW1tpJCpb87nPxVAWd8+9VpCQjex
         kEO6dD0V5o8+cyAe208gOWH/KDzhQh9uN/KqYI4Fe+fT+EkEFagV06brD7kqogNCUfR3
         zVwg==
X-Gm-Message-State: AOPr4FVSI6ZGW4uc2tr4KrGxJGHF25h+qa4VrnP2+aK5PfcDcUTe9O3VIKnVhRCdN4bedWye3FP3JRkKpsCByQ==
MIME-Version: 1.0
X-Received: by 10.25.208.144 with SMTP id h138mr11754490lfg.48.1461606469874;
 Mon, 25 Apr 2016 10:47:49 -0700 (PDT)
In-Reply-To: <alpine.LNX.2.00.1604251026300.6490@ming.fruitbat.org>
References: <571BBF3C.50402@matrix.ai>
	<160423151436.ZM6912@torch.brasslantern.com>
	<571CFD70.7090506@matrix.ai>
	<160424113558.ZM3564@torch.brasslantern.com>
	<alpine.LNX.2.00.1604251026300.6490@ming.fruitbat.org>
Date: Mon, 25 Apr 2016 10:47:49 -0700
Message-ID: <CAH+w=7a2mRteXctrxr8=Opod2vZdJR3yfVA2LY+d1Azbq4giVA@mail.gmail.com>
Subject: Re: Possible ZSH bug with IO direction
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Peter A. Castro" <doctor@fruitbat.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 38340

On Mon, Apr 25, 2016 at 10:31 AM, Peter A. Castro <doctor@fruitbat.org> wrote:
>
> I believe the best solution is to teach Zsh code to handle CR+LF properly,

Which means we're back to the "dozens of source modules" you mentioned.
There's no central place for this; because of vagaries of other I/O systems
(e.g. STREAMS modules), there's not even a consistent use of stdio vs.
low-level read/write (though at least they're usually not mixed on the same
descriptors).

I haven't looked closely at this (and have no idea whether it's possible with
the pre-main hook in place) but perhaps put the descriptors back into
binary mode somewhere in exec.c between whatever passes for zfork()
on cygwin and the actual execve() of any external process?  We mostly
know when a zsh builtin vs. an external command is being run.

Either way the external commands are on their own -- the question is
whether they're better off getting binary when they expect text or the
other way around (as currently).

