-
Notifications
You must be signed in to change notification settings - Fork 117
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
wasm3
's readdir()
doesn't return a directory as a directory
#836
Comments
When I ran the same C code with the prebuilt wasm3 that can be available here, it outputted the correct results. So, although there are differences between Linux and iOS, I don't think the root cause is wasm3 itself. $ clang -target wasm32-wasi --sysroot=$HOME/wasi-libc/sysroot -nodefaultlibs -lc -o readdir.wasm readdir.c
$ ./wasm3-aarch64-linux-musl readdir.wasm test
a
is not a directory (4)
b
is not a directory (4)
c
is a directory (3)
$ uname -a
Linux Brown-rhinoceros-beetle 6.11.0-400.asahi.fc40.aarch64+16k #1 SMP PREEMPT_DYNAMIC Fri Sep 27 02:59:31 UTC 2024 aarch64 GNU/Linux By the way, wasi-libc's |
That is an interesting and challenging issue. entry.d_type = file_entry->d_type; From your tests, I see that for directories, |
Yes, that was the issue. Now the only difference between |
Thank you for fixing it!
By the way, the issue above doesn't matter for me, but I think the correct behavior is |
If you use |
Thanks for the fix and publishing it to TestFlight! |
I've confirmed that |
I'll close this issue when the fixed version is released to App Store. |
Description
readdir()
returnsdirent
and it's a directory if itsd_type
equals toDT_DIR
.https://www.man7.org/linux/man-pages/man3/readdir.3.html
Although
wasm
returns a directory as a directory (DT_DIR
),wasm3
returns a directory as a regular file (DT_REG
).Steps to reproduce
readdir.c
clang readdir.c
on a-Shellmkdir test
on a-Shelltouch test/a
on a-Shelltouch test/b
on a-Shellmkdir test/c
on a-Shellwasm a.out test
andwasm3 a.out test
on a-ShellExpected behavior
wasm
's behavior is my expected behavior.Environment
The text was updated successfully, but these errors were encountered: