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

Avoid MAX_PATH issue on windows #1743

Open
coke opened this issue Feb 20, 2023 · 11 comments
Open

Avoid MAX_PATH issue on windows #1743

coke opened this issue Feb 20, 2023 · 11 comments

Comments

@coke
Copy link
Collaborator

coke commented Feb 20, 2023

Code in src/io/dirops.c is explicitly checking for MAX_PATH on windows, which means that even if a user has disabled that check in the windows registry, raku will still fail to deal with paths greater than MAX_PATH length.

  • MVM_dir_open
  • MVM_dir_read (Not impacted by the MAX_PATH, but needs updating if we're using libuv elsewhere)
  • MVM_dir_close (Not impacted by the MAX_PATH, but needs updating if we're using libuv elsewhere)
  • MVM_dir_mkdir

Should be updated to use the corresponding libuv functions, which will hopefully hide any OS specific code in the library, and allow windows users to use longer path names.

@MasterDuke17
Copy link
Contributor

MasterDuke17 commented Feb 21, 2023 via email

@coke
Copy link
Collaborator Author

coke commented Feb 21, 2023

I'd be happy to try out a work in progress, btw.

@MasterDuke17
Copy link
Contributor

I'd be happy to try out a work in progress, btw.

https://github.com/MasterDuke17/MoarVM/tree/use_more_libuv_dir_functions is what I have so far, but I just realized it also needs some work because '.' and '..' are handled differently. But it's probably fine for testing if large paths can in fact be create on Windows.

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

Build error on windows:

linking 3rdparty\libuv\uv.lib
linking moar.dll
   Creating library moar.dll.lib and object moar.dll.exp
dirops.obj : error LNK2001: unresolved external symbol S_ISDIR
moar.dll : fatal error LNK1120: 1 unresolved externals

which only appears here:

$ grep -r S_ISDIR
3rdparty/libuv/src/unix/fs.c:    if (rc == 0 && S_ISDIR(buf.st_mode)) {

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

Maybe the issue is: why am I linking against unix/fs.c and not win/fs.c ?

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

Maybe the issue is: why am I linking against unix/fs.c and not win/fs.c ?

Oh - S_ISDIR is also in the new code, that's why I'm getting the error. I had a "moarvm-md" and a "moar-md" folder next to each other and was looking in one on git bash and the other on cmd and confused myself.

So, yes, the link with suggested implementation of S_ISDIR on windows is probably the way to go.

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

I locally added in the defines from the link above.

One the one hand, I'm able to build, but the rakudo install fails with:

+++ Preparing installation
NMAKE : fatal error U1077: 'C:\sandbox\rakudo-md\rakudo-m.exe' : return code '0xc0000005'
Stop.

On the other hand, rakudo-m.exe was installed, and I can run it. (e.g. -e "say 3" works)

On the gripping hand, when I run rakudo-m.exe on my failing test script, I get a segfault.

@coke
Copy link
Collaborator Author

coke commented Feb 22, 2023

I went back and did a debug build (--debug on the MoarVM config), but VS is only showing me assembly, not C code, so I have no idea what the problem is.

@MasterDuke17
Copy link
Contributor

MasterDuke17 commented Feb 22, 2023 via email

@MasterDuke17
Copy link
Contributor

@coke my most recent updates to https://github.com/MasterDuke17/MoarVM/tree/use_more_libuv_dir_functions (I force pushed, so you'll probably have to git reset --hard) should let you test creating a long dir. It annoyingly still segfaults when reading a dir, but it might let us know if this will in fact help once completed.

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

No branches or pull requests

2 participants