delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/12/13:06:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 12 Jun 2003 18:05:35 +0100 (BST)
From: John Berthels <John DOT Berthels AT nexor DOT co DOT uk>
To: cygwin AT cygwin DOT com
Subject: Re: one byte reads in bash
In-Reply-To: <20030612152054.GC19331@redhat.com>
Message-ID: <Pine.LNX.4.52.0306121751290.32319@spectre.nexor.co.uk>
References: <Pine DOT LNX DOT 4 DOT 52 DOT 0306120953140 DOT 14586 AT spectre DOT nexor DOT co DOT uk> <20030612152054 DOT GC19331 AT redhat DOT com>
MIME-Version: 1.0
X-Spam-Status: No, hits=-1.1 required=5.0
tests=IN_REP_TO,REFERENCES,SPAM_PHRASE_00_01,USER_AGENT_PINE
version=2.43
X-Spam-Level:

Just so that the list thread gets the info, I had a private reply from Dan
Vasaru, who referred me to his patch to bash here:

http://sources.redhat.com/ml/cygwin/2002-09/msg00446.html

I applied his patch to the current cygwin bash source (plus the three
wide-character compilation fixes for bash on current cygwin mentioned
elsewhere in the list archives)  and the one-byte-read problem goes away.
(The patch turns off the bash cygwin-specific detection for a non-seekable
file handle and enables existing bash code to get the seeking-in-text-mode
stuff right).

i.e. bash now reads script files in buffered chunks rather than
character-at-a-time. (note - I don't mean character-at-a-time buffered by
stdio, I mean char-at-a-time from the O/S).

I originally noticed the problem with a network analyser, which also shows
the fix. For a 2.5Kbyte script, the patched bash does 2 reads (two network
reply/response data packets) versus the current cygwin bash which does
2500 network read/reply packets. Note that cygwin strace suggests that the
problem also occurs for scripts on local disk, although it obviously has
less impact in that case.

For my money, this is a great patch. I've not tested it for other ill
effects as yet, but the read issue is certainly resolved.

regards,

jb

[I'm not subscribed to the list and originally contacted the authors of a
previous thread on this subject directly. I'll not see any list replies
unless cc:'d.]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019