Stefan Johnson | 1 Nov 2011 01:03
Picon

Re: OpenBSD and shebang line to a script not supported?

On Mon, Oct 31, 2011 at 6:39 PM, Mikolaj Kucharski
<mikolaj <at> kucharski.name>wrote:

> On Mon, Oct 31, 2011 at 11:25:22PM +0000, Mikolaj Kucharski wrote:
> > Attached archive has small testing scripts to be extracted in /tmp.
>
> http://www4.kucharski.name/pub/script-shebang-tests.tgz
>
>
I don't know what to tell you.  I've never seen anyone try to call a script
in the shebang before.
If you use #!/usr/bin/perl in the shebang for perl scripts you get expected
behavior.  If you use
#!/bin/sh in the shebang for the shell scripts you get expected behavior.

Stefan Johnson

Mikolaj Kucharski | 1 Nov 2011 01:08
Favicon

Re: OpenBSD and shebang line to a script not supported?

Dear all, before you reply to this thread please check the scripts first
and read carefully the output.

There is no permission denied, nor file not found errors, but execution
of a script with wrong interpreter.

The issue I'm reporting here maybe tricky for some of you, so please
read carefuly before posting a reply.

Also in terms of subject line, I'm talking about *script* in shebang
line, not a *binary* in shebang line. /bin/sh or /usr/bin/perl is a
binary, where exec1.sh and exec2.pl have *scripts* in shebang line.

Thank you.

On Mon, Oct 31, 2011 at 11:25:22PM +0000, Mikolaj Kucharski wrote:
> Hi,
> 
> Attached archive has small testing scripts to be extracted in /tmp.
> There are 2 tests (exec1 and exec2) with 2 scripts each (4 scripts
> total):
> 
> test#1, openbsd:
> $ /tmp/exec1.sh
> exec1.sh executed
> 
> test#1, linux:
> # /tmp/exec1.sh
> /tmp/exec1.pl executed
> exec1.sh executed
(Continue reading)

Theo de Raadt | 1 Nov 2011 01:20
Picon
Favicon

Re: OpenBSD and shebang line to a script not supported?

> Also in terms of subject line, I'm talking about *script* in shebang
> line, not a *binary* in shebang line. /bin/sh or /usr/bin/perl is a
> binary, where exec1.sh and exec2.pl have *scripts* in shebang line.

That would be the FDSCRIPTS #ifdef in exec_script.c in the kernel.

That is not enabled by default, you're the first to bring this up
in two decades.

Philip Guenther | 1 Nov 2011 01:28
Picon

Re: OpenBSD and shebang line to a script not supported?

On Mon, Oct 31, 2011 at 5:08 PM, Mikolaj Kucharski
<mikolaj <at> kucharski.name> wrote:
> Dear all, before you reply to this thread please check the scripts first
> and read carefully the output.

Today's lesson in economics: the harder to make something, the less
people will do it.  Getting pedantic about it doesn't help.

> Also in terms of subject line, I'm talking about *script* in shebang
> line, not a *binary* in shebang line. /bin/sh or /usr/bin/perl is a
> binary, where exec1.sh and exec2.pl have *scripts* in shebang line.

Use of a script as the interpreter for another script is not
supported.  RTFS: /usr/src/sys/kern/exec_script.c

Philip Guenther

Mikolaj Kucharski | 1 Nov 2011 01:28
Favicon

Re: OpenBSD and shebang line to a script not supported?

Also this is what ktrace says:

 31688 ktrace   RET   ktrace 0
 31688 ktrace   CALL  execve(0xcfbdb6fb,0xcfbdb674,0xcfbdb67c)
 31688 ktrace   NAMI  "./exec1.sh"
 31688 ktrace   NAMI  "/tmp/exec1.pl"
 31688 ktrace   RET   execve -1 errno 8 Exec format error

at this stage I think this behaviour is OpenBSD specific, the only
question to the mailing list I have, can you confirm this?

Thanks.

On Tue, Nov 01, 2011 at 12:08:04AM +0000, Mikolaj Kucharski wrote:
> Dear all, before you reply to this thread please check the scripts first
> and read carefully the output.
> 
> There is no permission denied, nor file not found errors, but execution
> of a script with wrong interpreter.
> 
> The issue I'm reporting here maybe tricky for some of you, so please
> read carefuly before posting a reply.
> 
> Also in terms of subject line, I'm talking about *script* in shebang
> line, not a *binary* in shebang line. /bin/sh or /usr/bin/perl is a
> binary, where exec1.sh and exec2.pl have *scripts* in shebang line.
> 
> Thank you.
>  
> On Mon, Oct 31, 2011 at 11:25:22PM +0000, Mikolaj Kucharski wrote:
(Continue reading)

Martin Schröder | 1 Nov 2011 01:34
Picon

Re: OpenBSD and shebang line to a script not supported?

2011/11/1 Theo de Raadt <deraadt <at> cvs.openbsd.org>:
> That would be the FDSCRIPTS #ifdef in exec_script.c in the kernel.
>
> That is not enabled by default, you're the first to bring this up
> in two decades.

Wikipedia
(https://secure.wikimedia.org/wikipedia/en/wiki/Shebang_%28Unix%29)
and the links provided by it
(http://www.in-ulm.de/~mascheck/various/shebang/
http://www.opengroup.org/platform/resolutions/bwg2000-004.html) all
talk about _interpreters_, not scripts.

http://www.in-ulm.de/~mascheck/various/shebang/#interpreter-script
makes me believe this is a recent Linuxism.

Best
   Martin

Edho Arief | 1 Nov 2011 03:38
Gravatar

Re: OpenBSD and shebang line to a script not supported?

On Tue, Nov 1, 2011 at 7:28 AM, Mikolaj Kucharski
<mikolaj <at> kucharski.name> wrote:
> Also this is what ktrace says:
>
> B 31688 ktrace B  RET B  ktrace 0
> B 31688 ktrace B  CALL B execve(0xcfbdb6fb,0xcfbdb674,0xcfbdb67c)
> B 31688 ktrace B  NAMI B "./exec1.sh"
> B 31688 ktrace B  NAMI B "/tmp/exec1.pl"
> B 31688 ktrace B  RET B  execve -1 errno 8 Exec format error
>
> at this stage I think this behaviour is OpenBSD specific, the only
> question to the mailing list I have, can you confirm this?
>

Looks more like Linux specific.

$ which perl
/usr/bin/perl
$ /tmp/exec1.sh
exec1.sh executed
$ /tmp/exec2.pl
use: not found
use: not found
/tmp/exec2.pl: 6: Syntax error: Bad for loop variable
$ uname -a
FreeBSD localname.localdomain 7.4-RELEASE-p3 FreeBSD 7.4-RELEASE-p3
#0: Tue Sep 27 14:47:23 UTC 2011
root <at> i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
$

(Continue reading)

Daniel B. | 1 Nov 2011 02:46
Picon

Re: GTK+ icons on latest snapshot

On Tue, Oct 18, 2011 at 02:15:43AM -0200, Daniel B. wrote:
> Hi misc <at> ,
> 
> Since my last snapshot upgrade, with upgraded packages, all GTK+
> application icons have a white or a black background, with no transparency.
> 
> It's a minor problem, but it's annoying anyway. Some icons really suck,
> plus that some applications don't have a text label in buttons, making it 
> hard to figure out what the functionality is.
> 
> Am I missing something?

Solved only by downloading Xenocara sources and compiling it.

Andres Perera | 1 Nov 2011 05:05
Favicon

Re: OpenBSD and shebang line to a script not supported?

how does linux handle that without going into infinite loops?

On Mon, Oct 31, 2011 at 6:55 PM, Mikolaj Kucharski
<mikolaj <at> kucharski.name> wrote:
> Hi,
>
> Attached archive has small testing scripts to be extracted in /tmp.
> There are 2 tests (exec1 and exec2) with 2 scripts each (4 scripts
> total):
>
> test#1, openbsd:
> $ /tmp/exec1.sh
> exec1.sh executed
>
> test#1, linux:
> # /tmp/exec1.sh
> /tmp/exec1.pl executed
> exec1.sh executed
>
>
> test#2, openbsd:
> $ /tmp/exec2.pl
> /tmp/exec2.pl[3]: use: not found
> /tmp/exec2.pl[4]: use: not found
> /tmp/exec2.pl[6]: syntax error: `(' unexpected
>
> test#2, linux:
> # /tmp/exec2.pl
> exec2.sh executed
> exec2.sh executed
(Continue reading)

David Gwynne | 1 Nov 2011 05:57
Favicon

Re: OpenBSD and shebang line to a script not supported?

linux runs infinite loops in 5 minutes, so thats not a huge problem for them.

On 01/11/2011, at 2:05 PM, Andres Perera wrote:

> how does linux handle that without going into infinite loops?
> 
> On Mon, Oct 31, 2011 at 6:55 PM, Mikolaj Kucharski
> <mikolaj <at> kucharski.name> wrote:
>> Hi,
>> 
>> Attached archive has small testing scripts to be extracted in /tmp.
>> There are 2 tests (exec1 and exec2) with 2 scripts each (4 scripts
>> total):
>> 
>> test#1, openbsd:
>> $ /tmp/exec1.sh
>> exec1.sh executed
>> 
>> test#1, linux:
>> # /tmp/exec1.sh
>> /tmp/exec1.pl executed
>> exec1.sh executed
>> 
>> 
>> test#2, openbsd:
>> $ /tmp/exec2.pl
>> /tmp/exec2.pl[3]: use: not found
>> /tmp/exec2.pl[4]: use: not found
>> /tmp/exec2.pl[6]: syntax error: `(' unexpected
>> 
(Continue reading)


Gmane