Commit a479327
authored
fix(install): don't treat JS scripts with non-Node shebang as native binaries (#33971)
The native-binary detection added in #33935 went through
`node_resolver::read_bin_value`, which returns `BinValue::Executable`
for *any* file whose first line isn't a recognized npx-style shebang —
not just for files with ELF/Mach-O/PE magic bytes. Bin scripts with a
`#!/usr/bin/env deno` shebang (like the
`@denotest/lifecycle-scripts-simple`
fixture) were therefore classified as native binaries, so `deno install
-g` wrote a shim that `exec`'d the `.js` file directly instead of
running `deno run`. On Unix the kernel still honored the shebang, but
on Windows there is no shebang interpretation, so the install was
broken — `specs::install::global::allow_scripts` started failing on
the Windows shards once the change landed on main.
Fix is to check the bin entry's magic bytes directly with
`node_resolver::is_binary` instead of routing through `read_bin_value`,
so only real ELF/Mach-O/PE binaries get the exec-the-file shim and
ordinary JS bin scripts continue down the `deno run` path regardless
of their shebang.1 parent ab074be commit a479327
1 file changed
Lines changed: 53 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
592 | 604 | | |
593 | 605 | | |
594 | 606 | | |
| |||
2289 | 2301 | | |
2290 | 2302 | | |
2291 | 2303 | | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
2292 | 2340 | | |
2293 | 2341 | | |
2294 | 2342 | | |
| |||
0 commit comments