4 ms·
A quick example - RVM! http://rvm.io http://rvm.io suggests you run the command: \curl -L https://get.rvm.io https://get.rvm.io | bash -s stable Which exhibi
by chadnickbok 13y ago
A quick example - RVM!
http://rvm.io http://rvm.io suggests you run the command:
\curl -L https://get.rvm.io https://get.rvm.io | bash -s stable
Which exhibits exactly the failure scenario outlined in the article; partway through the script RVM cleans up after itself by running "rm -rf ${rvm_src_path}"
Simple changing this to
"\curl -L https://get.rvm.io https://get.rvm.io > /tmp/rvm.sh && bash /tmp/rvm.sh stable"
Would eliminate the potential for nasty failures, with a minimum of fuss.
- Dylan16807 13y agoBut there's no / in that command, or any way for it to rm the wrong directory, unless I'm misunderstanding something.
- yen223 13y agoThere's no guarantee where $rvm_src_path will point to.
- chadnickbok 13y agoYou're right, I'm completely wrong - the worst thing that can happen here is that the whole RVM directory is removed. Hardly catastrophic, and definitely not the extreme failure case the article is talking about.
- cbsmith 13y agoActually, just changing it to "wget -O - https://get.rvm.io https://get.rvm.io | bash -s stable" would work fine. Of course, doing it the way you describe creates a /tmp race condition, so there's that. I'm also curious what you think a partial read of "rm -rf ${rvm_src_path}" might resolve to that would be dangerous.