[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #64058] stop endorsing the shebang line space myth

From: G. Branden Robinson
Subject: [bug #64058] stop endorsing the shebang line space myth
Date: Sun, 16 Apr 2023 20:45:16 -0400 (EDT)


                 Summary: stop endorsing the shebang line space myth
                   Group: GNU roff
               Submitter: gbranden
               Submitted: Mon 17 Apr 2023 12:45:14 AM UTC
                Category: General
                Severity: 2 - Minor
              Item Group: Lint
                  Status: None
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None


Follow-up Comments:

Date: Mon 17 Apr 2023 12:45:14 AM UTC By: G. Branden Robinson <gbranden>

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

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

Even intensive search of usenet archives didn't reveal any further
hints to me.

Blank forbidden?

I found no evidence yet, that there's an implementation which
forbids a blank after #!

Change our scripts to stop doing this.  The Autoconf manual indeed no longer
endorses or even mentions this, and when I went looking for what happened to
it, I found the foregoing.


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]