Jun. 15th, 2013

jeshyr: Dreamwidth sheep in a wheelchair (DW Accessibility - Wheelchair Sheep)
[personal profile] jeshyr
OK my initial problem was that I looked at bug 4980 and thought "This'll be easy!", thus clearly jinxing all efforts to patch the thing...

ETA: The glorious Sophira just pointed out that I had mysteriously got 3 backgrounded copies of the xpost worker which had stuck around despite being run as foreground copies. This would quite possibly produce exactly the crazy behaviour described below, although I have no spoons to test until tomorrow... stay tuned.

ETA2: It's working now! Woot! Thank you Soph.


So I started out by setting up cross posts to DW, although I later switched the cross posts to LJ because it's easier to visibly distinguish "livejournal.com" and "rb.hack.dreamwidth.net" when I am tired. So my crossposts are going to LJ.

First searched for the relevant text - it shows up in en.dat with the key of "xpost.redirect.comment" so I grepped for that. It's only in two files:
1. cgi-bin/DW/XPostAccounts.pm has the code for the account settings page.
2. cgi-bin/DW/External/XPostProtocol.pm has the code for the crossposter.

Added a new key xpost.redirect.comment2 which has the value of:

xpost.redirect.comment2=<span style="font-size: smaller;">This entry was originally posted at <a href = "[[postlink]]">[[postlink]]</a>. Please comment there using <a href="[[siteroot]]/openid/">OpenID</a>.</span>


So now I need to alter the building of the footer string to point to the new key, and also alter the calls to LJ::Lang::ml to pass in a value for [[siteroot]]. Here is my diff at this point from 'git diff':


This works fine on the account settings othersites page, http://www.rb.hack.dreamwidth.net/manage/settings/?cat=othersites on my 'hack. It correctly displays the OpenID link in both preview locations and all is good.

Crossposting itself however is another story... the footer keeps showing up like this:

<span style="font-size: smaller;">This entry was originally posted at <a href="http://penguin.rb.hack.dreamwidth.net/9633.html">http://penguin.rb.hack.dreamwidth.net/9633.html</a>. Please comment there using <a href="/openid/">OpenID</a>.</span>


So it's got the new value from en.dat but the [[siteroot]] is being filled in with nothing at all. The two relevant lines, grabbed from the diff, are thus:


my $footer_text_redirect_key = $local_nocomments ? 'xpost.redirect' : 'xpost.redirect.comment2';

return "\n\n" . LJ::Lang::ml( $footer_text_redirect_key, { postlink => $entry->url, siteroot => $LJ::SITEROOT } );

(lines 108-110 from XPostProtocol.pm)

At this point things started getting weird.

This is my basic workflow:
edit files
upload files
update database (code from http://wiki.dwscoalition.org/wiki/index.php/Dev_Maintenance#dwdb_-_Updating_the_database)
start apache
make a post on my 'hack
mostly at this point the post shows up on LJ without me ever starting any workers, but a few times I had to manually execute ~/dw/bin/workers/xpost - suspect this is when LJ times out on the first attempt?? so check post, start worker if necessary, check post again.
kill apache
kill workers
rinse,repeat

(I realise, writing this, that the database updating is probably utterly superfluous at this point, but anyway.)

First I thought maybe $LJ::SITEROOT was magically undefined here, so I tried concatenating it with visible things just to make sure it existed. It does, unsurprisingly. One of the things I concatenated it with was a hyphen before and aft so line 110 had "-$LJ::SITEROOT-".

Sometimes it worked and I could see the output:

<span style="font-size: smaller;">This entry was originally posted at <a href="http://penguin.rb.hack.dreamwidth.net/10431.html">http://penguin.rb.hack.dreamwidth.net/10431.html</a>. Please comment there using <a href="-http://www.rb.hack.dreamwidth.net-/openid/">OpenID</a>.</span>


but other times the very same change would give me the original with just /openid/ for the URL. It was handy to put different characters there because I could tell for sure that it was the right code and the crossposting was using the most recent version of that line, except that it seems to be almost random.

One time I set up apache and the xpost worker and made two posts in a row and the first one showed up with hyphens and the URL and the second showed up blank - with NO code change at ALL in between.

Now somehow it's stuck with the hyphens, although the code for line 110 has spent an hour back with just the URL in that spot.

I tried declaring a 'my $sroot' variable at line 109 and putting what I wanted in there, then pointing line 110 to that but it didn't make any difference.

I tried moving the en.dat key to deadphrases and reloading with texttool and then putting it back and re-reloading.

I tried with and without xpost workers running.

I checked with vim on the hack directly that the code really is there. I checked with 'git diff' that the changes really have been made.

I tried logging into and out of the ssh session, closing my browser and my local copy of vim and the FTP client, although I have no idea why that'd help.

There is nothing relevant in the apache error logs.

I contemplated sacrificing my cat but he didn't want to cooperate.

I'm up past crosspost attempt 50 and I can't see any pattern to what's happening. It appears that which version of the footer shows up in my crossposts is pretty much non-deterministic between any version I tried in the past and just an empty string for the URL.

Is it possible I hosed my database thoroughly when I was working on the testing bug and running all the broken test suite over and over? If so, how would I tell? how would I fix it?

What else could it be?

The diff in the textarea way up above is still my current one and I still think it should work...

HALP!

r

Profile

dw_dev_training: The stylised 'd', with the word 'dev' above, and the word 'training' at the side, representing the dw_dev_training comm. (Default)
Dreamwidth Development Training

September 2022

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 12th, 2025 07:41 pm
Powered by Dreamwidth Studios