→ An assertion is a bit like a roadworthy test: you can drive to the test, but if your car fails badly enough, you might not be allowed to drive it home, for your own and everyone else’s safety. So a failed assertion causes the program to terminate. If you’re about to process a login, for example, and you’re at a point in your code where a blank password ought already to have been rejected and reported as an error, you might use an assertion to check that your password buffer really isn’t empty.Īt the time an assertion is checked, it’s too late to correct the problem you’re worried about yet it’s unsafe to continue if there is a problem. ![]() The idea is to be unrelenting about your assumptions. In programmer-speak, this snippet of code is known as an assertion, and coders are encouraged to use this sort of this-absolutely-must-be-true test to make their code resilient. (Happily, the Terminal application, where you run the Apple debugger, is not affected by this bug.)ĭecompiling the misbehaving library at the problematic function tells us more: That’s why Problem Reporter crashes even before you type or click anything, because it prints out the offending text in its message window. Unfortunately, it’s not just typing in the offending text that crashes the application, but having it displayed in the first place. Since the text string fileCSSx denotes a local, file-based URL, it’s just the kind of text you’d expect Apple’s data detector code to locate and react to. The trouble happens in a system library called DataDetectorsCore, which lots of applications use to recognise and act upon special content in a text window, such as URLs, telephone numbers and so forth. Running TextEdit in a debugger quickly gives some insight into the problem: option, a system application called Problem Reporter pops up, containing a raft of debugging information you can send to Apple if you choose.īut before you can read what’s gone wrong, Problem Reporter crashes, too! (Problem Reporter is smart enough not to pop back up to offer to report the problem in Problem Reporter.) Shortly after you’ve typed the third slash, TextEdit will crash: Actually, that’s not true: you just have to capitalise one or more of the letters, and I’ll explain why in a moment. Some of the stories specify that you have to type File, exactly like that, with an upper-case F and a lower-case ile. Elsewhere I’ll write it as FILECSSx or fileCSSx just in case. ![]() I don’t want to crash your browser, reader or RSS software by mistake. → I’ve deliberately circumlocuted the offending text above, just in case you’re reading this on a Mac in an affected application. The most common version of the story tells you to open TextEdit (which you can think of as OS X’s NOTEPAD.EXE) and type in the text shown below, just as you see it there. You may have read about this bug already, as it’s understandably made geeky headlines amongst Mac techies. This is a matter of saying FILE colon slash slash something to any of a raft of applications on OS X. You’ve heard of saying “BOO!” to a goose.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |