path_link test: we no longer support symlink following
just assert that setting the symlink following lookupflag gives an ERRNO_INVAL.
This commit is contained in:
@@ -4,11 +4,8 @@ TODOs:
|
|||||||
fcntl on unix, reopenfile / require reopening on windows.
|
fcntl on unix, reopenfile / require reopening on windows.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Linux
|
# Linux
|
||||||
|
|
||||||
* path_link
|
|
||||||
- need DirExt::hard_link that follows symlinks.
|
|
||||||
* path_rename_trailing_slashes
|
* path_rename_trailing_slashes
|
||||||
- trailing slash behavior of files is wrong: trailing slashes are ignored,
|
- trailing slash behavior of files is wrong: trailing slashes are ignored,
|
||||||
should cause an error.
|
should cause an error.
|
||||||
@@ -40,8 +37,7 @@ TODOs:
|
|||||||
- permission denied on windows to rename a dir to an existing empty dir
|
- permission denied on windows to rename a dir to an existing empty dir
|
||||||
|
|
||||||
* path_link
|
* path_link
|
||||||
- fails on the first dangling symlink, which is before the hard_link
|
- fails on the first dangling symlink
|
||||||
following symlinks issue linux hits.
|
|
||||||
|
|
||||||
## "Trailing slashes are a bonified boondoggle" - Dan
|
## "Trailing slashes are a bonified boondoggle" - Dan
|
||||||
|
|
||||||
|
|||||||
@@ -184,25 +184,10 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
|
|||||||
);
|
);
|
||||||
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
|
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
|
||||||
|
|
||||||
// Create a link to a file following symlinks
|
|
||||||
wasi::path_symlink("file", dir_fd, "symlink").expect("creating a valid symlink");
|
|
||||||
wasi::path_link(
|
|
||||||
dir_fd,
|
|
||||||
wasi::LOOKUPFLAGS_SYMLINK_FOLLOW,
|
|
||||||
"symlink",
|
|
||||||
dir_fd,
|
|
||||||
"link",
|
|
||||||
)
|
|
||||||
.expect("creating a link to a file following symlinks");
|
|
||||||
let link_fd = open_link(dir_fd, "link");
|
|
||||||
check_rights(file_fd, link_fd);
|
|
||||||
wasi::path_unlink_file(dir_fd, "link").expect("removing a link");
|
|
||||||
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
|
|
||||||
|
|
||||||
// Create a link where target is a dangling symlink following symlinks
|
// Create a link where target is a dangling symlink following symlinks
|
||||||
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a dangling symlink");
|
wasi::path_symlink("target", dir_fd, "symlink").expect("creating a dangling symlink");
|
||||||
|
|
||||||
// If we do follow symlinks, this should fail
|
// Symlink following with path_link is rejected
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wasi::path_link(
|
wasi::path_link(
|
||||||
dir_fd,
|
dir_fd,
|
||||||
@@ -211,30 +196,11 @@ unsafe fn test_path_link(dir_fd: wasi::Fd) {
|
|||||||
dir_fd,
|
dir_fd,
|
||||||
"link",
|
"link",
|
||||||
)
|
)
|
||||||
.expect_err("creating a link to a dangling symlink following symlinks should fail")
|
.expect_err("calling path_link with LOOKUPFLAGS_SYMLINK_FOLLOW should fail")
|
||||||
.raw_error(),
|
.raw_error(),
|
||||||
wasi::ERRNO_NOENT,
|
wasi::ERRNO_INVAL,
|
||||||
"errno should be ERRNO_NOENT"
|
"errno should be ERRNO_INVAL"
|
||||||
);
|
);
|
||||||
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
|
|
||||||
|
|
||||||
// Create a link to a symlink loop following symlinks
|
|
||||||
wasi::path_symlink("symlink", dir_fd, "symlink").expect("creating a symlink loop");
|
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
wasi::path_link(
|
|
||||||
dir_fd,
|
|
||||||
wasi::LOOKUPFLAGS_SYMLINK_FOLLOW,
|
|
||||||
"symlink",
|
|
||||||
dir_fd,
|
|
||||||
"link",
|
|
||||||
)
|
|
||||||
.expect_err("creating a link to a symlink loop following symlinks")
|
|
||||||
.raw_error(),
|
|
||||||
wasi::ERRNO_LOOP,
|
|
||||||
"errno should be ERRNO_LOOP"
|
|
||||||
);
|
|
||||||
wasi::path_unlink_file(dir_fd, "symlink").expect("removing a symlink");
|
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
wasi::path_unlink_file(dir_fd, "file").expect("removing a file");
|
wasi::path_unlink_file(dir_fd, "file").expect("removing a file");
|
||||||
|
|||||||
Reference in New Issue
Block a user