Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

IPC::Run and ACLs?

by larryl (Scribe)
on Apr 03, 2014 at 18:48 UTC ( #1080991=perlquestion: print w/ replies, xml ) Need Help??
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!

Comment on IPC::Run and ACLs?
Re: IPC::Run and ACLs?
by karlgoethebier (Priest) 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.

Re: IPC::Run and ACLs?
by BrowserUk (Pope) 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 (Abbot) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1080991]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-12-21 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (108 votes), past polls