MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _check_user_owns_path

Function _check_user_owns_path

e2e/python/test_sandbox_landlock.py:102–115  ·  view source on GitHub ↗

Return a closure that checks if the current user owns a path.

()

Source from the content-addressed store, hash-verified

100
101
102def _check_user_owns_path():
103 """Return a closure that checks if the current user owns a path."""
104
105 def fn(path):
106 import os
107
108 try:
109 st = os.stat(path)
110 uid = os.getuid()
111 return f"owner:{st.st_uid} me:{uid} match:{st.st_uid == uid}"
112 except OSError as e:
113 return f"ERROR:{e}"
114
115 return fn
116
117
118# =============================================================================

Calls

no outgoing calls

Tested by

no test coverage detected