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

Implementation of caml_win32_rename in win32.c: Move #7691

Closed
vicuna opened this issue Dec 14, 2017 · 2 comments
Closed

Implementation of caml_win32_rename in win32.c: Move #7691

vicuna opened this issue Dec 14, 2017 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Dec 14, 2017

Original bug ID: 7691
Reporter: Bertrand.Jeannet
Status: closed (set by @alainfrisch on 2017-12-14T16:16:05Z)
Resolution: not a bug
Priority: normal
Severity: major
Version: 4.06.0
Category: platform support (windows, cross-compilation, etc)
Monitored by: @nojb @gasche

Bug description

The function caml_win32_rename in byterun/win32.c uses the function MoveFileEx, which is not Unicode aware, instead of MoveFileExW which is.

This looks like a bug in 4.06, since caml_sys_rename (byterun/sys.c) converts filenames (assumed to be UTF-8) to 16-bits unicode before calling caml_win32_rename.

@vicuna
Copy link
Author

vicuna commented Dec 14, 2017

Comment author: @nojb

Hello!

AFAICS there is no problem: the OCaml runtime system is compiled with the C preprocessor macro UNICODE defined, which makes MoveFileEx equal to MoveFileExW.

Note that since the arguments are of type WCHAR *, we would get a compiler error if MoveFileEx actually pointed to MoveFileExA (which takes char * arguments).

@vicuna
Copy link
Author

vicuna commented Dec 14, 2017

Comment author: @alainfrisch

Everything seems to be ok. In addition to static checking of types by the C compiler, the testsuite also exercise Sys.rename, so such a bad bug would have been caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant