Title: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error · Issue #7693 · developing-today/code · GitHub
Open Graph Title: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error · Issue #7693 · developing-today/code
X Title: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error · Issue #7693 · developing-today/code
Description: Problem In mcpx's directory source walk, one symlink loop entry makes the whole @dir: resolve fail — while the two neighboring bad-link cases are tolerated: a dangling symlink is skipped (pkgs/mcpx/internal/source/source.go:174-180: os.S...
Open Graph Description: Problem In mcpx's directory source walk, one symlink loop entry makes the whole @dir: resolve fail — while the two neighboring bad-link cases are tolerated: a dangling symlink is skipped (pkgs/mcpx...
X Description: Problem In mcpx's directory source walk, one symlink loop entry makes the whole @dir: resolve fail — while the two neighboring bad-link cases are tolerated: a dangling symlink is skipped (pkgs/...
Opengraph URL: https://github.com/developing-today/code/issues/7693
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error","articleBody":"## Problem\n\nIn mcpx's directory source walk, one symlink loop entry makes the whole `@dir:` resolve fail — while the two neighboring bad-link cases are tolerated:\n\n- a **dangling** symlink is skipped (`pkgs/mcpx/internal/source/source.go:174-180`: `os.Stat` failure is continued past only when `errors.Is(err, fs.ErrNotExist)`, comment \"A dangling link has no regular target to read\");\n- a **directory** cycle (a dir symlink pointing back to an ancestor) is skipped by the `os.SameFile` ancestor guard in the same walk (`source.go:152-157`);\n- a symlink **loop** (a link to itself, or two links pointing at each other) makes `os.Stat` fail with ELOOP (\"too many levels of symbolic links\"), which is neither of the above: `source.go:181` returns the error and the entire directory resolution aborts with zero files read — including every healthy regular file sitting next to the loop.\n\nA loop link, like a dangling link, has no regular target to read. The current split — tolerate a missing target and a directory cycle, but let a loop target deny the whole source — is an untested gap, not a pinned decision: the pinned cases in the shipped tests are dangling-skip (`source_test.go:245` `TestDirectorySkipsDanglingLinkAndFollowsLinkOutsideRoot`), directory-cycle-safety (`source_test.go:191`), and permission-error propagation (`source_unix_test.go:73` `TestDirectoryReportsInaccessibleSymlinkTarget`, which pins EACCES as a returned error and must keep behaving that way). No test covers the ELOOP case.\n\n## Evidence (verified this run, laptop, main 8a0a1c0ceac8)\n\nProbe at `~/git/fleet/probe-mcpx-eloop` on the laptop: the real `pkgs/mcpx/internal/source/source.go` copied verbatim (md5 `768194633188160a349eafd555defe53`, identical to the file on main) into a standalone module, driven through the exported `source.Resolve(\"@dir:\"+root, …)`:\n\n- control (regular.ts + dangling.ts → missing): resolves OK, files = [regular.ts] — matches the shipped pin;\n- self-loop (regular.ts + loop.ts → loop.ts): **fails** — `reading …/loop.ts: stat …/loop.ts: too many levels of symbolic links`, zero files returned;\n- pair loop (regular.ts + a.ts → b.ts, b.ts → a.ts): **fails** the same way at a.ts, zero files returned;\n- control (directory back-link to the root itself): resolves OK, files = [regular.ts] — the ancestor guard tolerates the directory cycle.\n\nSo one stray looped link (easily produced by a bad `ln -s` pair or a tool that links a directory's contents into itself at file level) takes down every launcher/prefix/hook that reads its source from that directory, with an error that names the link but gives no way to keep the healthy remainder.\n\nRelated: closed #1727 covered non-regular files in directory sources (FIFO/socket/symlink-to-directory); this is the distinct remaining Stat-error class for file entries. The Go source lives only in this repo (`pkgs/mcpx`); dezren39/darwin-nix only wraps/launches the built mcpx, so no cross-repo set applies. Found via a pr-diff-review REVIEW-FINDING on PR #3744 that was left as decide-and-test material; verified independently this run before filing.\n\n## Why it matters\n\n`@dir:` sources feed mcpx launchers, prefixes, and error hooks. A single looped symlink — which the directory-cycle guard already proves the walk intends to survive at directory level — currently denies the whole source instead of just the unreadable entry. Robustness here should be uniform: an entry with no readable regular target is skipped (dangling, loop), while genuinely informative errors (permission) still surface, per the existing pin.\n\n## Acceptance criteria\n\n- [ ] A directory containing a self-loop symlink or a mutually-looping symlink pair, plus at least one regular file, resolves successfully and returns exactly the regular files (the loop entries skipped), for both the self-loop and pair-loop shapes.\n- [ ] Regression tests for both loop shapes land in `pkgs/mcpx/internal/source` (mirroring the style of `TestDirectorySkipsDanglingLinkAndFollowsLinkOutsideRoot`), and fail on the pre-fix code.\n- [ ] The pinned permission behavior is unchanged: `TestDirectoryReportsInaccessibleSymlinkTarget` still passes — only the ELOOP class changes disposition, not EACCES or other Stat errors (or, if the fix deliberately widens/narrows which Stat errors skip, the disposition of each class is named in the PR and the affected pins updated with rationale).\n- [ ] The existing source suite (`go test ./pkgs/mcpx/internal/source/...`, or the package's normal CI route) is green with the new tests.\n","author":{"url":"https://github.com/apps/developing-today","@type":"Person","name":"developing-today"},"datePublished":"2026-11-08T13:15:31Z","url":"https://github.com/developing-today/code/issues/7693"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:023c1815-0319-a66c-4fed-59c6a6402b02 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D476:2EAB91:43ECB5E:5BED597:6B0729F8 |
| html-safe-nonce | 422f9b06adf7338f218775c84785c8e9062871f25237087269194a313aa4c258 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDc2OjJFQUI5MTo0M0VDQjVFOjVCRUQ1OTc6NkIwNzI5RjgiLCJ2aXNpdG9yX2lkIjoiMzk1MTk0OTAyMTczNjAyMDQ3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c403c0e8b9e61486e901e9ae5928941d308112be67eb4440718a5130fdc22518 |
| hovercard-subject-tag | issue:6271302766 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81e891ba483569b6ec532b321be8d4426ef11af69f58231b3c5fb7122a2e9d95/developing-today/code/issues/7693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81e891ba483569b6ec532b321be8d4426ef11af69f58231b3c5fb7122a2e9d95/developing-today/code/issues/7693 |
| og:image:alt | Problem In mcpx's directory source walk, one symlink loop entry makes the whole @dir: resolve fail — while the two neighboring bad-link cases are tolerated: a dangling symlink is skipped (pkgs/mcpx... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | developing-today[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | d0534ce3ec0f37caea4f39713cbc8a6a509506c09c7ac30e8e3e2e15348bd9c1 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a73ca0a5164c4669446bdffe239b0d7542ad735e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width