Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Go go.work audit: false NotAMember for a use path through a missing dir on macOS (breaks macOS test job)

Geschlossen Anfängerfreundlich
#1,409 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
76/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
github-actions, go, macos, rust
Bereich
backend, devops, testing

Rechercherichtung

Beginne mit same_dir_key in crates/socket-patch-core/src/vendor/go_consumer_sync.rs und lies den zugehörigen Doc-Kommentar zusammen mit dem fehlschlagenden Test go_work_that_does_not_use_the_project_makes_the_replace_inert. Führe die gezielten Tests für go_consumer_sync aus, wobei TMPDIR auf ein Verzeichnis zeigt, das ein Symlink ist, um den Fehler zu reproduzieren. Als erledigt gilt die Aufgabe, wenn der Verwendungspfad über ein fehlendes Verzeichnis mit dem Projektstamm übereinstimmt und der falsche NotAMember-Konflikt unter macOS abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

agent:triaged bug pm:go priority:p2

[agent] Found while checking the full-scope CI run for #1407. It breaks the macOS test job, so tonight's nightly on main is expected to go red.

What fails

vendor::go_consumer_sync::tests::go_work_that_does_not_use_the_project_makes_the_replace_inert (added in #1393, merged 2026-10-11 19:48 UTC, after the last nightly) fails on macos-latest: run 38191238691, job 114624594929.

panicked at crates/socket-patch-core/src/vendor/go_consumer_sync.rs:923:13:
assertion `left == right` failed: ./x/../app
  left: [Workspace { module: "example.com/upstream", version: "v1.0.0", conflict: NotAMember { work_file: "/private/var/folders/.../go.work" } }]
 right: []

The spellings ./app, app, ./app/ and "./app" all pass. Only ./x/../app fails.

Root cause

same_dir_key (go_consumer_sync.rs:468) calls std::fs::canonicalize on the raw joined path <ws>/x/../app. canonicalize needs every component to exist, and x doesn't, so the call errors and the code falls back to the lexical path /var/.../app. The project root does exist and canonicalizes to /private/var/.../app, because /var is a symlink on macOS. The two keys differ, so the use entry doesn't match the project and the audit reports NotAMember.

It isn't only a test problem. Any user whose go.work use path passes through a directory that doesn't exist, and whose project sits under a symlinked path (macOS /var or /tmp, a symlinked home or checkout), gets a false "go.work does not use this project" conflict. Go itself resolves use paths lexically (filepath.Clean), so ./x/../app is a valid member for go.

Repro on Linux

Point TMPDIR at a symlinked directory:

mkdir -p /tmp/real && ln -sfn /tmp/real /tmp/link
TMPDIR=/tmp/link cargo test -p socket-patch-core --lib go_consumer_sync
# 8 passed; 1 failed (same assertion)

Proposed fix (verified locally)

Normalize lexically first, then canonicalize. This matches go's filepath.Clean and still resolves symlinks when the cleaned path exists:

 fn same_dir_key(dir: &Path) -> PathBuf {
     let abs = std::env::current_dir().unwrap_or_default().join(dir);
-    std::fs::canonicalize(&abs)
-        .unwrap_or_else(|_| crate::utils::relpath::normalize_lexically_keeping_escapes(&abs))
+    let lexical = crate::utils::relpath::normalize_lexically_keeping_escapes(&abs);
+    std::fs::canonicalize(&lexical).unwrap_or(lexical)
 }

With this patch, TMPDIR=/tmp/link cargo test -p socket-patch-core --lib go_consumer_sync gives 9 passed. The rest of vendor:: matches main: the only two failures, pypi_poetry::...wire_write_failure... and pypi_requirements::...wire_failure_rolls_back..., fail on unpatched main too when run as root in the agent sandbox.

This is product code in the Go lane (first issue-fixer instance), so I haven't claimed it. The doc comment above same_dir_key should be updated with the fix.


Generated by Claude Code

Vorherrschende Sprache
Rust
Sterne
8
Forks
1
Ø Merge
18 Std. 19 Min.
Gemergte PRs (30 T.)
504

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus SocketDev/socket-patch

Alle Issues in SocketDev/socket-patch

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.