Date: Thu, 23 Aug 2001 09:10:48 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: sandmann AT clio DOT rice DOT edu Message-Id: <2110-Thu23Aug2001091047+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <10108221941.AA14151@clio.rice.edu> (sandmann@clio.rice.edu) Subject: Re: Fseek on STDIN problem on Win 2K References: <10108221941 DOT AA14151 AT clio DOT rice DOT edu> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) > Date: Wed, 22 Aug 2001 14:41:04 -0500 (CDT) > > does the 2.03 library not call the is_executable? Yes, it does. > fstat() doesn't cause this problem in 2.03 which might explain why > it's more rare). So perhaps we should find out which change since v2.03 triggers this. > I tried test >> testout > I tried test >> nul > > fstat() is OK with handle 1, in both cases thinks it's a file, lseek > says it's at the beginning (0) wrong for file append. lseek returning 0 on append is correct for NUL, since NUL is always empty. Does lseek say it's at the beginning for a non-empty file testout as well? If so, this doesn't happen on Windows 98. > First example gets the right size in fstat, second example says it > is zero length. Same thing happens here on Windows 98, and zero length is okay with NUL. (I'm assuming that by ``second example'' you mean "test >>nul".) > Both examples return times (first example is file time, second example > is weird date in future). The time for NUL should be the current time, but that code only works if fstat detects that it's a device, which I presume isn't happening on NT? > In both cases _read fails on the handle. Fails how? Do you mean to say that NT disallows reads on stdout? It does work on Windows 98: I redirected stdout into a raw COFF file, and fstat readily reported it's an executable. > Proposal: fstat() (or dev info?) does the following: > if dev_info == 0 and NT and handlenumb <5 dev_info = 0x8000 How is this better than leave the current problems with fstat intact? (Admittedly, I don't remember anymore why this was a grave problem ;-) Also, I think Bash uses handle 5 quite a lot in configure scripts, and the programs it invokes inherit the redirection. (Mark, am I right?) Does redirection from Bash have this problem? (I think you said no, but I'm not sure.)