WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Better test before committing...  (Read 6663 times)

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Better test before committing...
« on: June 17, 2011, 05:01:53 PM »
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

If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
Re: Better test before committing...
« Reply #1 on: August 23, 2011, 04:03:51 AM »
lol :)

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: Better test before committing...
« Reply #2 on: August 23, 2011, 07:42:42 AM »
I do not understand this post - Is this a virus?
please explain a bit
thank you
t(w)o be(ers) or not t(w)o be(ers) that is the question

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11654
Re: Better test before committing...
« Reply #3 on: August 23, 2011, 11:29:39 AM »
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
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.
 
« Last Edit: August 23, 2011, 12:51:15 PM by Rich »

Offline robc

  • Sr. Member
  • ****
  • Posts: 447
Re: Better test before committing...
« Reply #4 on: August 23, 2011, 02:10:26 PM »
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
"Never give up! Never surrender!" - Commander Peter Quincy Taggart

"Make it so." - Captain Picard