develooper Front page | perl.perl5.porters | Postings from July 2001

ActivePerl 628 + warnings + fork + exec = spurious "Can't exec"?

Thread Next
From:
barries
Date:
July 11, 2001 09:40
Subject:
ActivePerl 628 + warnings + fork + exec = spurious "Can't exec"?
Message ID:
20010711124012.C24560@jester.slaysys.com
Using ActivePerl 628 (v5.6.1) on NT4, This script:

   my @cmd = ( 'C:\WINNT\system32\command.com', "/c" );
   fork ? wait : do { use warnings; $!=0; exec @cmd, "echo 0" };
   fork ? wait : do { use warnings; $!=1; exec @cmd, "echo 1" };
   fork ? wait : do { use warnings; $!=2; exec @cmd, "echo 2" };
   fork ? wait : do { no  warnings;       exec @cmd, "echo 3" };

Produces:

   D:\temp\IPC-Run-1.44>perl foo
   0
   Can't exec "C:\WINNT\system32\command.com": No error at foo line 2.
   1
   Can't exec "C:\WINNT\system32\command.com": Operation not permitted at foo line 3.
   2
   Can't exec "C:\WINNT\system32\command.com": No such file or directory at foo line 4.
   3

   D:\temp\IPC-Run-1.44>

I couldn't find this in the bug database, but I'm having trouble beleiving
it (both that it's real and that it's not in the bug db :-). Is this a
known issue? Or am I smoking crack?

A quick code read makes me think that this stretch of doio.c doesn't
know about exec() returning under exec() emulation:

        if (really && *tmps)
            PerlProc_execvp(tmps,EXEC_ARGV_CAST(PL_Argv));
        else
            PerlProc_execvp(PL_Argv[0],EXEC_ARGV_CAST(PL_Argv));
        if (ckWARN(WARN_EXEC))
            Perl_warner(aTHX_ WARN_EXEC, "Can't exec \"%s\": %s",
                (really ? tmps : PL_Argv[0]), Strerror(errno));

But that's just a guess.

- Barrie


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About