You're looking at Less Wrong's discussion board. This includes all posts, including those that haven't been promoted to the front page yet. For more information, see About Less Wrong.

Morendil comments on That letter after B is not rendering on Less Wrong? - Less Wrong Discussion

7 Post author: lukeprog 16 August 2011 11:35PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (27)

You are viewing a single comment's thread.

Comment author: Morendil 17 August 2011 12:16:01AM *  12 points [-]

I suspect a regular expression gone wild. (ETA: This commit looks like a likely culprit, but I'm not sure what's going on that might cause that particular behavior.)

ETA2: Heh. Thought so.

bash$ python
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> control_chars = re.compile('[\x00-\x08\x0b\0xc\x0e-\x1f]')
>>> text="This is some HTML with c's in it."
>>> control_chars.sub('',text)
"This is some HTML with 's in it."

ETA3: um, unit tests. Use them. Do yourself a favor. Pushing a bug to production that takes under a minute to locate from static inspection of the code? Embarrassing.

ETA4: ...though, in fairness, I can see how someone test-driving this code could easily have written a test that didn't catch this particular mistake.

Comment author: matt 17 August 2011 01:29:54AM 19 points [-]

ETA3: um, unit tests. Use them. Do yourself a favor. …

We agree completely. We inherited this code from Reddit, and we've spent multiple days trying to strap a workable unit testing framework onto it. As is often the case when you write the code first, strapping unit testing on later is hard.

We've basically given up on unit tests in this code base, but we'd love to be shown to be idiots on this one. Please take this opportunity to show us up by writing some example unit tests around any of our recent commits.
We have strapped Selenium tests on.

Code contributions are very very welcome.

Comment author: khafra 17 August 2011 02:59:22AM *  4 points [-]

As long as you're fixing regressions, how 'bout the whole "comments no longer showing up in IE7" that Silasbarta made a post on a few weeks ago?

edit: Seems to be fixed, thanks!

Comment author: ArisKatsaris 17 August 2011 12:22:34AM 11 points [-]

The regular expression is wrong: It has the term "\0xc" in it, when it should have had the term "\x0c"

So, instead of excluding the control character corresponding to ascii "0c", it excluded the letters "x" and "c".

Comment author: Dr_Manhattan 17 August 2011 10:01:54AM 2 points [-]

This post is brought to you by letter