zsh-workers
 help / color / mirror / code / Atom feed
From: "Peter A. Castro" <doctor@fruitbat.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Possible ZSH bug with IO direction
Date: Mon, 25 Apr 2016 11:14:06 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1604251059060.6490@ming.fruitbat.org> (raw)
In-Reply-To: <CAH+w=7a2mRteXctrxr8=Opod2vZdJR3yfVA2LY+d1Azbq4giVA@mail.gmail.com>

On Mon, 25 Apr 2016, Bart Schaefer wrote:

> Date: Mon, 25 Apr 2016 10:47:49 -0700
> From: Bart Schaefer <schaefer@brasslantern.com>
> To: Peter A. Castro <doctor@fruitbat.org>
> Cc: Zsh hackers list <zsh-workers@zsh.org>
> Subject: Re: Possible ZSH bug with IO direction
> 
> 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).

Yes...I had noticed that in my first few attempts at "fixing" the code.
I quickly became overwhelmed at the scope of things.

> 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.

I did consider this, but there's something about using the pre-main hooks 
that prevents resetting the attributes.  I'll ask Corinna about it, but I 
suspect there isn't a way of doing it once the pre-main has been invoked.

In anycase, this also leads to your next comment:

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

That is its own can of worms.  The later is what mostly-works for 95% of 
the use-cases.  There is no good solution here, I'm afraid.

So, to sum things up:
   pre-main hook is bad.
   CR+LF is evil.
   Teaching the code to grok CR+LF is hard.
   Users don't like change and expect things to "just work".

Am I missing anything?  :-/

-- 
--=> Peter A. Castro
Email: doctor at fruitbat dot org / Peter dot Castro at oracle dot com
 	"Cats are just autistic Dogs" -- Dr. Tony Attwood


  reply	other threads:[~2016-04-25 18:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-23 18:30 Roger Qiu
2016-04-23 22:14 ` Bart Schaefer
2016-04-24 12:17   ` Peter Stephenson
2016-04-24 18:36     ` Bart Schaefer
2016-04-24 19:01       ` Peter Stephenson
2016-04-24 21:23         ` m0viefreak
2016-04-25  9:12           ` Peter Stephenson
2016-04-25 17:25           ` Peter A. Castro
2016-04-24 21:53         ` Bart Schaefer
2016-04-25  8:46           ` Peter Stephenson
2016-04-25 21:12           ` Mikael Magnusson
2016-04-25 17:16         ` Peter A. Castro
2016-04-24 17:08   ` Roger Qiu
2016-04-24 18:35     ` Bart Schaefer
2016-04-25 17:31       ` Peter A. Castro
2016-04-25 17:47         ` Bart Schaefer
2016-04-25 18:14           ` Peter A. Castro [this message]
2016-04-26  9:16             ` Peter Stephenson

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=alpine.LNX.2.00.1604251059060.6490@ming.fruitbat.org \
    --to=doctor@fruitbat.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).