Stream: git-wasmtime

Topic: wasmtime / Issue #2008 Symlink check makes WASI unusable ...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:24):

whitequark opened Issue #2008:

I'm trying to debug another wasmtime misbehavior (it seems that under Windows and Windows only it does not truncate existing files) under wine. I cannot use wasmtime to write to an existing file because it has a symlink check, which always fails if the file exists:

 DEBUG wasi_common::path                              > path_get cur_path = "foo.json"
 DEBUG wasi_common::path                              > path_get path_stack = []
 DEBUG wasi_common::sys::windows::path                > out_path="Z:\\home\\whitequark\\xxx\\build\\foo.json"
 DEBUG wasi_common::sys::windows::path                > readlinkat error=50
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > error=Notsup
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > fd=Fd(1) iovs=*guest 0x6003f0/2
ERROR: Can't open output file `foo.json' for writing: Not supported
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > nwritten=68
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > success=No error occurred. System call completed successfully. (Errno::Success(0))

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:24):

whitequark labeled Issue #2008:

I'm trying to debug another wasmtime misbehavior (it seems that under Windows and Windows only it does not truncate existing files) under wine. I cannot use wasmtime to write to an existing file because it has a symlink check, which always fails if the file exists:

 DEBUG wasi_common::path                              > path_get cur_path = "foo.json"
 DEBUG wasi_common::path                              > path_get path_stack = []
 DEBUG wasi_common::sys::windows::path                > out_path="Z:\\home\\whitequark\\xxx\\build\\foo.json"
 DEBUG wasi_common::sys::windows::path                > readlinkat error=50
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > error=Notsup
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > fd=Fd(1) iovs=*guest 0x6003f0/2
ERROR: Can't open output file `foo.json' for writing: Not supported
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > nwritten=68
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > success=No error occurred. System call completed successfully. (Errno::Success(0))

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:41):

whitequark commented on Issue #2008:

Seems this could fix it?

diff --git a/crates/wasi-common/src/sys/windows/path.rs b/crates/wasi-common/src/sys/windows/path.rs
index 50a234474..79e0df7f1 100644
--- a/crates/wasi-common/src/sys/windows/path.rs
+++ b/crates/wasi-common/src/sys/windows/path.rs
@@ -139,6 +139,9 @@ pub(crate) fn readlinkat(dirfd: &OsDir, s_path: &str) -> Result<String> {
     };
     if let Some(code) = err.raw_os_error() {
         log::debug!("readlinkat error={:?}", code);
+        if code as u32 == winerror::ERROR_NOT_SUPPORTED {
+            return Err(Errno::Inval);
+        }
         if code as u32 == winerror::ERROR_INVALID_NAME {
             if s_path.ends_with('/') {
                 // strip "/" and check if exists

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:54):

abrown labeled Issue #2008:

I'm trying to debug another wasmtime misbehavior (it seems that under Windows and Windows only it does not truncate existing files) under wine. I cannot use wasmtime to write to an existing file because it has a symlink check, which always fails if the file exists:

 DEBUG wasi_common::path                              > path_get cur_path = "foo.json"
 DEBUG wasi_common::path                              > path_get path_stack = []
 DEBUG wasi_common::sys::windows::path                > out_path="Z:\\home\\whitequark\\xxx\\build\\foo.json"
 DEBUG wasi_common::sys::windows::path                > readlinkat error=50
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > error=Notsup
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > fd=Fd(1) iovs=*guest 0x6003f0/2
ERROR: Can't open output file `foo.json' for writing: Not supported
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > nwritten=68
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > success=No error occurred. System call completed successfully. (Errno::Success(0))

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:54):

abrown labeled Issue #2008:

I'm trying to debug another wasmtime misbehavior (it seems that under Windows and Windows only it does not truncate existing files) under wine. I cannot use wasmtime to write to an existing file because it has a symlink check, which always fails if the file exists:

 DEBUG wasi_common::path                              > path_get cur_path = "foo.json"
 DEBUG wasi_common::path                              > path_get path_stack = []
 DEBUG wasi_common::sys::windows::path                > out_path="Z:\\home\\whitequark\\xxx\\build\\foo.json"
 DEBUG wasi_common::sys::windows::path                > readlinkat error=50
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > error=Notsup
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > fd=Fd(1) iovs=*guest 0x6003f0/2
ERROR: Can't open output file `foo.json' for writing: Not supported
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > nwritten=68
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > success=No error occurred. System call completed successfully. (Errno::Success(0))

view this post on Zulip Wasmtime GitHub notifications bot (Jul 10 2020 at 14:54):

github-actions[bot] commented on Issue #2008:

Subscribe to Label Action

cc @kubkon

<details>
This issue or pull request has been labeled: "wasi"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2021 at 17:59):

bjorn3 commented on Issue #2008:

Is this still the case after the rewrite of the wasi implementation?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2021 at 21:49):

pchickey commented on Issue #2008:

All of that path resolution code has been completely rewritten, it now resides in cap-std and has a different design than before. However, I don't think I have enough information to reproduce these bugs and check. @whitequark can you provide a bit more context?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 21 2021 at 23:37):

whitequark commented on Issue #2008:

I'm going to try to reproduce this and comment with the steps as well as close the issue if it's fixed.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 24 2021 at 10:03):

whitequark commented on Issue #2008:

This is no longer an issue on main :tada:

view this post on Zulip Wasmtime GitHub notifications bot (Mar 24 2021 at 10:03):

whitequark closed Issue #2008:

I'm trying to debug another wasmtime misbehavior (it seems that under Windows and Windows only it does not truncate existing files) under wine. I cannot use wasmtime to write to an existing file because it has a symlink check, which always fails if the file exists:

 DEBUG wasi_common::path                              > path_get cur_path = "foo.json"
 DEBUG wasi_common::path                              > path_get path_stack = []
 DEBUG wasi_common::sys::windows::path                > out_path="Z:\\home\\whitequark\\xxx\\build\\foo.json"
 DEBUG wasi_common::sys::windows::path                > readlinkat error=50
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > error=Notsup
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > fd=Fd(1) iovs=*guest 0x6003f0/2
ERROR: Can't open output file `foo.json' for writing: Not supported
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > nwritten=68
 TRACE wasi_common::wasi::wasi_snapshot_preview1      > success=No error occurred. System call completed successfully. (Errno::Success(0))


Last updated: Oct 23 2024 at 20:03 UTC