-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__quickstat() fails to properly recognize directories #38
Comments
The goto fill_dir seems to be ok, since the other fields (st_mode etc) are set just before it. But you are right, that whole code looks really messy, and i wonder whether we need that function at all. If you are using that function on mint with e.g. an ext2 filesystem, Fsfirst will actually do a Fstat64() anyway. On plain TOS, Fsfirst will also return the timestamps, so you don't need an extra call for it. So what the hell is saved by using that function instead of stat()? Edit: eventually we should do some tests with eg. Kobold in gemdos mode (or just cp -r). One time with the current mintlib, one time with a library where quickstat() is replaced by stat(). Then copy some directories around, with a lot of small files. That should give a hint whether it really makes a difference. |
What I was trying to say with respect to the goto: Whenever Line 207 in f5c219b
... is never reached. Therefore, checking isdir there is superfluous and possibly not what was intended.
|
@th-otto do you plan to work on this further? I guess it would be nice to have this 100% fixed before release. |
No time currently :( It would need some thorough tests. |
As mentioned in #37: There is an issue with __quickstat() not properly recognizing directories -- tested under TOS. __quickstat() is called from multiple functions in MiNTLib and is supposed to be a "quick stat version that gets everything but the timestamps."
Testcase: Create a directory
\DIR
and a file\FILE
and run the following program:You can see that stat() correctly reports directories, __quickstat() doesn't: st_mode is always 0100644 = regular file. It seems as if __quickstat() determines whether something is a directory or a file solely based on some simple check of the name and not on the information returned by Fsfirst:
mintlib/mintlib/quickstat.c
Lines 100 to 101 in f5c219b
I also find this section of the code very strange:
mintlib/mintlib/quickstat.c
Lines 205 to 212 in f5c219b
It sets
st_mode
only based onisdir
. However whenisdir
is set, execution directly goto-es tofill_dir
, skipping the block of code entirely. Also,st_flags
is set to 0, only to be checked immediately afterwards for non-zero values.The text was updated successfully, but these errors were encountered: