Page 1 of 1

Wednesday night maintenance

Posted: Mon Jul 28, 2014 2:03 am
by Zherog
Nockermensch was kind enough to take a look at the code that writes posts to the database, and he believes he was able to correct the ever-annoying bug that causes missing quote tags to fuck up the format of the entire page. The code looks solid to me, but unfortunately I'm going to have to experiment with it in "production" to verify it works. So...

Wednesday around 10pm EDT I'm going to install the new code, and then run a test or two. If things go to hell in a handbasket quickly I'll undo the changes and revert to the prior version as quickly as possible. If things seem to be OK after I install the new code, I intend to leave it in place, and I'll keep checking in every few minutes over the next couple hours after that to make sure nobody else ran into weird trouble.

If somebody encounters any sort of error while making or editing a post after 10pm Wednesday, please include as much detail as possible here. Also, please do not attempt to verify the bug is fixed right away - if something is wrong, I'll find it quick enough after installing, and having everybody submit a "bad" post just to verify it's fixed won't be good if there's something else wrong.

Thank in advance for your patience on Wednesday evening.

Posted: Thu Jul 31, 2014 2:07 am
by Zherog
test post #1

Posted: Thu Jul 31, 2014 2:08 am
by Zherog
And this post is being submitted with a broken close-quote tag on purpose
[/quote

And we'll see what happens...

Posted: Thu Jul 31, 2014 2:09 am
by Zherog
And... that looks about right.

So, the code is pretty simple overall. If there are more open tags than close tags, it simply adds close tags until there are the same number of each. It does this right before submitting the post to the database. I'll do a few more tests, and I'll be around for about an hour or so. If anybody runs into an issue while posting, please let me know here.

Posted: Thu Jul 31, 2014 2:25 am
by Sam
Quick test.

Posted: Thu Jul 31, 2014 2:32 am
by Zherog
So... looks like the code only fixes when there are more open tags than close tags. So, improvement but not perfect. I should be able to tweak the fix to cover both scenarios, but not tonight - my mind is too much goo to concentrate tonight.

Posted: Thu Jul 31, 2014 2:06 pm
by fbmf
We appreciate it, Z.

[/The Great Fence Builder Speaks]

Posted: Thu Jul 31, 2014 2:09 pm
by Zherog
Props to nockermensch too. He took the initiative to fix the code.

Posted: Thu Jul 31, 2014 4:24 pm
by Maj
Thank you, you guys! :maj: :maj:

Posted: Fri Aug 01, 2014 3:45 am
by Zherog
more testing

Posted: Fri Aug 01, 2014 3:45 am
by Zherog
and some more

Posted: Fri Aug 01, 2014 3:46 am
by Zherog
and one more

Posted: Fri Aug 01, 2014 3:47 am
by Zherog
OK, I believe the code will now correct the post regardless of whether the tag is missing at the beginning or the end.

As with yesterday, if anybody sees anything weird please post here. I'll be online for the next 30 minutes to an hour, and I'll make a point to refresh in the morning as well.

Posted: Fri Aug 01, 2014 4:11 am
by TiaC
Thanks Z!

Posted: Fri Aug 01, 2014 4:33 am
by ACOS
It appears that when quoting, shit goes haywire when you actually have the quoted person's name in the tag, e.g., <quote="ACOS">, as opposed to just <quote>
I hit "preview", and everything is fine; but when I submit, it gratuitously adds two more open quote tags at the beginning.

I played around a bit with variations I've seen on other boards, but nothing helped but to just make it a generic quote tag.

Posted: Fri Aug 01, 2014 5:10 am
by Username17
ACOS wrote:It appears that when quoting, shit goes haywire when you actually have the quoted person's name in the tag, e.g., <quote="ACOS">, as opposed to just <quote>
I hit "preview", and everything is fine; but when I submit, it gratuitously adds two more open quote tags at the beginning.

I played around a bit with variations I've seen on other boards, but nothing helped but to just make it a generic quote tag.
Yes this. It seems to interpret attributed quote tags as missing quote tags and then "fix them" for you by adding in additional open quote tags to the beginning of the post, which makes everything fucked.

-Username17

Posted: Fri Aug 01, 2014 5:20 am
by Username17
Even if you remove the "" in the attributed quotes, it's still fucked.
Even if you add your own attributed quotes in by hand, it's still fucked.
Attributed quotes are just fucked.

-Username17

Posted: Fri Aug 01, 2014 6:46 am
by nockermensch
What's causing this is the code looking for just [ quote] and not the much more common [ quote="whatever"]. I mailed Zherog a fix for that.

Posted: Fri Aug 01, 2014 11:00 am
by Zherog
I've removed the code that adds the open quotes; the fix from nocker didn't seem to resolve it, and I don't have the time or brainpower at the moment to debug and figure it out completely.

I'll play with it some more tonight. But in the meantime the code to add closing tags is still in place.

Posted: Fri Aug 01, 2014 11:00 am
by Zherog
testing

Posted: Fri Aug 01, 2014 12:22 pm
by DSMatticus
There are three ways to do a quote tag (e's dropped to avoid making actual tags):
[quot]Stuff[/quot]
[quot=XYZ]Stuff[/quot]
[quot="XYZ"]Stuff[/quot]

The first case is simple enough that I don't think it needs addressing.

In the second case, the first close bracket encountered terminates the quote open tag, and as such XYZ cannot contain a close bracket. Except I just lied to you, and it totally can, because you can put tags inside XYZ (like italics tags or URL tags) and those tags will consume close brackets first. Note it has to be an actual tag that gets recognized, not just gibberish in a pair of brackets.

In the third case, the first quotation mark immediately followed by a close bracket terminates the quote open tag, and as such XYZ can contain any number of close brackets and quotation marks (but not a quotation mark followed immediately by a close bracket). As far as I know, there's no exceptions this time, because the only tag which can end in that particular way is the quote open tag, and worrying about the fact that you can put a quote open tag in the middle of a quote open tag (you really can) is beyond the scope of this fix.

Handling one is simple. They're fixed strings. Match, count, compare, add whichever you need*.

Handling three is almost as simple. There is technically a single variable substring, but its contents are completely irrelevant. Match, count, compare, add whichever you need*.

Handling two requires matching tags so you can actually tell whether or not your quote open tag has its closing bracket or if they've all been consumed.

Yes, I just told you to unleash regex or an equivalently unsophisticated tool on an html derivative. We aren't trying to pair tags, only identify them; the former isn't regular, but the latter is.

*I lied to you again. While it is the case that I can't put tags inside those quote tags that will break the matching, there is at least one tag in which you can put a quote tag that modifies the quote tag's behavior: the code tag, which causes all tags contained therein to be printed as text instead of parsed. If someone puts mismatched quote tags inside a code tag, the code breaks. But this is an edge case that's going to come up a lot less than people fucking their tags (i.e. it will never come up). Also don't forget that the three different kinds of quote open tags all share quote close tags. There's the potential for some some silly double/triple-counting errors there.