X-Authentication-Warning: new-smtp2.ihug.com.au: Host p229-tnt1.syd.ihug.com.au [203.173.128.229] claimed to be acceleron Message-ID: <002501c12980$4c67fa80$0a02a8c0@acceleron> From: "Andrew Cottrell" To: "Eli Zaretskii" , "Charles Sandmann" Cc: References: <10108200508 DOT AA15103 AT clio DOT rice DOT edu> <2950-Mon20Aug2001093159+0300-eliz AT is DOT elta DOT co DOT il> Subject: Re: Fseek on STDIN problem on Win 2K Date: Mon, 20 Aug 2001 23:58:40 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Reply-To: djgpp-workers AT delorie DOT com I ahve been investigatingt this issue tonight and I haev included my results below. > > Minimal test that shows problem below. If lfn=n it works. Time for > > disecting fstat again. > > The only places where fstat looks at _USE_LFN is in the call to 71a6 > and inside set_fstat_times (or friends 57xx functions). This doesn't > include external functions fstat calls; I don't think they test > whether LFN is enabled, but I didn't check. I can comment out all if the if (_USE_LFN) code in fstat that calls 71A6 and it does not make a difference to the output.. > If _is_executable is the suspect, it can be disabled by setting the > _STAT_EXEC_MAGIC bit in _djstat_flags. In my testing I found that I can "fix" the problem by one of the following methods: a) Commenting out the _is_executable() call in fstat.c b) Setting the _STAT_EXEC_MAGIC bit in _djstat_flags b) adding a _read() to the _is_executable() function before or after the second 4200 call. c) Debug the new sample under Rhide This new example does not chaneg the results if LFN is y or n. I have further refined the sample program to just the following: _djstat_flags = _djstat_flags | _STAT_EXEC_MAGIC; seeker = lseek(STDIN_FILENO,0,SEEK_SET); is_exe = _is_executable((const char *)0, STDIN_FILENO, (const char *)0); seeker = lseek(STDIN_FILENO,0,SEEK_SET); printf("is_exe = %d, seeker = %d\n",is_exe,seeker); DJGPP_204 D:\dj204\work\seek>set LFN=n DJGPP_204 D:\dj204\work\seek>seek 0set LFN=y DJGPP_204 D:\dj204\work\seek>seek 0 Note that fstat itself calls the lseek function (4200/4201), directly > or indirectly, several times. So if something's wrong with that > function, it either should be wrong right from the start, or something > inside fstat makes it misbehave. Just a wild guess, but I wonder if this is another LFN issue with how STDIN is openned / accessed. I have now isolates it down to a smaller amount of code in the example above. In the next few days I will try to further refine the code to narrow in on the problem. This looks like it might take me a few days to trace this one as the problem changs when I debug or add calls to see what the next character is in the STDIN stream.