Off-Topic > Off-Topic - The Funnies

Better test before committing...

(1/1)

gutmensch:
I feel I had to share this although it's already worldwide in the feeds... it really made my day ;)

https://github.com/MrMEEE/bumblebee/commit/a047be

Arslan S.:
lol :)

beerstein:
I do not understand this post - Is this a virus?
please explain a bit
thank you

Rich:
Hi beerstein
No, not a virus, a syntax error in a script. The line in the script reads

--- Quote ---rm -rf /usr /lib/nvidia-current/xorg/xorg
--- End quote ---
There is a space between  /usr  and  /lib/nvi...   which does not belong there. As a result, you get
rm -rf  // Translation, remove recursively and do not prompt for confirmation.
/usr     // That's your usr directory, don't want to remove that, do you?
/lib/nvidia-current/xorg/xorg     // This probably won't exist and be ignored

So what should have been a simple and straight forward operation turned into a disaster because
someone added an extra  space  into a command and then proceeded to compound the error
by not testing the script. And if I read correctly, the faulty script was present in two releases of
the package.

Moral: No matter how simple or routine you think that line of code you just wrote is, test, test, test.
 

robc:
And since they were probably not using TC they would have to reinstall or try to recover by rebuilding the /usr directory tree instead of just rebooting  :P

Navigation

[0] Message Index

Go to full version