Open dajhorn opened 2 weeks ago
What DOS version you are using?
This happens in:
MS-DOS and FreeDOS have different /
tail folding than DOSBox-X, so at least some of this stat()
behavior is platform dependent.
issue1345.zip is a floppy disk image containing the dirstat.exe
test program.
Thanks for your bug report. I reproduced it. It will be corrected ASAP.
BTW, should it matter...
The __WATCOM_LFN__
macro significantly changes stat()
behavior:
There is issue with trailing slash.
It looks like it is correct behaviour, because appropriate DOS function to access directory fails due to trailing slash.
You need to use path\last
or path\last\.
form.
Windows FindFirstFile
has same behaviour too.
Your application is responsible to use correct format.
Anyway there was small mistake which caused strange behaviour for forward/backward slash on the end . Now stat always report problem if there is trailing slash (forward or backward).
The DOS runtime recognizes both kinds of slashes as pathname separators, but handles them differently.
Consider this test program:
Compile it with:
Observed
stat()
behavior:stat()
behaves like posix.errno=1
(ENOENT: No such file or directory).X:\
is recognized as a corner case.)stat()
parameter is a file, then both slashes are folded similarly.Expected
stat()
behavior: