From: Hansjoerg Lipp <hjlipp@web.de>
To: Paul Jackson <pj@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Linux 2.6: shebang handling in fs/binfmt_script.c
Date: Sun, 22 Feb 2004 16:54:10 +0100 [thread overview]
Message-ID: <20040222155410.GA3051@hobbes> (raw)
In-Reply-To: <20040222020911.2c8ea5c6.pj@sgi.com>
On Sun, Feb 22, 2004 at 02:09:11AM -0800, Paul Jackson wrote:
> In addition to the incompatible changes you note:
> 1) "#! cmd x y" to pass single arg "x y" with embedded space broken
> 2) Use of '\' char changed
Well, as noted, this part can be removed easily. As I consider this part
least important, I maybe should have deleted it before sending the patch
(some "#ifdef CONFIG_xxxx" could be used instead).
But as I sent the patch also because I wanted to know what other people
think about the issue, I did not change it (passing \t was the topic of
the newsgroup discussion I mentioned).
> 3) Handling of long line changed
> doesn't this also
> 4) risk breaking shells that look to argv[2] for the name of the
> shell script file for error messages? This argument
> has moved out to argv[argc-1], for some value of argc.
Well, if the shell can't handle some parameters, you shouldn't add them
to the shebang line. If you have some example.script
#!cmd -x
executed as "example.script -a -b", exec will still pass
{"cmd", "-x", "example.script", "-a", "-b"} as argv to cmd.
The patch just allows
#!cmd -x -y
to become {"cmd", "-x", "-y", "example.script", "-a", "-b"}.
If I understand you right, your argument could be used to say: passing
arguments is not good at all, because some interpreter expects the name
of the script in argv[1] (as it's usual with "normal" "#!/bin/sh"
scripts). In my opinion, you just can't use a shebang line
"#!interpreter argument" in this case. And it's the same with my
proposal: you don't have to pass two arguments -- and you shouldn't if
the interpreter can't handle it.
BTW, which shell expects the name of the script in argv[2]?
> I'll wager you have to make a better case for this than simply:
>
> As I'm really missing this feature in Linux and changing this
> would not break any (unless ...
>
> before the above incompatibilities in a critical piece of code are
> overcome with the compelling need to change these details.
Yes, you may be right. But please note, that the "incompatibilities"
are rather theoretical, in my opinion (please correct me if I'm wrong):
- I don't think there are many scripts with "#!cmd -a -b" that must be
parsed like {"cmd", "-a -b"}. And scripts like this would not be
portable among the Unices, anyway.
- I think it's much better to get an error on a too long shebang line.
It's rather dangerous to drop excessive characters silently as this
can change the meaning of the command totally.
It's just a pain to have to use wrappers; they make a system
unnecessarily complex and error-prone and the arguments needed by the
interpreter cannot be found, where it's most logical to search.
I think, handling the shebang line "my" way (as it's already done by
FreeBSD) makes writing complex scripts easier and cleaner and has no
real disadvantages.
Thanks for the response,
Hansjoerg Lipp
next prev parent reply other threads:[~2004-02-22 15:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-16 13:34 [PATCH] Linux 2.6: shebang handling in fs/binfmt_script.c Hansjoerg Lipp
2004-02-22 10:09 ` Paul Jackson
2004-02-22 15:54 ` Hansjoerg Lipp [this message]
2004-02-22 20:53 ` Paul Jackson
2004-02-22 22:57 ` Jamie Lokier
2004-02-23 5:44 ` Paul Jackson
2004-02-23 14:22 ` Jamie Lokier
2004-02-23 17:34 ` Andries Brouwer
2004-02-23 20:13 ` Paul Jackson
2004-02-23 21:46 ` Paul Jackson
2004-02-24 1:13 ` Hansjoerg Lipp
2004-02-24 1:29 ` Paul Jackson
2004-02-25 23:13 ` Hansjoerg Lipp
2004-02-23 20:12 ` Paul Jackson
2004-02-23 20:16 ` Jamie Lokier
2004-02-23 22:08 ` Paul Jackson
2004-02-23 20:25 ` Hansjoerg Lipp
2004-02-23 22:00 ` Paul Jackson
2004-02-23 23:59 ` Jamie Lokier
2004-02-24 0:13 ` Hansjoerg Lipp
2004-02-24 1:32 ` Paul Jackson
2004-02-25 23:14 ` Hansjoerg Lipp
2004-02-25 23:24 ` Paul Jackson
2004-02-23 20:13 ` Hansjoerg Lipp
2004-02-23 22:24 ` Paul Jackson
2004-02-24 0:21 ` Hansjoerg Lipp
2004-02-23 5:49 ` Paul Jackson
2004-02-23 5:50 ` Paul Jackson
2004-02-23 5:42 ` Paul Jackson
2004-02-23 20:24 ` Hansjoerg Lipp
2004-02-23 21:55 ` Paul Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040222155410.GA3051@hobbes \
--to=hjlipp@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox