Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename syscall should replace target_path when it it exists #3228

Closed
Yesterday17 opened this issue Oct 14, 2022 · 2 comments
Closed

Rename syscall should replace target_path when it it exists #3228

Yesterday17 opened this issue Oct 14, 2022 · 2 comments
Assignees
Labels
priority-medium Medium priority issue
Milestone

Comments

@Yesterday17
Copy link

if state
.fs
.get_inode_at_path(
inodes.deref_mut(),
new_fd,
target_path.to_str().as_ref().unwrap(),
true,
)
.is_ok()
{
return Errno::Exist;
}

If newpath already exists, it will be atomically replaced, so
that there is no point at which another process attempting to
access newpath will find it missing. However, there will
probably be a window in which both oldpath and newpath refer to
the file being renamed.

-- https://man7.org/linux/man-pages/man2/rename.2.html

@ptitSeb
Copy link
Contributor

ptitSeb commented Oct 14, 2022

I checked the WASI spec, and indeed for path_rename there is

Rename a file or directory. Note: This is similar to renameat in POSIX.

So if the file exist, the file should be replace (atomicaly)

@syrusakbary
Copy link
Member

This should be fixed by #3230

syrusakbary added a commit that referenced this issue Oct 18, 2022
Remove test if dest file exist on path_rename wasi syscall (for #3228)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants