Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Sep 2004 09:45:27 -0500
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Ceri Davies <ceri@submonkey.net>, S?awek ?ak <zaks@prioris.mini.pw.edu.pl>, freebsd-current@freebsd.org
Subject:   Re: Bug in #! processing
Message-ID:  <790a9fff04093007451fdb0f7f@mail.gmail.com>
In-Reply-To: <20040930122154.GS2493@submonkey.net>
References:  <861xgm5ltz.fsf@thirst.unx.era.pl> <20040928194853.GT2493@submonkey.net> <86k6ud2t6t.fsf@thirst.unx.era.pl> <20040929131136.GA2493@submonkey.net> <86mzz8x8zv.fsf@thirst.unx.era.pl> <20040930122154.GS2493@submonkey.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 30 Sep 2004 13:21:54 +0100, Ceri Davies <ceri@submonkey.net> wrote:
> I agree(ish); I don't think that the kernel should do anything special
> here either and I think that the "correct" thing to do would be to back
> out that revision.  Unfortunately the FreeBSD userbase can write a lot
> of scripts in 4 and a half years and we probably can't get away with it.
> Perhaps it could be done in -CURRENT, but I'd really like to see some
> other opinions.  For clarity, what I'm proposing is the application of
> the attached diff.  Opinions from anyone?
> 
Instead of backing out that revision, change the test for # to include
a check for white space before it, this way those who have used the #
character as a comment on the first line won't have to change any
thing.

-	for (ihp = &image_header[2]; *ihp != '\n' && *ihp != '#'; ++ihp) {
+	for (ihp = &image_header[2]; *ihp != '\n' && ! (*ihp-1 == '[white
space]' && *ihp == '#'); ++ihp) {

where [white space] could be either a tab or a space character.

or just check if a dash is before #.

+	for (ihp = &image_header[2]; *ihp != '\n' && ! (*ihp-1 == '-' &&
*ihp == '#'); ++ihp) {


Scot

Discaimer: the code may not work as written adjust to your liking.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff04093007451fdb0f7f>