0
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?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Hick
  • 35,524
  • 46
  • 151
  • 243

2 Answers2

3

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
  • 579
  • 6
  • 17
  • 2
    Add bit about the `$PATH` and the answer would be complete. – Dummy00001 Oct 04 '10 at 14:35
  • 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 Oct 05 '10 at 11:29
  • I am fairly sure PATH search ignores files that cannot be executed. –  Oct 05 '10 at 17:08
  • 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 Oct 06 '10 at 09:46
0

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
  • 81,358
  • 34
  • 189
  • 227
  • 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 Oct 04 '10 at 13:27