Source via Paul Wise
Today I came across an interesting bug mentioned on a blog. The problem was that printing for some people failed occasionally. Later someone noted that his Wife had been complaining that she couldn't print on Tuesdays!
In reading through the bug report people were initially claiming that it must be an OpenOffice bug since all other applications printed fine. Others noted that it comes and goes. One user found a solution: To remove and purge the system of OpenOffice and re-install (any easy task on Ubuntu). He reported on a Thursday that this fixed his printing problem.
Two weeks later he reported (on a Tuesday) that his solution did not work after-all. Nearly 4 months later the Wife of a Ubuntu hacker complained that OpenOffice would not print on Tuesdays. I can imagine the scenario:
Wife: Steve, the printer will not work on Tuesdays.
Steve: That's the printer's day off - Of course it will not print on Tuesdays.
Wife: No, I'm serious! I can not print from OpenOffice on Tuesdays.
Steve: (Unbelieving..) Ok... Show me.
Wife: I can't show you.
Steve: (Rolling eyes..) Why?
Wife: It's Wednesday!
Steve: (Nods. He says slowly...) Right.
The problem seemed to be tracked down to a program called 'file'. This *NIX utility uses patterns to detect file types. eg. if the file starts with '%!' followed by 'PS-Adobe-' then it is a PostScript file. It seems that OpenOffice writes the date to the postscript file. On Tuesdays it takes the form of %%CreationDate: (Tue MMM D hh:mm:...)
An error in the pattern for an Erlang JAM file meant that 'Tue' in the PostScript file was being recognised as an Erlang JAM file and so, presumably, it was not being sent to the printer.
The Erlang JAM file pattern is:
4 string Tue Jan 22 14:32:44 MET 1991 Erlang JAM file - version 4.2
It should have been
4 string Tue\ Jan\ 22\ 14:32:44\ MET\ 1991 Erlang JAM file - version 4.2
With the large number of files types that this program attempts to match (over 1600) it is not surprising that errors are made in the patterns, but also the order of matching could mean that false positives are common. In this case, an Erlang JAM file was matched before the PostScript match occurred.