You didn’t leave enough space between ROSE and AND and AND and CROWN – Naked Security
Remember the jokes (OK, they were sold at school as a “joke” to add a touch of excitement to Eng. Lang. classes) about forming valid and supposedly meaningful sentences with a single word that many repeated times?
There is a very dubious one with the word BUFFALO seven times in a row that relies on the different meanings Buffalo-the-place-namerefers to the riverside city in New York State; buffalo-the-ox-animal, also known as bison; and buffalo-the-metaphorical-verb means “to bully or intimidate”.
There’s a slightly less whimsical sentence in which HAD is repeated a whopping 11 times, imagining a Latin grammar lesson in which students are asked to compare Old Roman Perfectoften translated as “had”, and the past continuouscommonly translated as “had had”.
But the best known, and perhaps the most believable, is five ANDs in a row, a sentence supported by the fact that AND is a conjunction, so you can insert it between almost any two English sentences with an appropriate comma and create a legal conjunction clause.
So the famous complaint of the innkeeper who has just painted his inn sign badly and disappointedly says to the sign writer: “You didn’t leave enough space between ROSE and AND and AND and CROWN.”
Well, for an amusing start to the weekend, Google Docs appears to have just fixed a crisis with five ANDs in a row in its online real-time grammar checker.
Apparently, until Google quickly fixed the problem this morning, typing five ANDs in a row was considered a sufficiently serious conjunct error that typing such a sequence into your browser…
…would immediately crash Google Docs.
Recursion: see recursion
To be a little more specific, the error seems to have only occurred if you had the grammar checker enabled.
If you never had it on, or if you had it on (we couldn’t resist trying a pluperfect there) but later turned it off, you’d be fine.
Also, the ROSE AND CROWN sentence above wouldn’t do either, because you had to commit solecism, AND use it five times in a row in a very separate sentence, each time with a leading capital letter, like this:
And. And. And. And. And.
The original reporter spotted a strange but inconclusive error message in the background stating:
TypeError: Cannot read properties of null (reading 'C'). (No, we don’t know what kind of ‘C’ this refers to.)
We suspect that some of the recursive grammatical parsing functions have hit an untested internal limit, e.g. B. unexpectedly running out of input data, not having enough memory left to continue their analysis, or hitting a dead end in a convoluted grammatical state machine.
Since the internet (especially the weekend-coming-soon internet) is like this, avid Google Docs users immediately went in search of other grammatical constructs that might also be throwing the error, and quickly found that other conjunctions, if used unexpectedly, in five consecutive solo movements, would do the trick.
The words ANYWAY, BUT, BUT, THEREFORE, WHO, and WHY were quickly added to the trigger list, but human guesswork wasn’t enough for a Ycombinator user who decided that such an obscure problem should receive more detailed and automated research.
JoshuaDavid, contributor to Hacker News, wrote that they “began going through the entire dictionary in batches of 500 words to see if each batch of 500 triggered the behavior, and then did a binary search[ed] within the stack to find the problem words. Got bored in the middle of D.”
In binary search, you split an ordered list in half and see if the answer you’re looking for is in the top or bottom part, like a tightly coordinated TV show game Higher! Lower! They then discard the half that it couldn’t be in and repeat the procedure recursively with the remaining half of the list, pruning the search space logarithmically rather than linearly. Eventually, you either hit the answer in the list, or you end up with just one item left that doesn’t match, so you know the answer isn’t there. You can search an ordered list of say 16 million items this way in just 24 tries, since you only have to halve 16 million 24 times before you end up with just a single item. This is because 224 = 16,777,216 and accordingly log216M = 24.
Luckily, JoshuaD reports that they soon got “bored” and decided to pick up where they left off and continue their dictionary bisection project at the letter E.
Interestingly, they found that the numeric adverbs FIRSTLY, SECONDLY, THIRDLY, and FOURTHLY all caused the document crash problem, but not the higher number adverbs, like FIFTHLY or FOURTEENTHLY, which admittedly isn’t a word you need to use very often.
What should I do?
Google hasn’t said what caused the bizarre bug, but was quick to say it was “working on a fix,” and reports suggest the fix is already in place.
We don’t use Google Docs ourselves and tend to turn off the grammar checker because we find that today’s “Wizards” seem happiest when everyone writes in the same, predictable way, which strikes us as boring…
…so we don’t know if you need to take any special action if you have real documents that were victims of this crash before it was patched.
Internet commentators suggested various workarounds while the bug was still in play, including opening corrupted documents on your mobile phone (where the problem didn’t show up) to edit the crashtastic text to safely reopen the file in your browser.
Other “fixes” consisted of disabling the grammar checker, creating at least one new document, and then opening the ones you previously couldn’t open without crashing the document again.
We assume that now that the bug in Google’s cloud code has been fixed, or at least suppressed, you can simply reopen crashed documents and pick up where you left off.
Oh, and if you hear what actually happened please let us know in the comments… we suspect the backstory will be an intriguing tale!