Best of Jokes Current Jokes RHF Home Search Sponsor RHF?
Fun Stuff & Jokes
Previous | RHF Joke Archives | Next

Always code safely!

rootbeer@teleport.com (Tom Phoenix)
Society for the Elimination of Unwarranted Excess Superfluous Text in Internet Header Lines
(smirk, computers, original)

[ Original by me. I posted this the other day to comp.lang.perl.misc in "answer" to the quoted question. 'flock' is the standard function for locking files. ] Re: concurrently writing to a file without doing flock [rec.humor.funny]

Re: concurrently writing to a file without doing flock


On Tue, 10 Nov 1998 someone wrote:
> What is the worst thing that can happen when several processes print
> to the same file, without using flock, every print writes exactly one
> line, and the file handles are set to unbuffered?

The worst thing? Here's the worst I can think of.

An urgent message comes in to the NSA from a branch office of the CIA. It turns out that Ginger Spice has just discovered the secret files with the true story of the assassination of JFK, as well as an inventory of Area 51, the hiding place of a sasquatch family, and the real reason that the Olsen twins have another TV show. If she's not stopped, she will use this information to force her way into the UN, then work secretly behind the scenes to force Newt Gingrich out of office, leak internal memos from Microsoft, and give Alanis Morrisette an uncontrollable desire to run around naked on MTV. Ginger's evil activities will go undetected because thousands of people will be talking about putting on ape suits and burying the Statue of Liberty up to the neck before John Glenn returns.

Alas, because some programmer failed to properly use flock, the message is over-written by some message asking what colors an iMac comes in. The end of the world comes shortly thereafter.

Don't let this happen to you; always use flock when several processes need to access the same file. Cheers!


Previous | RHF Joke Archives | Next

Best of Jokes | Current Jokes | RHF Home | Search