From: Cesar S. <ces...@gm...> - 2007-03-14 01:34:17
|
Keith MARSHALL wrote: > Howard Chu wrote: > > I just noticed [...] bash is never using buffered I/O; it's > > reading script files one character at a time. This behavior is > > totally unnecessary. > > > > This patch fixes the behavior: > <patch> > Index: input.c > =================================================================== > RCS file: /cvsroot/mingw/msys/packages/bash/3.1/input.c,v > retrieving revision 1.2 > diff -u -r1.2 input.c > --- input.c 11 Aug 2006 17:21:39 -0000 1.2 > +++ input.c 13 Mar 2007 02:00:16 -0000 > @@ -337,7 +337,7 @@ > #if ! (__CYGWIN__ || __MSYS__) > # define fd_is_seekable(fd) (lseek ((fd), 0L, SEEK_CUR) >= 0) > #else > -# define fd_is_seekable(fd) 0 > +# define fd_is_seekable(fd) 1 > #endif /* __CYGWIN__ */ > > /* Take FD, a file descriptor, and create and return a buffered stream > </patch> > > Thanks for the patch, Howard. > > This may have been better directed to the MinGW-dvlpr list, or > even better still, the patch tracker, but no matter. I'll leave > it to Cesar to approve; subject to that, you may commit it. > I recall this being discovered and discussed on the Cygwin list: http://thread.gmane.org/gmane.os.cygwin/81560/focus=81585 http://article.gmane.org/gmane.os.cygwin.announce/1545 The issue apparently is an inability to seek reliably when opening a file in text mode. Migrating to binary mode broke many users' scripts out there with DOS line terminations, which flooded their mailing list (they warned their users in advance, though). This merits further analysis to see if it MSYS is also affected. Cesar |