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

Fixed an issue when renaming a file from a preopened dir directly (for 3084) #3088

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/wasi/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,13 @@ pub fn path_rename<M: MemorySize>(
}
}

// this is to be sure the source file is fetch from filesystem if needed
wasi_try!(state.fs.get_inode_at_path(
inodes.deref_mut(),
old_fd,
source_path.to_str().as_ref().unwrap(),
true
));
let (source_parent_inode, source_entry_name) =
wasi_try!(state
.fs
Expand All @@ -2657,7 +2664,6 @@ pub fn path_rename<M: MemorySize>(
wasi_try!(state
.fs
.get_parent_inode_at_path(inodes.deref_mut(), new_fd, target_path, true));

let host_adjusted_target_path = {
let guard = inodes.arena[target_parent_inode].read();
let deref = guard.deref();
Expand Down