Repository navigation
fix: a program is not looked for in a node_modules/.bin of the current directory or above; docker found as git is (0.28.2) - #60
Merged
Conversation
…current directory or above; docker is run from proc.ts npx puts <cwd>/node_modules/.bin, and every ancestor's, first on PATH as absolute entries, so a git, a dotnet or a docker committed in a workspace was the program craftar ran. pathEntries drops those entries, for the lookup and for the PATH the program gets. docker was started by name, outside the one runner: dockerRunner and runCompose now go through execProgram and spawnInherited, so docker gets this rule and the one of 0.27.2.
…TH has none, and no file starts a program by name Fourteen of the cases fail on the code before. The planted program is a copy of node under a name no real program has; no test starts Docker. The guard over node:child_process no longer has a docker exception.
…, docker found as git and dotnet are What stops being found, for which programs, and what each command then says.
… PATH values that tell the lookups apart (review) The cases that expect the local node_modules/.bin to be skipped had no proof the program was in it, and two PATH values gave the same answer before the fix.
…es; to 0.28.2 says what services status does and what was not measured (review) A hand-written entry for the same node_modules/.bin is skipped too, so the remedy is another directory; services status exits 1 with every service not created; what docker does with the reduced PATH was not measured.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npmenvironmentPATHentry that is<dir>/node_modules/.bin, for the directory craftar is started in or one above it, is skipped — in the program lookup and in thePATHthe program gets.npx craftarputs those entries first, as absolute ones, so agit, adotnetor adockercommitted in a workspace was the program craftar ran. The compare is lexical (no link followed; without case on Windows); anode_modules/.binelsewhere onPATHis looked in as before.dockeris now run from the one runner (src/core/proc.ts), asgitanddotnetare since 0.27.2: found in the absolute entries ofPATHonly, on Windowsdocker.exe/docker.comonly, and given the same reducedPATH. No file undersrc/outsideproc.tsstarts a program any more.Contracts and bytes
--jsonshape changes.git,dotnetordockerreachable only through such anode_modules/.bin— and adockerreachable only through a relativePATHentry or adocker.cmdshim — is no longer found.Test plan
npm run typecheck— exit 0npm run build— exit 0npx vitest run --exclude test/ci.test.ts --maxWorkers=6— exit 0: 102 files passed, 1 skipped; 2758 tests passed, 8 skippedtest/ci.test.ts— never part of a by-hand run; this PR's CI is its runtest/local-bin.test.ts(13 cases) and the guard intest/git-lookup.test.ts: 14 cases fail on the code before the fix, the 15th is a control. No test starts Docker — the planted program is a copy of node under a name no real program hasnode-cli-revieweranddocs-author: two rounds, clean on5fc87a4; the reviewer also ran, by hand, a fakegitplanted in a temporary project'snode_modules/.bin: skipped from inside the project, run from an unrelated directorynpx craftar, anything with a real docker, Windows and macOS (the win32 branches of the rule are pure and ran on Linux; this CI is their first run on Windows). Whatdockerdoes with the reducedPATHwhen it starts a credential helper was not measured