Feb 19, 2009

Stupid mistakes

Hello, my far friend :)
Do you remember, we talked of funny mistakes, like when adding firewall rules, we forget to add own IP, to be able to access the system, like running 'reboot' command in the wrong terminal window?
So today, I've made the funniest the most stupid mistake I've ever done :)
I was adding some functionality to our program, that besides other things should remove certain directories. The names of these directories were partly hardcoded into array (like /etc/, /usr/lib/ ...), the last part of the directory name should be added later in code (forming names like /etc/OurCompamyName,/usr/lib/OurCompanyName and like ). Very easy task. The code was written, the program compiled, checked -- everything is working as expected, no problem. Then, I've made small changes in the program logic, recompiled and run it once again. The program run and looked like it was finished ok. Then I mentioned that the system behaves in rather strange way - it doesnt accept new connections via ssh, some commands do not work and complain for libraries... Can you imagine my wonder, when I discovered that /etc/, /usr/lib and some other directories no longer exist! :)))
I've simply forgotten to add the lines of code that add the last and the most important part to the directory names, that should be recursively deleted, so instead of removing /etc/OutCompanyName, the software removed /etc/ ...
Tomorrow, I'll have to reinstall the OS ...
For my luck it was the test system :)

mood: lol
music: Manticora

1 comment:

Deus said...

Hello my sweet princess of the compiler:-) I must laugh and laugh again, and see you and your sweet face, the Questionmark obove, whats wrong ? It brings me back to a far far day, where i should learn, what the meaning of rm -rf is... ;-) Yes you know what i mean, lately now ;-)

After firing the command, all looks good, the cpu is workin fine, and the switch back to prompt without error, a very very good sign....

Very bad was that i had to delete /mnt/etc /mnt/bin and not /etc and /bin ;-) Effect the same, a stupid face, the heart goes faster, inside you brain 10 questions at once, fast check of the procedure here, and there... all ok .. wtf ..

Oh my far princess, thanks for this.