Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re:x2 Backticked commands and the readpipe blues

by grinder (Bishop)
on Sep 23, 2002 at 16:37 UTC ( #200154=note: print w/replies, xml ) Need Help??


in reply to Re: Backticked commands and the readpipe blues
in thread Backticked commands and the readpipe blues

What you're missing is the fact that I want to bypass the shell. I don't want to subject to its quoting rules and I don't want it to see 'foo;rm -rf /'. I don't want to second-guess the shell by escaping metacharacters and hope I get them all... I just don't want to have to worry at all.

And from my dim, dark memories of shell programming, to quote a single quote, e.g. don't, you have to say 'don'"'"'t', which means that your code would produce incorrect results. This stuff is tricky!

Backticking is a concise construct for extracting output from external programs, but as things stand, you cannot avoid bringing the shell into the picture. If you could be certain that you were calling the child program directly, a lot of the security hassle would magically evaporate.

It's another "Doctor, Doctor" story.

Patient: Doctor, doctor, when I stick my arm out the car window, it gets smashed to pieces by a passing truck.
Doctor: Well, don't do that then.

If I knew I didn't have to stick my arm out, I'd be fine. But the only way to do that in the current scenario is to go through all the hoops of forking and listening to my child. In my books this is One More Damned Thing To Go Wrong. Programming Perl, the book, hinted that in the future such a thing was going to be possible, but on the face of things it looks like it was an idea never went anywhere.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

Replies are listed 'Best First'.
Re^3: Backticked commands and the readpipe blues
by Flexx (Pilgrim) on Sep 23, 2002 at 21:13 UTC

    Hi grinder!

    Thanks for the clarification.. I did indeed not see that you'd actually really, really want to bypass the shell.. ;)

    Under that aspect, in a way, it's just fair you'll have to cope with what the shell usually does for you... ;)

    If I recall correctly, system() calls execvp(), maybe you could do that yourself. But that would, of course, involve XS hacking, something I didn't want to touch so far (which might turn out to be a fear of nothing once I do). Then again, maybe there's something out there already...

    Umm... I wish I could be of more help...

    Good luck & so long,
    Flexx

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://200154]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2022-12-05 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?