question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

calling `.stat()` on a `Descriptor` does not include correct file details

See original GitHub issue

details:

wasm runtime: wasmer v0.4.2
assemblyscript version: v0.6
wasa version: master branch, commit f4162e73b6cbc3efd59f5cadd26b8b5b579b268f
// The entry file of your WebAssembly module.
import "allocator/arena"
import {
  Console as console,
  FileSystem as fs 
} from '../wasa/assembly/wasa'

export function _start (): void {
  let file = fs.open('./package.json')
  let fileDetails = file.stat()
  console.log(fileDetails.file_size.toString()) // always prints 0
  console.log(fileDetails.file_type.toString()) // always prints 0
  console.log(fileDetails.modification_time.toString()) // always prints 0.0
}

a few things come to mind…

  • this could most certainly be user error…
  • this could be an issue with the underlying runtime, so if that’s the case, please punt this issue 😃
  • could it be an issue converting to strings for printing? (other tests i’ve done say probably not?)

or it could be something else! 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
austinfreycommented, Jun 22, 2019

ugh… did not not notice there was a newer version of wasmer available. v0.5.0 and this fixes things. should have started there. lesson learned.

0reactions
austinfreycommented, Jul 4, 2019

@jedisct1 apologies! just seeing this! the lucet command i wrote above was a typo, the command i actualy ran was the following with relative paths. not sure if this is what you had meant? anyways, my preference is to use wasmer at the moment, so i’m not to concerened. very much appreciated your patience on this :0

lucet-wasi --dir ./:./ optimized.so
Read more comments on GitHub >

github_iconTop Results From Across the Web

stat()--Get File Information - IBM
The stat() function gets status information about a specified file and places it in the area of memory pointed to by the buf...
Read more >
c - stat() giving wrong information - Stack Overflow
The most viable reason for stat(2) failing is that you are not listing the current directory. The d_name member of the dirent structure...
Read more >
stat(2) - Linux manual page - man7.org
fstat() is identical to stat(), except that the file about which information is to be retrieved is specified by the file descriptor fd....
Read more >
stat(2) manual page
The stat() system call obtains information about the file pointed to by path. Read, write or execute permission of the named file is...
Read more >
stat(2): file status - Linux man page - Die.net
These functions return information about a file. No permissions are required on the file itself, but-in the case of stat() and lstat() -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found