View Issue Details

IDProjectCategoryView StatusLast Update
0000626fileGeneralpublic2025-02-22 15:01
Reportermgkurtz Assigned To 
PrioritylowSeveritytextReproducibilityalways
Status newResolutionopen 
Platformx86_64OSDebianOS Versiontesting
Product Version5.46 
Summary0000626: Extracting name from `#!/usr/bin/env interpreter` lines is imprecise
DescriptionI just noticed a few subtleties concerning shebangs with `/usr/bin/env`: For reference, here is the responsible code from `Magdir/varied.script`:

```
0 string/wt #!\ /usr/bin/env a
>15 string/T >\0 %s script text executable
```
Steps To ReproduceHere are some corner cases collected via Debian Code Search:

A quite [common](https://codesearch.debian.net/search?q=%2Fusr%2Fbin%2Fenv+-S&literal=1) one:
```
#!/usr/bin/env -S make -f
```
Result: `a -S make -f script`.

A [strange](https://codesearch.debian.net/search?q=%28%3Fm%29%5E%23%21++%2B%2F&literal=0) one:
```
#! /usr/bin/env tclsh
```
Result: `a v tclsh script`. Curiously, the result remains the same here, when one replaces the fixed offset `15` by a relative offset of `&0`. I guess that the `w` flag does not properly compute the offset for the continuation lines.

And an [erroneous](https://codesearch.debian.net/search?q=%2Fusr%2Fbin%2Fenv%5Cw&literal=0) one:
```
#!/usr/bin/envthon
```
Result: `a hon script`.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-02-22 15:01 mgkurtz New Issue