in reply to xargs error using open cmd for output with redirected input file

the following error message: "sh: /sw/packages/findutils/4.1/bin/xargs: Permission denied"

So that's the shell complaining, which means the problem is unlikely to be directly related to perl. You can either work out what's different between your successful invocation of the shell command interactively and when it is run from this script (uid, gid, euid, env, pwd, context, ...) or you can add diagnostic debugging statements into the script to tell you these things automatically, eg.

system ("id; env");

You haven't said (or I didn't spot) how you are running the resulting perl (interactive? at? cron?) or which OS you are using, so it's a bit hard to offer further advice at this stage.

  • Comment on Re: xargs error using open cmd for output with redirected input file
  • Download Code

Replies are listed 'Best First'.
Re^2: xargs error using open cmd for output with redirected input file
by cben (Initiate) on Nov 30, 2016 at 21:03 UTC

    Thank you for your reply!

    So that's the shell complaining, which means the problem is unlikely to be directly related to perl.

    You're right, I just wasn't getting the implications of this.

    I was running the script manually as root (I know), whereas the automatic invocation is happening through a cgi program through a web server (both on a linux vm).

    I'd verified the uid/euid and gid/egid were the same using debug statements, but only for the manual invocation.

    I believe the cgi is running as Apache:Apache. I guess this could be a setuid problem but I'm not familiar with that at all. And I realize that's beyond the scope of a Perl forum (although any insight is welcome!).

    Again, many thanks!

    .