Open dajhorn opened 1 month ago
What is content of PATH, WATCOM and INCLUDE environment variables?
Anyway OW doesn't support symbolic links, that it must be installed on true path. We not support WSL, it is not tested. OW linux directory functions implementation in OW CRTL use standard Linux system calls with standard UNIX file name/path separator, that I don't know how WSL convert filenames and paths for Windows filesystems. It could be issue with internal name buffer size overflow in CRTL, I will check.
Please how it looks like output from ls -la
in your current directory where you test it.
What is content of PATH, WATCOM and INCLUDE environment variables?
If I compile using a Windows host, then:
If I compile using a Linux host, then:
Each readdir-test
elf is bytewise identical.
Please how it looks like output from ls -la in your current directory where you test it.
All looks OK. Did you tried created executable on "true" Linux?
Yes, the build host does not affect behavior. Output binaries are identical regardless of host toolchain.
I checked these things:
wsl --mount <disk> --bare
style mount or with a mount -t ntfs -o loop
style mount.This means that errno=75 here is peculiar to the default mount -t drvfs
style mount in WSL, which uses the 9p
network filesystem protocol.
My guess is that errno=75 is coming from the SYS_getdents call, perhaps because watcom defines a dirent that is different than glibc.
Can you suggest some places for me to begin troubleshooting? -- Given that Open Watcom is the only compiler with this failure mode, I'm starting to look at the owc clib sources.
If you are interested in fixing this issue then problem is probably in readdir C run-time library function implementation.
Code is in bld/clib/posix/readdir.c
It looks like OW uses SYS_getdents with buffer for caching a few dirent structures, that it could be some issue in handling this buffer therefore errno=75 (real buffer overflow). It has nothing to do with glibc, because OW doesn't use it.
Probably it is not correct handling of errno=75 in OW code which can happen but is not error and requires somehow re-call SYS_getdents. Maybe we could check by SYS_getdents64 first and if not available then use SYS_getdents and handle errors.
Maybe it is bug in WSL for 32-bit application too.
Bingo. I can get errno=75 with g++ if I force a 32-bit build, which makes this a platform bug and not a watcom bug. Thanks.
I check internet and there is some info about WSL2 which should handle 32-bit application properly, but I cannot confirm if it is true.
Thanks for identification source of problem.
The clib3 readdir() for Linux fails to access NTFS through the Windows Subsystem for Linux.
Platform:
Reproducer:
Expected behavior:
./readdir-test
prints a list of file names in the current working directory.Actual behavior:
./readdir-test
fails with readdir() returning NULL and settingerrno=75
if the underlying filesystem is NTFS on WSL.Notes:
g++
works as expected on WSL.readdir-test
program behaves properly if the underlying filesystem is vfat or a native filesystem like tmpfs.