﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
329	spawn() and a shell script not started with #!	KO Myung-Hun		"Hi/2.

Some shell scripts do not have #! at first line. In this case, spawn() cannot execute it.

For examples,

// spawn.sh
{{{
eval '(exit $?0)' && eval 'exec perl -w ""$0"" ${1+""$@""}'
  & eval 'exec perl -w ""$0"" $argv:q'
    if 0;

my $v='Hello';
print $v, ""\n"";
}}}

// spawn.c
{{{
#include <stdio.h>
#include <process.h>

int main( int argc, char *argv[])
{
    int rc;

    if( argc < 2 )
    {
        fprintf( stderr, ""Usage: spawn program\n"");

        return 1;
    }

    rc = spawnvp( P_WAIT, argv[ 1 ], &argv[ 1 ]);
    printf(""spawnvp() = %d\n"", rc );
    if( rc == -1 )
        perror(""spawnvp()"");

    return !!rc;
}
}}}

When trying

{{{
spawn spawn.sh
}}}

the result is

{{{
spawnvp() = -1
spawnvp(): Invalid executable file format
}}}

"	defect	new	normal	libc-0.7	libc	0.6.6	normal			
