Mail Archives: djgpp-workers/2001/08/20/10:05:29
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 0<test
is_exec.c 250
is_exec.c 66
is_exec.c 80
is_exec.c 91 3f00
is_exec.c 125 4200, fh = 0, fpos_high= 0, fpos_low = 0
is_exec.c 139 4200 results, flags = 2, fh = 0, fpos_high= 0, fpos_low = 0
is_exec.c 147
is_exec.c 165
is_exec.c 262
is_exe = 0, seeker = 0
First char is: (3)
DJGPP_204 D:\dj204\work\seek>set LFN=y
DJGPP_204 D:\dj204\work\seek>seek 0<test
is_exec.c 250
is_exec.c 66
is_exec.c 80
is_exec.c 91 3f00
is_exec.c 125 4200, fh = 0, fpos_high= 0, fpos_low = 0
is_exec.c 139 4200 results, flags = 2, fh = 0, fpos_high= 0, fpos_low = 0
is_exec.c 147
is_exec.c 165
is_exec.c 262
is_exe = 0, seeker = 0
First char is: (3)
The test file is "123456789.......".
As you can see I have linked in a modified is_exec program the 4200 is the
second 4200 call in is_exec.
I tried to find where STDIN is setup, but I couldn't see it. I do not think
I am looking for the right thing. I searched for STDIN and couldn't see
anything useful, I loked in crt1.c. Could someone please point me in the
direction of where STDIN is setup/configured?
> 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.
- Raw text -