- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Sadly I've done this exact same thing before... on our production server. luckily for me, I had a data source mounted as /data which was read-only. So when I saw hundreds of 'cannot delete' messages scroll past, and realise something was wrong, I'd only lost the /bin directory. Which was rather easy to recover (relatively speaking).
Normally when I run that script I do other things and wouldn't have noticed all the error messages scrolling by, but this particular time I was reading a book and could see the screen.
Admin
Hey look at all these files in /lib, I bet I could free up some space by deleting them OH SHI
Admin
Had a manager on an old AOS/VS box do the delete from root. Had deleted most of the system software by the time he ^C'd out of it. Fortunately the box had an enormous amount of memory in it...40mb...so the OS didn't need to page in anything at that time. So I go to the tapes & restore the sw.
System worked fine, no production lost. I bounced it at EOD 'cause I didn't want to tempt the fates.
I imagine today's *xix/linux machines can do the same w/ a lot of memory on hand. Don't know about windows.
cr
Admin
I guess it's been a long day. What does "a non-write-only scripting language" mean?
Admin
A long time ago I worked with number crunching software in a lab. One of the scripts that glued some of these applications together had the annoying habit of spewing out huge files named '*' (without the quotes) in the directory containing the resulting number crunching data. After a simulation had finished, after several weeks of crunching numbers, a hasty attempt to free up some dist quota by removing this file once freed up a whole lot more space than intended.
Admin
Oups, it's look like this comment has been deleted
Admin
http://en.wikipedia.org/wiki/Write-only_language
Admin
http://en.wikipedia.org/wiki/Write-only_language
Admin
Also great entertainment is mounting /usr on Solaris on a different file system. Hours of fun. Or have they fixed that by now?
Admin
On a related note, I always thought that awk & sed pattern matching & manipulation came closest to line noise.
Admin
Everyone who's see Wargames knows what DEFCON 1 means...
and how to hack into NORAD with an acoustic coupler
Admin
The funniest part is when you click the link the first page in google is this post.
Admin
It's a type of Poem. Obviously the Muse had inspired Jerry at the time...
Admin
Back in the earlier days of VMS, due to it's heritage and for backwards compatibility reasons it had multiple directories at the MFD (i.e., root) level of the system disk that were synonym entries (i.e., links).
Disk space was a real premium back then, and we had a manager who had BYPASS (i.e., root/administrator) privileges on a system his dept. owned (I know, that's a HUGE mistake and I never allowed it after witnessing this).
Anyway, he was poking in places he shouldn't and noticed that the system disk directories [SYSEXE] and [001004] (IIRC) had the exact same files in them. So, he happily started deleting what he thought were duplicates, proud of himself for freeing up so much disk space.
On the live system. During the day. With 30-40 people trying to use it.
Luckily, the system manager at the time had done regular backups. With a cheap backup software (i.e. not the OS-supplied one). Which saved money by using fewer tapes.
It used fewer tapes because it didn't record all those XOR redundancy records that the VMS OS engineers had found necessary to add to their OS-supplied backup utility.
And the tapes that these depts. used were the cast-offs from the mainframe operators because they were too old and unreliable.
I was very fortunate that, being only 1 year out of college, they hadn't found some way to blame it all on me.
Admin
The best thing about noting spelling errors here is that it pisses off the illiterate morons who can neither spell nor resist the urge to call those who can "Spelling Nazis" or "pricks".
Such fools can't be good programmers: compilers are much more fastidious about spelling than I.
Admin
in the root directory, and any other critical directories "touch -i"
Admin
You must be a joy to work with.
Admin
That's Murphy's law right there. "rm -rf $var1/$var2" just screams to me that at some point, both $var1 and $var2 will both be set to "" and disaster strikes. Someone should have seen that coming.
Don't try this, but I'm pretty sure Ubuntu will at least require you to type "Yes, Do As I Say" (case sensitive) after an rm -rf /
Admin
This page is, ironically, now the number 1 hit on google for that query.
Admin
That’s not irony.
Admin
I thought a spell checker was an enchanted draught that you place near your keyboard to magically correct typographical errors.
Admin
My sentiments exactly.
Admin
This is easy to do if you use "set -e":
test -z "$var1" test -z "$var2"
And also particularly useful to stick at the beginning of the commands in a make rule that's going to use those variables later on.
("set -u" is great advice though, I didn't know about that!)
Admin
(And also particularly useful to stick at the beginning of the commands in a make rule that's going to use those variables later on. "
In the form: test -z "$$var1" of course)
Admin
Admin
Admin
Somewhat ironically the top goolge hit is for this page
Admin
Apparently no one else is stupid enough to try to use it as a verb.
Admin
'set -u' (err on an unset variable) doesn't sounds like a good idea if you want to allow a variable to be initialized "by the caller". e.g. '. conf.sh'
IIRC it used to be the default in csh on my old Solaris account at the university, and I recall it causing random login script errors for me.
Admin
Here we go until DEFCON 65535 for finer granularity of incident impact
Admin
You missed the real checks :)
Admin
If the guy was less than two weeks from being done there anyway, just tell them to F off and leave on the spot. I would take a little hit in my finances rather than deal with the BS.
Admin
"One of the cool features of Solaris 10 is that "rm -rf /" refuses to work. The Sun guys said they knew people don't type this deliberately, but often scripts intend to do "rm -rf $var1/$var2" and forget to set var1 and var2. "
the latest versions of gnu core-utils prevents that as well. It would have to be rm -rf /* (or run it with --no-preserve-root, as preserve-root is now the default).
Admin
Whoever keyed in the rm -rf $var1/$var2 should be thrown in jail. Seriously, it's like an architect deciding not to include a central column or something in an apartment complex causing it to collapse. Except of course that a building collapse would probably cause loss of life, I get that. But still, I think there should be higher professional standards for programmers.
Admin
This sure is taking a long time to execu
Admin
The real wtf source of these problems is the bourne shell itself. Both problems can be easily be avoided by using set -eu. 'e' for exit on error in the cd case, and 'u' to exit on undefined variables.
Admin
Are there really that many people that don't have one of the working sides of their bed up against a wall?
Admin
Admin
The story was paraphrased and some creative license was taken. That is, it is not exactly as I submitted it but all the major points are there and correct.
There was almost no comments in the script and the two variables which needed to be set were buried deep in the script. There was absolutely no checking that variables or command line inputs there provided/defined or correct.
Admin
I left the company on good terms. I still talk to many of the staff there. I felt horrible that I was leaving them in this state. They were very dependent on the shell script and my only advice was to stop using it.
Admin
Oddly enough, the IT staff had aliased rm to use rm -i but the creator of the script changed it to /bin/rm -rf to get around that. I'm sure he would have figured a way around the features of Solaris 10 as well.
Admin
Network was set up so if you 'sudo su -' you were root EVERYWHERE. This story was not invented. The code was created by an employee who left the company approximately a year before the incident. His 'manager' was a pointy haired type. The code created pretty HTML tables so the manager was happy. My employees used the code and understood how to use it without any knowledge of what it could do. I, stupidly, assumed it had been code reviewed (nope) and had at least the most basic of safe guards. The ability to 'sudo su -' (sudo anything really) was there so we could do maintenance in the system. It was NEVER meant to be used in a script.
The script became root to do the clean up because the original developer was under pressure to get it working and keep it working. With insufficient time he did what 'worked for now'. I don't know if he every planned on coming back and cleaning it up.
After the incident, I was asked to explain why it happened (it was suspected sabotage). The manager responsible for the mess had a copy of the scripts so I did a code review. Within seconds of walking the code I found the cleanup.sh with a sudo to root and the /bin/rm -rf $var1/$var2 (it literally was $var1 and $var2). I almost had a heartattack. The person who wrote this was a senior developer with extensive UNIX IT experience.
I did a find . -name "*" -type f -exec grep 'rm -rf' {} ; and found over a dozen pieces of code that did this.
Admin
Actually a bash script is not a Bourne shell script. There are things you can do in bash that you cannot do in the original Bourne shell. At the site in question there were scripts written to take advantage of the features of bash. If the script was written to work on the subset of features available on ALL Bourne shells (HP-UX, Solaris, AIX, Xenix, etc.) we called it a Bourne shell. It was just a convention used at that particular shop.
Agreed. But when management fires/demotes people who cannot do the impossible, you cut corners like this and hope you are gone before the sh!t hits the fan. I missed by 2 weeks.
See above.
Manager got promoted for getting script written on time and under budget. Employee who wrote the script left to be QA Manager at another company (let's call it Company X). Bizarre thing is my current company's server was down for 2 hours before we get a call from a customer letting us know. The software used to monitor the state of our server and email us if there was trouble was written by Company X.
IT manage submitted what was required to properly back up everything. Management told him, "here is your budget (1/10 the money/time needed for a bad backup plan), try again."
Admin
Admin
I had neglected to consider double beds, sure. But then only one side of the bed is available to you in the first place otherwise you'll trample the one you're sharing it with. Even assuming they've already left, you're then both using the one side of the bed, and it can consequently be put up against a wall and not take up valuable room in the middle of the room.