Warning: First line of file-interpreter script does not contain #!

2 views
Skip to first unread message

Christoph Dorn

unread,
Sep 20, 2011, 3:13:12 PM9/20/11
to gp...@googlegroups.com
Calling:

$ gsr ../../pinf-loader.js ../HelloWorld

Gives following warning:

gsr: Warning: First line of file-interpreter script does not contain #!

Source (../../pinf-loader.js):
--
require("./lib/pinf-loader-js/loader").boot();
--

I think the warning should only be issued if the ".js" extension is
omitted in the script path argument to `gsr`.

i.e.

$ gsr ../../pinf-loader ../HelloWorld
=> No warning

$ gsr ../../pinf-loader.js ../HelloWorld
=> Issue warning

Christoph

Jeff Johnson

unread,
Sep 20, 2011, 3:19:53 PM9/20/11
to gp...@googlegroups.com

Changing behavior based solely on a suffix is a disaster that M$
has inflicted on the world with MIME types.

Admittedly its tricky to do the textual correlation based solely on
content to truly detect whether file content mught need a #! (or not).

I'm pretty sure that if/when Wes succeeds in releasing GPSEE that
he will be forced to be less pedantic and remove the warning entirely ;-)

73 de Jeff
> Christoph
>

Wes Garland

unread,
Sep 20, 2011, 5:08:14 PM9/20/11
to gp...@googlegroups.com
The warning there is actually an indication that I could not accurately differentiate between the two script run modes -- shebang and as an argument to GSR -- satisfactorily in order to insure no command line parsing ambiguities.

On 20 September 2011 15:19, Jeff Johnson <n3...@mac.com> wrote:
>  $ gsr ../../pinf-loader.js ../HelloWorld


Any chance I could convince you to use gsr -f ?
 
> I think the warning should only be issued if the ".js" extension is omitted in the script path argument to `gsr`.

That's an interesting idea I haven't yet considered, although there are potential ambiguities there as well. The biggest factor to consider is the case when programs are loaded with the shebang; it's not relevent to the user that the program is written in JS, and hence unlikely to have a .js extension.
 
I'm pretty sure that if/when Wes succeeds in releasing GPSEE that
he will be forced to be less pedantic and remove the warning entirely ;-)

Yeah. I have a feeling you're right, but I'll want to make sure I can guarantee correct behaviour in all cases first.  I wish the exec(2) semantics were clearer for file interpreters, but we can't change 30 years of history.

Wes

--
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102

Jeff Johnson

unread,
Sep 20, 2011, 5:14:46 PM9/20/11
to gp...@googlegroups.com
On Sep 20, 2011, at 5:08 PM, Wes Garland wrote:


I'm pretty sure that if/when Wes succeeds in releasing GPSEE that
he will be forced to be less pedantic and remove the warning entirely ;-)

Yeah. I have a feeling you're right, but I'll want to make sure I can guarantee correct behaviour in all cases first.  I wish the exec(2) semantics were clearer for file interpreters, but we can't change 30 years of history.


Add a --pedantic flag and make it "opt-in" rather than "opt-out" is one approach.

Another approach -- since you are relying on this behavior in "production" @page.ca --
would be to add a persistent setting somehow.

You've done that at compile time: make it a run-time flag is all I'm suggesting.

But in the "real world" of FL/OSS the only rule that applies is this:

The nail that sticks out will get hammered.

The underlying design flaw that JS hasn't any concept of shebangs (becase '#' isn't a comment)
will be missed entriely, as will be the nicely done ancient uglix-ness (i.e. I *like* GPSEE warnings ;-)

73 de Jeff

Christoph Dorn

unread,
Sep 20, 2011, 7:56:23 PM9/20/11
to gp...@googlegroups.com
Wes Garland wrote:
On 20 September 2011 15:19, Jeff Johnson <n3...@mac.com> wrote:
>  $ gsr ../../pinf-loader.js ../HelloWorld


Any chance I could convince you to use gsr -f ?
Yes. Oops. I am fine with that.

Christoph

Wes Garland

unread,
Sep 20, 2011, 9:00:58 PM9/20/11
to gp...@googlegroups.com
On 20 September 2011 17:14, Jeff Johnson <n3...@mac.com> wrote:

But in the "real world" of FL/OSS the only rule that applies is this:

The nail that sticks out will get hammered.

True, that.  It's good to have you active in here again with pragmatic advice. :)

Reply all
Reply to author
Forward
0 new messages