new cap-std apis fix some windows tests!

fix for fd_readdir test on linux, and symlink_create / nofollow_errors
This commit is contained in:
Pat Hickey
2021-02-03 16:16:09 -08:00
parent e670c46862
commit c8ca639b93
2 changed files with 3 additions and 7 deletions

View File

@@ -194,13 +194,9 @@ mod wasi_tests {
[
// Panic: Metadata not associated with open file
// https://github.com/bytecodealliance/cap-std/issues/142
"fd_readdir",
"fd_flags_set",
"path_filestat",
"symlink_filestat",
// upstream fixes pending:
"symlink_create", // cap-std #149
"nofollow_errors", // cap-std #149 and #150
// Trailing slash related bugs
"interesting_paths",
"path_rename_file_trailing_slashes",

View File

@@ -1,5 +1,5 @@
use crate::file::{filetype_from, File};
use cap_fs_ext::{DirExt, MetadataExt, SystemTimeSpec};
use cap_fs_ext::{DirEntryExt, DirExt, MetadataExt, SystemTimeSpec};
use std::any::Any;
use std::convert::TryInto;
use std::path::{Path, PathBuf};
@@ -123,7 +123,7 @@ impl WasiDir for Dir {
// Now process the `DirEntry`s:
self.0.entries()?.map(|entry| {
let entry = entry?;
let meta = entry.metadata()?;
let meta = entry.full_metadata()?;
let inode = meta.ino();
let filetype = filetype_from(&meta.file_type());
let name = entry
@@ -163,7 +163,7 @@ impl WasiDir for Dir {
}
fn unlink_file(&self, path: &str) -> Result<(), Error> {
self.0.remove_file(Path::new(path))?;
self.0.remove_file_or_symlink(Path::new(path))?;
Ok(())
}
fn read_link(&self, path: &str) -> Result<PathBuf, Error> {