Follow absolute sysroot links to host paths - #280
Conversation
1ea60a8 to
c3e2f5b
Compare
c4b032c to
aa9039d
Compare
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test-sysroot-symlink-target.c">
<violation number="1" location="tests/test-sysroot-symlink-target.c:146">
P2: This new test resolves `Download/` to the host's `$HOME/Downloads` and FAILs the whole suite when that directory does not exist on the machine running CI (`~/.config`-less, headless, or freshly-provisioned macOS runners often have no Downloads). Unlike `/host-home-link` (target `$HOME`, which always exists), there is no guarantee `$HOME/Downloads` is present, so the opendir returns NULL and the regression guard fails spuriously. Recommend staging a guaranteed empty host dir (e.g. under `$tmpdir` sibling or `mktemp -d`) as the link target instead of depending on the caller's real Downloads folder.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| DIR *dir; | ||
| if (chdir("/home/muplar") < 0) { | ||
| FAIL("chdir /home/muplar"); | ||
| } else if ((dir = opendir("Download/")) != NULL) { |
There was a problem hiding this comment.
P2: This new test resolves Download/ to the host's $HOME/Downloads and FAILs the whole suite when that directory does not exist on the machine running CI (~/.config-less, headless, or freshly-provisioned macOS runners often have no Downloads). Unlike /host-home-link (target $HOME, which always exists), there is no guarantee $HOME/Downloads is present, so the opendir returns NULL and the regression guard fails spuriously. Recommend staging a guaranteed empty host dir (e.g. under $tmpdir sibling or mktemp -d) as the link target instead of depending on the caller's real Downloads folder.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/test-sysroot-symlink-target.c, line 146:
<comment>This new test resolves `Download/` to the host's `$HOME/Downloads` and FAILs the whole suite when that directory does not exist on the machine running CI (`~/.config`-less, headless, or freshly-provisioned macOS runners often have no Downloads). Unlike `/host-home-link` (target `$HOME`, which always exists), there is no guarantee `$HOME/Downloads` is present, so the opendir returns NULL and the regression guard fails spuriously. Recommend staging a guaranteed empty host dir (e.g. under `$tmpdir` sibling or `mktemp -d`) as the link target instead of depending on the caller's real Downloads folder.</comment>
<file context>
@@ -121,6 +122,36 @@ int main(void)
+ DIR *dir;
+ if (chdir("/home/muplar") < 0) {
+ FAIL("chdir /home/muplar");
+ } else if ((dir = opendir("Download/")) != NULL) {
+ closedir(dir);
+ PASS();
</file context>
There was a problem hiding this comment.
Addressed.
I changed the fixture in third_party/elfuse/mk/tests.mk so Download no longer points to $HOME/Downloads.
It now does:
mkdir -p "$$tmpdir/host-downloads"
ln -s "$$tmpdir/host-downloads" "$$tmpdir/home/muplar/Download"So the test target is guaranteed to exist on CI, while still exercising the same guest-facing opendir("Download/") path.
Verified with:
make -C third_party/elfuse test-sysroot-symlink-targetAllow sysroot-staged symlinks with absolute targets to resolve through the normal host fallback path, while keeping relative symlink climb-outs blocked. This fixes host bridge links such as Downloads -> /Users/<user>/Downloads returning ELOOP.
aa9039d to
5555c08
Compare
|
Thank @doanbaotrung for contributing! |
Allow sysroot-staged symlinks with absolute targets to resolve through the normal host fallback path, while keeping relative symlink climb-outs blocked.
This fixes host bridge links such as Downloads -> /Users//Downloads returning ELOOP.
Summary by cubic
Allow absolute-target symlinks staged in the sysroot to resolve via the normal host fallback, fixing ELOOP on host bridge links like Downloads ->
/Users/<user>/Downloads. Relative “..” climb-outs stay blocked./host-home-linkand/home/muplar/Downloadto verify host bridge links (including trailing-slash directory opens).Written for commit 5555c08. Summary will update on new commits.