Skip to content
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

Unix.opendir under Windows #2528

Closed
vicuna opened this issue Jul 12, 2000 · 5 comments
Closed

Unix.opendir under Windows #2528

vicuna opened this issue Jul 12, 2000 · 5 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 12, 2000

Original bug ID: 161
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

I'm getting the following behavior for Unix.opendir under Windows 98,
ocaml-3.00:

    # Unix.opendir "c:\\";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "/";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "\\";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "c:/windows";;
    - : Unix.dir_handle = <abstr>
    # Unix.opendir "/windows ";;
    - : Unix.dir_handle = <abstr>

Under Windows 2000:

    # Unix.opendir "c:\\";;
    - : Unix.dir_handle = <abstr>
    # Unix.opendir "/";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "/winnt";;
    - : Unix.dir_handle = <abstr>

-Trevor

@vicuna
Copy link
Author

vicuna commented Jul 25, 2000

Comment author: administrator

I'm getting the following behavior for Unix.opendir under Windows 98,
ocaml-3.00:

    # Unix.opendir "c:\\";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").

Well, Unix.opendir is implemented by FindFirstFile, and as I said in
my previous message, that function is documented not to work on root
directories. (The recommended workaround is to do
Unix.opendir "c:\*", but this is really ugly.)

OK. I have been using

Unix.opendir "c:\ "

as my ugly hack. Is there some reason to believe that your ugly hack
("C:\*") is going to be more robust than my ugly hack ("C:\ ")? If
so, I'll change mine.

I still consider this a bug in Unix.opendir, because the
implementation does not match the documentation (the Ocaml
documentation, not the VC++ documentation). I hope you will fix it,
either by implementing the ugly hack so I don't have to, or by
changing the documentation so that the implementation matches the
spec.

Thanks,
Trevor

@vicuna
Copy link
Author

vicuna commented Jul 25, 2000

Comment author: administrator

I'm getting the following behavior for Unix.opendir under Windows 98,
ocaml-3.00:

    # Unix.opendir "c:\\";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "/";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "\\";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "c:/windows";;
    - : Unix.dir_handle = <abstr>
    # Unix.opendir "/windows ";;
    - : Unix.dir_handle = <abstr>

Under Windows 2000:

    # Unix.opendir "c:\\";;
    - : Unix.dir_handle = <abstr>
    # Unix.opendir "/";;
    Uncaught exception: Unix.Unix_error (Unix.EINVAL, "opendir", "").
    # Unix.opendir "/winnt";;
    - : Unix.dir_handle = <abstr>

Well, Unix.opendir is implemented by FindFirstFile, and as I said in
my previous message, that function is documented not to work on root
directories. (The recommended workaround is to do
Unix.opendir "c:\*", but this is really ugly.)

  • Xavier

@vicuna
Copy link
Author

vicuna commented Jul 25, 2000

Comment author: administrator

Windows lossage.

@vicuna vicuna closed this as completed Jul 25, 2000
@vicuna
Copy link
Author

vicuna commented Jul 28, 2000

Comment author: administrator

The best fix I see is to dump VC++ entirely and go with Cygwin, whose
Unix emulation library is much better than anything we could write.
It seems Cygwin made progress recently on the thread-safety issue, so
the last obstacle to using Cygwin might be disappearing.

That would be wonderful -- I hate to install VC++, it is a fat hog.
And, I need to install Cygwin anyway, I use it for make, bash, and
some other things. So, it gets my vote. I would be happy to be a
beta tester if you decide to make the change.

-Trevor

@vicuna
Copy link
Author

vicuna commented Jul 28, 2000

Comment author: administrator

OK. I have been using
Unix.opendir "c:\ "
as my ugly hack. Is there some reason to believe that your ugly hack
("C:\*") is going to be more robust than my ugly hack ("C:\ ")? If
so, I'll change mine.

I don't know, except that "my" hack is the one suggested by the MSDN
documentation.

I still consider this a bug in Unix.opendir, because the
implementation does not match the documentation (the Ocaml
documentation, not the VC++ documentation). I hope you will fix it,
either by implementing the ugly hack so I don't have to, or by
changing the documentation so that the implementation matches the
spec.

The best fix I see is to dump VC++ entirely and go with Cygwin, whose
Unix emulation library is much better than anything we could write.
It seems Cygwin made progress recently on the thread-safety issue, so
the last obstacle to using Cygwin might be disappearing.

  • Xavier Leroy

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant