http://www.perlmonks.org?node_id=1080991

larryl has asked for the wisdom of the Perl Monks concerning the following question:

I've run into a problem where IPC::Run reports "permission denied" for a script, because IPC::Run is testing with -x but the script permissions are set via ACLs.

Does anyone know of a workaround with IPC::Run (other than changing the script permissions), or an equivalent module that is ACL-aware?

Thanks!

Replies are listed 'Best First'.
Re: IPC::Run and ACLs?
by BrowserUk (Patriarch) on Apr 03, 2014 at 21:18 UTC

    Patch IPC::Run to skip the -x check on Windows and offer it back to the owner?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Submitting a patch would be my next step (BTW this is on Centos, not Windows). But since there is a queue of over 60 bug reports, and the distro has not been updated since August 2012, I was thinking it might be speedier to switch to a different existing module rather than wait for an updated distro to hit CPAN.

        I was thinking it might be speedier to switch to a different existing module

        Why are you using IPC::Run instead of (say) system or a piped-open?


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        Once again, I know nothing of working with IPC, and thus was curious...dug around a bit on CPAN
        and noticed that IPC::Run3 seems to be reasonably current
        and has only a couple of bugs with recent activity dating around March this year.

        Again, this might not even be appropriate or applicable, but thought that the patch idea might work (or be more hopeful)
        if you tried it with a more recent package.

        At the bottom of the CPAN link above there seems to be a comparison to IPC::Run, though I don't know how objective that might be.

        At any rate, hope this is worth considering(aka reasonably helpful) for you.


        ...the majority is always wrong, and always the last to know about it...
        Insanity: Doing the same thing over and over again and expecting different results.
Re: IPC::Run and ACLs?
by kcott (Archbishop) on Apr 04, 2014 at 07:57 UTC

    G'day larryl,

    Take a look at Capture::Tiny. That may do what you want. If not, its SEE ALSO sections lists more than 20 modules with similar or related functionality (one or more of these may be suitable).

    [Note: I can't comment on the ACL-awareness of any of those modules.]

    -- Ken

      Many thanks, I was not aware of Capture::Tiny, I see there is also a Capture::Tiny::Extended. It's not immediately clear to me how I would use those while sending info to the STDIN of the script, will have to look at that...

      The SEE ALSO section in Capture::Tiny is useful, I think I will check out IPC::Open3 and IPC::Open3::Simple since those handle all of STDIN, STDOUT and STDERR - hopefully they will not suffer from the same permissions problem as IPC::Run.

        "... Capture::Tiny ... not immediately clear to me how I would use those while sending info to the STDIN ..."

        Looking at other responses you've posted in this thread, I do see STDIN mentioned. I didn't notice that when I first replied: Capture::Tiny probably is unsuitable.

        IPC::Open3 is part of the core Perl distribution; if that turns out to suitable (ACL-wise), then there's no installation requirement.

        -- Ken

Re: IPC::Run and ACLs?
by karlgoethebier (Abbot) on Apr 03, 2014 at 20:56 UTC
    "...a workaround with IPC::Run..."

    Perhaps you can provide some more details...(AKA example)?

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Not sure what more details I can provide... The code does this:

      use IPC::Run qw( run ); my $in = "some text input to script"; my ($out, $err); run([ 'foo' ], \$in, \$out, \$err) or throw "run(foo): $err : $?";

      If the "foo" script has execute permissions set, I can run foo directly and also via the code above.

      If the "foo" script does not have execute permissions set, but I am still allowed execute via ACLs, I can run foo directly but the code above fails with a "permission denied" error.

      As I mentioned previously, IPC::Run is testing the script with "-x foo", which does not pay attention to ACLs, and is returning "permission denied" without trying to run the script. So I am hoping there is either some trick I can play with IPC::Run to make it pay attention to ACLs, or some similar module that I can use instead that pays attention to ACLs.