From 90f1cd5c96fdc3f3b34e83857af30c4b99c84918 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 17 Sep 2019 22:34:32 +0200 Subject: [PATCH] Fix path_remove_directory on *nixes --- build.rs | 1 - src/hostcalls_impl/fs.rs | 4 +++- src/hostcalls_impl/fs_helpers.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index ff492bdf03..777027b94a 100644 --- a/build.rs +++ b/build.rs @@ -165,7 +165,6 @@ cfg_if::cfg_if! { match name { "path_rename_trailing_slashes" => true, "path_symlink_trailing_slashes" => true, - "remove_directory_trailing_slashes" => true, _ => false, } } else { diff --git a/src/hostcalls_impl/fs.rs b/src/hostcalls_impl/fs.rs index fabe04bd91..e2d725871e 100644 --- a/src/hostcalls_impl/fs.rs +++ b/src/hostcalls_impl/fs.rs @@ -978,7 +978,9 @@ pub(crate) unsafe fn path_remove_directory( let dirfd = wasi_ctx .get_fd_entry(dirfd, host::__WASI_RIGHT_PATH_REMOVE_DIRECTORY, 0) .and_then(|fe| fe.fd_object.descriptor.as_file())?; - let resolved = path_get(dirfd, 0, path, false)?; + let resolved = path_get(dirfd, 0, path, true)?; + + log::debug!("path_remove_directory resolved={:?}", resolved); hostcalls_impl::path_remove_directory(resolved) } diff --git a/src/hostcalls_impl/fs_helpers.rs b/src/hostcalls_impl/fs_helpers.rs index 138ac13a4a..0dbdda8559 100644 --- a/src/hostcalls_impl/fs_helpers.rs +++ b/src/hostcalls_impl/fs_helpers.rs @@ -5,6 +5,7 @@ use crate::{host, Error, Result}; use std::fs::File; use std::path::{Component, Path}; +#[derive(Debug)] pub(crate) struct PathGet { dirfd: File, path: String,