Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Possible ZSH bug with IO direction

On Sun, 24 Apr 2016, Peter Stephenson wrote:

Date: Sun, 24 Apr 2016 20:01:32 +0100
From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
To: zsh-workers@xxxxxxx
Subject: Re: Possible ZSH bug with IO direction

Greetings, Peter S.
  I'm the author of the offending Cygwin pre-main hook, so you can
squarely level any complains about it at me.  I'm also the maintainer of
the Cygwin port, for whatever that's worth.  :)

On Sun, 24 Apr 2016 11:36:44 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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.

No, it's not.  Neither is "text" mode. :)

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 tried to put this kind of specific control (O_TEXT) only in input.c (and a few other places), but there are too many places in the code that just "know" line-termination is 1 character and either loop trying to read more input or simply choke on the difference in size read vs. size expected. It quickly became dozens of source modules affected and still I wasn't catching them all. I never really got it to work fully and just gave up, putting in the pre-main hook as a band-aid until some better solution presented itself. Really, the code needs to understand CR+LF. I lacked the time to fully understand all of the Zsh code so never went back to try and create a proper fix. Some guidance on this would be welcome.


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

Messages sorted by: Reverse Date, Date, Thread, Author