This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: one byte reads in bash


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]