Mail Archives: djgpp-workers/2001/05/06/19:15:06
Hello.
Eli Zaretskii wrote:
>
> > Date: Sun, 29 Apr 2001 13:04:53 +0100
> > From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
> >
> > Thanks for the bug report.
>
> Here's another one ;-)
>
> Put an empty floppy into drive A:, and then type this:
>
> C:\> ls a:
> c:/djgpp/bin/ls: a:: No such file or directory (ENOENT)
>
> This is on Windows 98. On plain DOS 5.0, it gets more interesting:
>
> C:\> ls a:
> c:/djgpp/bin/ls: a:: No more files (ENMFILE)
>
> `ls' from Fileutils 3.16 would simply print nothing in this case,
> which is what I'd expect.
Are you using 2.03-compiled Fileutils 3.16? I get a similar behaviour from
'ls' from the latest release of Fileutils 3.16 on the DJGPP archive:
bash-2.04$ /temp/bin/ls.exe --version
ls (GNU fileutils) 3.16
bash-2.04$ /temp/bin/ls.exe a:
/temp/bin/ls: a:: No such file or directory (ENOENT)
I don't have a DOS 5 box anywhere. I wonder if the 2.03-compiled version
would generate the ENMFILE error too?
> Curiously enough, I cannot get the same results with hard disks, only
> with a floppy.
This only seems to happen with empty disks - I had to remove all files on
the disk, before I got the same error. As to it (not) working on a hard
disk - I imagine that you would need an empty hard disk for this to work.
I don't have an empty hard disk. I tried mapping a share with no files to
a drive letter, to simulate an empty disk. ls worked OK with that drive
letter - presumably because Samba provides '.' and '..' entries.
Now to the cause of the error: closedir() calls rewinddir(). rewinddir()
fails with ENOENT (or ENMFILE?). closedir() then fails, passing through
the error.
Debugging libc I see that rewinddir() calls __set_need_fake_dot_dotdot().
__set_need_fake_dot_dotdot() calls findfirst(). On a floppy with no files
findfirst() fails, returing ENOENT. Hence __set_need_fake_dot_dotdot()
sets errno. It seems to me that it should not set errno. I think code
should be added to it, to save and restore errno. Is this a libc bug?
Thanks, bye, Rich =]
--
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/
- Raw text -