interesting paths: loosen up errno requirements

This commit is contained in:
Pat Hickey
2021-01-25 15:28:01 -08:00
parent b0b263f68e
commit 8f4fecacdc
2 changed files with 19 additions and 16 deletions

View File

@@ -30,11 +30,10 @@ TODOs:
* file_allocate
- call to fd_allocate(10,10) reduces size from 100 to 20
* interesting_paths
- on windows, opening `dir/nested/file/` (line 53) with a trailing slash
gets you a NOENT instead of a NOTDIR errno.
- on windows, opening a directory with a trailing slash fails
* nofollow_errors
- I loosened up some errno acceptance but still cant delete a symlink to a
directory
- I loosened up some errno acceptance but windows requires rmdir to delete
a symlink to a directory, rather than unlink_file
* symlink_create
- narrowed down the symlink delete issue that only shows up on linux
* path_rename

View File

@@ -49,21 +49,25 @@ unsafe fn test_interesting_paths(dir_fd: wasi::Fd, arg: &str) {
);
// Now open it with a trailing slash.
assert_eq!(
wasi::path_open(dir_fd, 0, "dir/nested/file/", 0, 0, 0, 0)
.expect_err("opening a file with a trailing slash should fail")
.raw_error(),
wasi::ERRNO_NOTDIR,
"errno should be ERRNO_NOTDIR",
let one_trailing_slash_errno = wasi::path_open(dir_fd, 0, "dir/nested/file/", 0, 0, 0, 0)
.expect_err("opening a file with a trailing slash should fail")
.raw_error();
assert!(
one_trailing_slash_errno == wasi::ERRNO_NOTDIR
|| one_trailing_slash_errno == wasi::ERRNO_NOENT,
"errno should be ERRNO_NOTDIR or ERRNO_NOENT, got {}",
one_trailing_slash_errno
);
// Now open it with trailing slashes.
assert_eq!(
wasi::path_open(dir_fd, 0, "dir/nested/file///", 0, 0, 0, 0)
.expect_err("opening a file with trailing slashes should fail")
.raw_error(),
wasi::ERRNO_NOTDIR,
"errno should be ERRNO_NOTDIR",
let multi_trailing_slash_errno = wasi::path_open(dir_fd, 0, "dir/nested/file///", 0, 0, 0, 0)
.expect_err("opening a file with trailing slashes should fail")
.raw_error();
assert!(
multi_trailing_slash_errno == wasi::ERRNO_NOTDIR
|| multi_trailing_slash_errno == wasi::ERRNO_NOENT,
"errno should be ERRNO_NOTDIR or ERRNO_NOENT, got {}",
multi_trailing_slash_errno,
);
// Now open the directory with a trailing slash.