Commit 1ca6201
authored
fix(process): Program.Find used a SECOND, unfixed copy of lookPath (#10)
v0.16.2 fixed executable resolution on Windows and did not fix executable
resolution on Windows, because this module carried TWO copies of it:
exec/exec.go lookPath <- fixed in v0.16.2
os_exec_link.go lookPath <- byte-identical, untouched
Program.Find calls the second. os_exec_link.go:45 still read
`return info.Mode()&0111 != 0` — the exact defect v0.16.2's own commit message
spends three paragraphs on — so every consumer resolving through Program.Find
kept failing with `Program.Find: "git": not found in PATH`, on a release that
claimed the opposite. go-inference's windows lane measured it: 41 occurrences
before v0.16.2, 41 after.
A fix is not landed until you have grepped for its siblings. Byte-identical
duplicates are how a fixed defect stays live.
So the fix is not a second copy of the fix. internal/lookpath now holds ONE
implementation and both consumers call it — because the duplication IS the
defect's cause, and patching in place would guarantee a third divergence. The
three Windows defects it carries are unchanged from v0.16.2: no %PATHEXT%
expansion, a mode&0111 test the platform can never satisfy, and a path-vs-name
check that missed '/'.
commandContext no longer discards the resolution failure either. It records it
on Cmd.Err exactly as exec.Command does with its own LookPath error — Start
returns it without running anything. Deferring to Start rather than returning
early is deliberate: an early return skipped Service.start's exited-event
broadcast, which TestService_Actions/broadcasts_exited_event_on_start_failure
caught. The callers' failure handling is untouched.
Receipts — macOS, GOWORK=off (what CI runs):
go test -count=1 ./...
ok process 13.478s · exec 0.733s · internal/lookpath 0.499s · pkg/api 2.800s
golangci-lint run ./... 0 issues
gofmt -l · go vet: clean
TestProgram_Find_UsesSharedResolution pins the miss itself: Program.Find must
land on the same path the shared resolver reports. It fails the moment a third
copy appears or the two drift apart again — which a version bump could not
detect and did not.
The resolution tests move with the code into internal/lookpath, keeping the
fixture-PATH + fake-%PATHEXT% receipts that prove the Windows rules on a POSIX
runner.1 parent 8e0532a commit 1ca6201
8 files changed
Lines changed: 562 additions & 509 deletions
File tree
- go
- exec
- internal/lookpath
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
301 | | - | |
| 302 | + | |
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| |||
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
0 commit comments