Shebang line on Windows?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Feb 26 01:52:25 CET 2013


On Mon, 25 Feb 2013 12:29:58 -0500, D'Arcy J.M. Cain wrote:

> On Mon, 25 Feb 2013 10:18:44 -0700
> Michael Torrie <torriem at gmail.com> wrote:
>> On 02/25/2013 06:14 AM, Dave Angel wrote:
>> > It's not Python that needs dos2unix, it's bash or equivalent.  For
>> > some reason, bash shebang processing still isn't tolerant of a
>> > trailing cr on the line. Python doesn't care.
>> 
>> Actually, the shell isn't involved in parsing the shebang line at all.
>> That's actually done in the kernel by the program loader.  So it's the
>> kernel that has a problem with it; wonder if Linus would accept a patch
>> to ignore the tailing CR?
> 
> So much the wrong solution.  First of all, I don't think that Linus is
> on the bash development team so he can't help there.

/facepalm

Perhaps you forgot to read Michael's comment before criticising it?

The bash dev team is irrelevant, because this is not a bash problem. It 
is the kernel, not bash, that reads the shebang line. So yes, Linus 
Torvalds could fix this problem if he chose.


> Also, bash is not
> the only shell in the world.  And, Linux is not the only operating
> system in the world.  There are still a lot of Unix systems (the system
> that Linux is a clone of) out there.  FreeBSD, NetBSD, Solaris, Mac OSX,
> etc.  You can't expect all of them to bend over backwards for every
> Windows wart out there.

Nobody is asking anyone to support "every Windows wart out there". 
Windows-style line separators are not a wart, it is a convention used by 
many, many tools, operating systems, data formats (e.g. email), etc. It 
is an old, old convention, going back to teletype days and so predating 
not just Windows but also Unix. So in fact it is *Unix* that broke the 
convention, and Unix line separators which is the "wart" (or at least a 
regression).


-- 
Steven



More information about the Python-list mailing list