← 返回首页
gh-90473: wasmtime does not support absolute symlinks by tiran · Pull Request #93490 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) .rst  (2) All 2 file types selected Viewed files
Conversations
Failed to load comments. Retry
Loading
Jump to
Jump to file
Failed to load files. Retry
Loading
Diff view
Unified
Split
Hide whitespace
Apply and reload
Show whitespace
Diff view
Unified
Split
Hide whitespace
Apply and reload
8 changes: 6 additions & 2 deletions Lib/test/support/os_helper.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ def can_symlink():
global _can_symlink
if _can_symlink is not None:
return _can_symlink
symlink_path = TESTFN + "can_symlink"
# WASI / wasmtime prevents symlinks with absolute paths, see man
# openat2(2) RESOLVE_BENEATH. Almost all symlink tests use absolute
# paths. Skip symlink tests on WASI for now.
src = os.path.abspath(TESTFN)
symlink_path = src + "can_symlink"
try:
os.symlink(TESTFN, symlink_path)
os.symlink(src, symlink_path)
can = True
except (OSError, NotImplementedError, AttributeError):
can = False
Expand Down
30 changes: 10 additions & 20 deletions Lib/test/test_posixpath.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,7 @@ def test_realpath_pardir(self):
self.assertEqual(realpath(b'../..'), dirname(dirname(os.getcwdb())))
self.assertEqual(realpath(b'/'.join([b'..'] * 100)), b'/')

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_basic(self):
# Basic operation.
Expand All @@ -398,8 +397,7 @@ def test_realpath_basic(self):
finally:
os_helper.unlink(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_strict(self):
# Bug #43757: raise FileNotFoundError in strict mode if we encounter
Expand All @@ -411,8 +409,7 @@ def test_realpath_strict(self):
finally:
os_helper.unlink(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_relative(self):
try:
Expand All @@ -421,8 +418,7 @@ def test_realpath_relative(self):
finally:
os_helper.unlink(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_symlink_loops(self):
# Bug #930024, return the path unchanged if we get into an infinite
Expand Down Expand Up @@ -463,8 +459,7 @@ def test_realpath_symlink_loops(self):
os_helper.unlink(ABSTFN+"c")
os_helper.unlink(ABSTFN+"a")

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_symlink_loops_strict(self):
# Bug #43757, raise OSError if we get into an infinite symlink loop in
Expand Down Expand Up @@ -505,8 +500,7 @@ def test_realpath_symlink_loops_strict(self):
os_helper.unlink(ABSTFN+"c")
os_helper.unlink(ABSTFN+"a")

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_repeated_indirect_symlinks(self):
# Issue #6975.
Expand All @@ -520,8 +514,7 @@ def test_realpath_repeated_indirect_symlinks(self):
os_helper.unlink(ABSTFN + '/link')
safe_rmdir(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_deep_recursion(self):
depth = 10
Expand All @@ -540,8 +533,7 @@ def test_realpath_deep_recursion(self):
os_helper.unlink(ABSTFN + '/%d' % i)
safe_rmdir(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_resolve_parents(self):
# We also need to resolve any symlinks in the parents of a relative
Expand All @@ -560,8 +552,7 @@ def test_realpath_resolve_parents(self):
safe_rmdir(ABSTFN + "/y")
safe_rmdir(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_resolve_before_normalizing(self):
# Bug #990669: Symbolic links should be resolved before we
Expand Down Expand Up @@ -589,8 +580,7 @@ def test_realpath_resolve_before_normalizing(self):
safe_rmdir(ABSTFN + "/k")
safe_rmdir(ABSTFN)

@unittest.skipUnless(hasattr(os, "symlink"),
"Missing symlink implementation")
@os_helper.skip_unless_symlink
@skip_if_ABSTFN_contains_backslash
def test_realpath_resolve_first(self):
# Bug #1213894: The first component of the path, if not absolute,
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_stat.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_directory(self):
else:
self.assertEqual(modestr[0], 'd')

@unittest.skipUnless(hasattr(os, 'symlink'), 'os.symlink not available')
@os_helper.skip_unless_symlink
def test_link(self):
try:
os.symlink(os.getcwd(), TESTFN)
Expand Down
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Skip symlink tests on WASI. wasmtime uses ``openat2(2)`` with
``RESOLVE_BENEATH`` flag, which prevents symlinks with absolute paths.
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Skip tests on WASI that require symlinks with absolute paths.
Toggle all file notes Toggle all file annotations

Footer

© 2026 GitHub, Inc.