| Summary: | Scripts with #!/interpreter paths longer than 64 bytes don't work. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Magnus Backstrom <b> |
| Component: | kern | Assignee: | John W. De Boskey <jwd> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.4-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->jwd I've looked into the problem and will followup. State Changed From-To: open->feedback Fix committed for secondary /bin/sh execution. Increased MAXSHELLCMDLEN to 128. Waiting on feedback from submitter. State Changed From-To: feedback->closed Received positive feedback from Magnus. |
If an interpreter pathname is longer than about 64 characters, i.e. #!/you/have/a/slightly/longer/than/usual/path/to/your/interpreter, /bin/sh gets used instead and your script may break. Fix: Change line 39 of /usr/src/sys/sys/imgact.h from #define MAXSHELLCMDLEN 64 to something more sensible, e g #define MAXSHELLCMDLEN 512 This doesn't seem to break anything. How-To-Repeat: x> mkdir -p /tmp/this/is/a/slightly/too/long/path/to/the/interpreter x> ln -s /usr/bin/awk \ /tmp/this/is/a/slightly/too/long/path/to/the/interpreter x> cat > /tmp/test.awk #!/tmp/this/is/a/slightly/too/long/path/to/the/interpreter/awk -f { 1 } x> chmod +x /tmp/test.awk x> /tmp/test.awk {: Command not found. x>