I've been passing time this afternoon by generating random strings and passing them through Perl's eval. The scripts are strings that contain only the following characters:
+-*$_.,/\@()%=`
Is there a statistically significant risk that I break something?
Note: I don't pass it arguments like "rm -rf /".
Statistically significant from a statistician's point of view, no. From a programmers point of view yes. Any percentage of risk that can be avoided is too much.
$! can resolve to a wide variety of strings, depending on platform and locale. So perhaps something like
eval "$!=$$/$.,`$!`"
has the potential for mischief.
My gut says that answering this question definitively (i.e., with an actual probability) would probably end up placing a bound on Chaitin's constant which is incomputable. So it's most likely not possible (mathematically speaking) to answer your question.
Why not just sandbox the Perl process if you're worried?
加载中,请稍侯......
精彩评论