Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Where should I post such things?

by bdimych (Monk)
on Jan 24, 2008 at 10:45 UTC ( #663981=perlquestion: print w/replies, xml ) Need Help??
bdimych has asked for the wisdom of the Perl Monks concerning the following question:

> cat x #!/blabla > > > ./x -bash: ./x: /blabla: bad interpreter: No such file or directory > > > perl -e 'exec("x") || die($!)' No such file or directory at -e line 1. > >
bash's messsage much more informative than perl's, it is not a bug, it is something like small feature request?

Replies are listed 'Best First'.
Re: Where should I post such things?
by svenXY (Deacon) on Jan 24, 2008 at 10:57 UTC
    Hi,
    IMHO, the message is very clear. bash spits out more information because you have it (blabla) in the shebang line and it therefore complains about a bad interpreter.

    The rest of the message is the same and comes from the OS.

    Cheers, Sven
      Hi,
      small correction:
      exec does not find the file although it should:
      ~/tmp$ ./x bash: ./x: /blabla: bad interpreter: No such file or directory ~/tmp$ perl -e 'exec("x") || die($!)' No such file or directory at -e line 1. ~/tmp$ perl -e 'exec("~/tmp/x") || die($!)' sh: /home/svenXY/tmp/x: /blabla: bad interpreter: No such file or dire +ctory
      but
      $ perl -e 'exec("pwd") || die($!)' /home/svenXY/tmp
      So now you know why the messages are different, but I'm confused as to why exec does not find file x...
      Regards,
      svenXY

        exec respects $ENV{PATH} (or rather, exec uses the OS, and the OS respects $ENV{PATH}), and "." seems to be not in the path (and the OS seems to be one which does not have "." as a mandatory default in the list of directories searched for the executable).

        In both cases -- according to ktrace(1) on FreeBSD 6-STABLE with Perl 5.8.8 in zsh 4 -- perl is complaining, through execve(2), about the missing interpreter not the file itself being executed.

        Corion's reply reminded me that I just had added '.' to the path; thanks. It turns out the message, or rather error from execve(2), is the same whether the problem is not finding the file being executed, or if found, with missing interpreter listed in the file. Anyawy, what OP said.

Re: Where should I post such things?
by shmem (Chancellor) on Jan 24, 2008 at 12:56 UTC
    Where should I post such things?

    Just here (with a more appropriate title) or elsewhere.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://663981]
Approved by svenXY
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2018-06-21 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (118 votes). Check out past polls.

    Notices?