- 论坛徽章:
- 7
|
Blank after #! required?
There is a rumor, that a very few and very special, earlier Unix versions (particularly 4.2BSD derivatives) require you to separate the "#!" from the following path with a blank.
You may also read, that (allegedly) such a kernel parses "#! /" as a 32-bit (long) magic. But it turns out that it is virtually impossible to find a Unix which actually required this.
4.2BSD in fact doesn't require it, although previous versions of the GNU autoconf tutorial wrongly claimed this ("10. Portable Shell Programming", corrected with release 2.64, 2009-07-26).
But instead, see 4.2BSD, /usr/src/sys/sys/kern_exec.c (the first regular occurence). A blank is accepted but not required.
All this pointed out by Gunnar Ritter in <3B5B0BA4.XY112IX2@bigfoot.de> (and thanks to the new Caldera license, the code can be cited here now.)
Instead, the origin of this myth "of the required blank" might be a particular release of 4.1 BSD: There is a manpage in a "4.1.snap" snapshot of 4.1BSD
on the CSRG CDs, /usr/man/man2/exec.2 (4/1/81), where a space/tab after the #! is mentioned as mandatory. However, this is not true: the source itself remained unchanged.
(Hint to the existence of such a manpage from Bruce Barnett in <ae3m9l$rti$0@208.20.133.66>).
It's not clear whether this is a bug or confusion in documentation or if Berkeley planned to modify the BSD source but eventually did not.
DYNIX is mentioned in the autoconf documentation, too. It's unclear if this variant might have implemented it in a few releases
(perhaps following the abovementioned manual page). At least Dynix 3.2.0 or Dynix PTS 1.2.0 were actually 4.2 BSD derived and did not require the blank
I asked David MacKenzie, the author of the autoconf documentation, about the actual origin of the autoconf note.
But unfortunately neither the reporting author nor the very system are recorded anymore.
Even intensive search of usenet archives didn't reveal any further hints to me. |
|