symlink-related tests: accept either ELOOP or ENOTDIR
when opening a symlink loop as directory, or nofollow opening a valid symlink as directory.
This commit is contained in:
@@ -6,9 +6,18 @@ unsafe fn test_dangling_symlink(dir_fd: wasi::Fd) {
|
|||||||
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
||||||
|
|
||||||
// Try to open it as a directory with O_NOFOLLOW.
|
// Try to open it as a directory with O_NOFOLLOW.
|
||||||
assert_eq!(
|
let dir_open_errno = wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||||
wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
|
||||||
.expect_err("opening a dangling symlink as a directory")
|
.expect_err("opening a dangling symlink as a directory")
|
||||||
|
.raw_error();
|
||||||
|
assert!(
|
||||||
|
dir_open_errno == wasi::ERRNO_NOTDIR || dir_open_errno == wasi::ERRNO_LOOP,
|
||||||
|
"errno should be ERRNO_NOTDIR or ERRNO_LOOP",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Try to open it as a file with O_NOFOLLOW.
|
||||||
|
assert_eq!(
|
||||||
|
wasi::path_open(dir_fd, 0, "symlink", 0, 0, 0, 0)
|
||||||
|
.expect_err("opening a dangling symlink as a file")
|
||||||
.raw_error(),
|
.raw_error(),
|
||||||
wasi::ERRNO_LOOP,
|
wasi::ERRNO_LOOP,
|
||||||
"errno should be ERRNO_LOOP",
|
"errno should be ERRNO_LOOP",
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ unsafe fn test_nofollow_errors(dir_fd: wasi::Fd) {
|
|||||||
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
||||||
|
|
||||||
// Try to open it as a directory with O_NOFOLLOW again.
|
// Try to open it as a directory with O_NOFOLLOW again.
|
||||||
assert_eq!(
|
let dir_open_errno = wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||||
wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
|
||||||
.expect_err("opening a directory symlink as a directory should fail")
|
.expect_err("opening a directory symlink as a directory should fail")
|
||||||
.raw_error(),
|
.raw_error();
|
||||||
wasi::ERRNO_LOOP,
|
assert!(
|
||||||
"errno should be ERRNO_LOOP",
|
dir_open_errno == wasi::ERRNO_LOOP || dir_open_errno == wasi::ERRNO_NOTDIR,
|
||||||
|
"errno should be ERRNO_LOOP or ERRNO_NOTDIR",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try to open it with just O_NOFOLLOW.
|
// Try to open it with just O_NOFOLLOW.
|
||||||
@@ -57,12 +57,12 @@ unsafe fn test_nofollow_errors(dir_fd: wasi::Fd) {
|
|||||||
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a symlink");
|
||||||
|
|
||||||
// Try to open it as a directory with O_NOFOLLOW again.
|
// Try to open it as a directory with O_NOFOLLOW again.
|
||||||
assert_eq!(
|
let dir_open_errno = wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
||||||
wasi::path_open(dir_fd, 0, "symlink", wasi::OFLAGS_DIRECTORY, 0, 0, 0)
|
|
||||||
.expect_err("opening a directory symlink as a directory should fail")
|
.expect_err("opening a directory symlink as a directory should fail")
|
||||||
.raw_error(),
|
.raw_error();
|
||||||
wasi::ERRNO_LOOP,
|
assert!(
|
||||||
"errno should be ERRNO_LOOP",
|
dir_open_errno == wasi::ERRNO_LOOP || dir_open_errno == wasi::ERRNO_NOTDIR,
|
||||||
|
"errno should be ERRNO_LOOP or ERRNO_NOTDIR",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try to open it with just O_NOFOLLOW.
|
// Try to open it with just O_NOFOLLOW.
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
|
|
||||||
TODOs:
|
TODOs:
|
||||||
* symlink following behavior, trailing slash behavior (closely related to
|
|
||||||
symlinks) in cap-std isnt ready yet.
|
|
||||||
* path_filestat_set_times, fd_filestat_set_times: different types used to set
|
* path_filestat_set_times, fd_filestat_set_times: different types used to set
|
||||||
times for a Dir vs a File, this is a fs_set_times vs cap_fs_ext divergence
|
times for a Dir vs a File, this is a fs_set_times vs cap_fs_ext divergence
|
||||||
* File::set_fdflags is unimplemented, File::get_fdflags is lying - these are
|
* File::set_fdflags is unimplemented, File::get_fdflags is lying - these are
|
||||||
fcntl on unix, reopenfile / ?? on windows. Not implemented in system-interface yet.
|
fcntl on unix, reopenfile / ?? on windows. Not implemented in system-interface yet.
|
||||||
* async scheduling!
|
* async scheduling!
|
||||||
|
|
||||||
wasi_tests::dangling_symlink
|
|
||||||
- symlink following behavior not yet implemented
|
|
||||||
wasi_tests::directory_seek
|
wasi_tests::directory_seek
|
||||||
- something weird about directory open rights / fdstat. need debug
|
- something weird about directory open rights / fdstat. need debug
|
||||||
impl of Caps to see about this
|
impl of Caps to see about this
|
||||||
wasi_tests::fd_flags_set
|
wasi_tests::fd_flags_set
|
||||||
- set_fdflags is not implemented. test wanted to clear O_APPEND mode
|
- set_fdflags is not implemented. test wanted to clear O_APPEND mode
|
||||||
wasi_tests::nofollow_errors
|
|
||||||
- symlink following behavior not yet implemented
|
|
||||||
wasi_tests::path_filestat
|
wasi_tests::path_filestat
|
||||||
- fdstat.fs_flags is not populated correctly - APPEND | SYNC aren't
|
- fdstat.fs_flags is not populated correctly - APPEND | SYNC aren't
|
||||||
present because File::get_fdflags isnt implemented correctly
|
present because File::get_fdflags isnt implemented correctly
|
||||||
|
|||||||
Reference in New Issue
Block a user