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

filestat should contain timestamps in nanoseconds, not seconds #4358

Closed
yagehu opened this issue Dec 17, 2023 · 1 comment · Fixed by #4359
Closed

filestat should contain timestamps in nanoseconds, not seconds #4358

yagehu opened this issue Dec 17, 2023 · 1 comment · Fixed by #4359
Labels
bug Something isn't working 📦 lib-wasi About wasmer-wasi priority-medium Medium priority issue
Milestone

Comments

@yagehu
Copy link
Contributor

yagehu commented Dec 17, 2023

Describe the bug

The filestat type returned by fd_filestat_get should contain timestamps in nanoseconds. However, currently Wasmer returns timestamps in seconds for directories, e.g. preopened directories.

wasmer 4.2.4 (1abcd2c 2023-12-16)
binary: wasmer-cli
commit-hash: 1abcd2cc63deeca13af6506add6029edaba4d657
commit-date: 2023-12-16
host: x86_64-unknown-linux-gnu
compiler: singlepass,cranelift
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.73.0
LLVM version: 17.0.2

Steps to reproduce

Compile this C snippet with wasi-sdk and run the binary with Wasmer.

clang wasmer-dir-time.c
wasmer run --dir . a.out
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>

int main(void) {
  struct stat buf;

  int ret = fstat(4, &buf);
  if (ret != 0) {
    perror("fstat");
    return 1;
  }

  printf("atime %lld seconds", buf.st_atime);

  return 0;
}

Expected behavior

It should print a reasonable timestamp like:

atime 1702794075 seconds

Actual behavior

It prints a very small number:

atime 1 seconds

Copy link

linear bot commented Dec 17, 2023

@theduke theduke added bug Something isn't working 📦 lib-wasi About wasmer-wasi priority-medium Medium priority issue labels Dec 19, 2023
@theduke theduke added this to the v4.3 milestone Dec 19, 2023
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-wasi About wasmer-wasi priority-medium Medium priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants