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

The execution result of the program differs from that of the native program. #3033

Closed
abc767234318 opened this issue Jul 21, 2022 · 3 comments
Assignees
Labels
bug Something isn't working priority-medium Medium priority issue
Milestone

Comments

@abc767234318
Copy link

Describe the bug

#include <dirent.h>
#include <stdio.h>
#include <errno.h>

int main(int argc, char **argv) {
  DIR *d;

  char * target = ".";
  if (argc == 2) {
      target = argv[1];
  }
  struct dirent *dir;
  d = opendir(target);
  if (d) {
    while ((dir = readdir(d)) != NULL) {
      printf("%s\n", dir->d_name);
    }

    printf("errno: %d\n", errno);
    closedir(d);
  }

  return(0);
}

This is a source code first mentioned in wasmtime issues NO.2493.
My project files are as follows:
wasmtime-2493.zip

echo "`wasmer -V` | `rustc -V` | `uname -m`"
wasmer 2.3.0 | rustc 1.62.0 (a8314ef7d 2022-06-27) | x86_64

Steps to reproduce

wasmer run ls.wasm --dir=./testfolder -- testfolder | wc -l

Expected behavior

When I compile using g++, the program results in the following

203

Actual behavior

201
@abc767234318 abc767234318 added the bug Something isn't working label Jul 21, 2022
@syrusakbary
Copy link
Member

syrusakbary commented Jul 26, 2022

This indeed seems like a bug (this is how wasmtime fixed it:
bytecodealliance/wasmtime#2493)

We'll work on a fix

@syrusakbary syrusakbary added this to the v3.0 milestone Jul 26, 2022
@syrusakbary syrusakbary added the priority-medium Medium priority issue label Jul 26, 2022
syrusakbary added a commit that referenced this issue Aug 3, 2022
…ddir

Added '.' and '..' special folder t WASI fd_readdir return (for #3033)
@ptitSeb
Copy link
Contributor

ptitSeb commented Aug 3, 2022

Should be fixed in current master, can you check @abc767234318 so the ticket can be closed?

@ptitSeb
Copy link
Contributor

ptitSeb commented Aug 8, 2022

Fixed on my side, closing the ticket now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants