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'

In reply to Re:x2 Backticked commands and the readpipe blues by grinder
in thread Backticked commands and the readpipe blues by grinder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.