views:

60

answers:

2
system("logscr.ply ");

The error I get is this:

Can't exec "logscr.ply": Permission denied at eal.ply line 3

Why am I getting the error, and how do I fix it?

A: 

What platform/OS is this?

Probably logscr.ply just does not have execute permissions set. On Linux/Unix e.g. you should do

chmod u+x logscr.ply

then try again.

Note: This assumes you are the owner of logscr.ply. If not, adjust accordingly.

sleske
For security reasons you should refrain from granting anything to all the world. Grant permissions as freely as needed, not as freely as possible.
Olfan
@Olfan: True. Edited my answer.
sleske
+2  A: 

Without knowing any more details, there could be a variety of reasons:

  • Your example code states you're trying to execute "logscr.ply ". The space character at the end might be parsed as part of the file name. This should yield a file-not-found error, though.
  • The protection bits for the called script might not allow for direct execution. Try chmod u+x logscr.ply from your command prompt.
  • The folder containing logscr.ply might not be accessible to you. Make sure you have both read and execute permission on it (try chmod u+r,u+x folder-name).
  • The called script might not recognize itself as a Perl script, try system("perl logscr.ply");.
  • There might be a file with the same name somewhere earlier in your $PATH. Use absolute paths in your call to prevent this (system("perl /some/path/logscr.ply");), don't rely on your $PATH variable.
Olfan
Add bit about the `$PATH` and the answer would be complete.
Dummy00001
Very right, thank you. In that case mekasperasky were actually lucky it wouldn't work -- who could know what might have been executed just by coincidence of some maliciously bent $PATH variable!
Olfan
I am fairly sure PATH search ignores files that cannot be executed.
Arkadiy
I just tried adding ~ to my PATH, touching ~/blah with a umask that only leaves -rw-------, cd'ing to /tmp and demanding the shell to run blah. I got a Permission denied error, at least on the RHEL5 servers I have access to from here. Maybe other OSes behave differently, but I do have one tested case in my favour now. You almost got me there, though, I was absolutely not sure myself. ;-)
Olfan