Fossil Forum

Wiki editor inop
Login

Wiki editor inop

Wiki editor inop

(1.1) By andygoth on 2020-08-20 17:48:33 edited from 1.0 [source]

At least on Firefox 78.1.0esr, the wiki editor is currently inoperative. Attempting to edit any wiki page, including one associated with a check-in, branch, or tag, results in this error being displayed by the browser:

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 67 of the JSON data

Examining the JSON reveals a trainwreck between JSON, JavaScript, and HTML. Here's what comes back for this test case:

{"error":"Wiki page could not be loaded: Service Desk Technician"},{"name": "shjs", "type": "normal", "version": "4001d628e4f7f9ec9279c6ba2fd586d6fa4ff919", "mimetype": "text/x-fossil-wiki", "parent": "75279c73ab791f4291f31a0f5652ee575fefbd99"},{"name": "Static link with musl libc", "type": "normal", "version": "70dacb71f3c68ced2d6c5c036827a10f07bd3008", "mimetype": "text/x-fossil-wiki", "parent": "cc6c11260587f15af448fcebf47d1d79f12e6cac"},{"name": "tag/cvs2fossil-complete", "type": "tag", "version": "44de512be683009f0fe5f0980a371b61509c726aef8b9c5ed92cf521db52bf84", "mimetype": "text/plain", "parent": null},{"name": "To Do List", "type": "normal", "version": "8cc29050a9ea831fd0f7c1d1dca805395d82b936f727dcaed17f532573a22e4c", "mimetype": "text/x-markdown", "parent": "1c651ef7275c13ef377b11371c7c6a808af73e02235f9e15806ceba357781d6a"},{"name": "Tutorial", "type": "normal", "version": "ef6f80a6432d6b9825112fad72a7ad4301a7a9c8", "mimetype": "text/x-fossil-wiki", "parent": "59e243b7e9b98bd6734db12c886be6c3d18359f5"},{"name": "UserPermissions", "type": "normal", "version": "69b978a104eafc788470095c11c09b590141a216", "mimetype": "text/x-fossil-wiki", "parent": "11a94cf6f96fdb6ce0eeb97242b1f03e4bfeda39"},{"name": "Windows XP", "type": "normal", "version": "0f0e0041f946d169af9045bf47b216617eea5f4b", "mimetype": "text/x-fossil-wiki", "parent": "7bf674d5d943236ba4ad34cf60f820e4a17a2df7"},{"name": "Wish List", "type": "normal", "version": "46b46e4e76c7a9021fefdab163aeeea0d23f7537", "mimetype": "text/x-fossil-wiki", "parent": null}];
fossil.onPageLoad(function(){
const P = fossil.page;
try{
P.loadPage("Apache On Windows XP");
}catch(e){fossil.error(e); console.error('Exception:',e);}
});
</script>
<div class="content"><span id="debugMsg"></span>
</div>
<div class="footer">

This page was generated in about

0.01s by

Fossil 2.13 [ae9a9db553] 2020-08-18 14:00:04

</div>

<script nonce="87919b061ace05b17f28cf92f744257399ef59567e7ae48b">

(function() {

var hbButton = document.getElementById("hbbtn");

if (!hbButton) return;

if (!document.addEventListener) {

hbButton.href = "/fossil/sitemap";

return;

}

var panel = document.getElementById("hbdrop");

if (!panel) return;

if (!panel.style) return;

var panelBorder = panel.style.border;

var panelInitialized = false;

var panelResetBorderTimerID = 0;

var animate = panel.style.transition !== null && (typeof(panel.style.transition) == "string");

var animMS = panel.getAttribute("data-anim-ms");

if (animMS) {

animMS = parseInt(animMS);

if (isNaN(animMS) || animMS == 0)

animate = false;

else if (animMS < 0)

animMS = 400;

}

else

animMS = 400;

var panelHeight;

function calculatePanelHeight() {

panel.style.maxHeight = '';

var es   = window.getComputedStyle(panel),

edis = es.display,

epos = es.position,

evis = es.visibility;

panel.style.visibility = 'hidden';

panel.style.position   = 'absolute';

panel.style.display    = 'block';

panelHeight = panel.offsetHeight + 'px';

panel.style.display    = edis;

panel.style.position   = epos;

panel.style.visibility = evis;

}

function showPanel() {

if (panelResetBorderTimerID) {

clearTimeout(panelResetBorderTimerID);

panelResetBorderTimerID = 0;

}

if (animate) {

if (!panelInitialized) {

panelInitialized = true;

calculatePanelHeight();

panel.style.transition = 'max-height ' + animMS +

'ms ease-in-out';

panel.style.overflowY  = 'hidden';

panel.style.maxHeight  = '0';

}

setTimeout(function() {

panel.style.maxHeight = panelHeight;

panel.style.border    = panelBorder;

}, 40);

}

panel.style.display = 'block';

document.addEventListener('keydown',panelKeydown,true);

document.addEventListener('click',panelClick,false);

}

var panelKeydown = function(event) {

var key = event.which || event.keyCode;

if (key == 27) {

event.stopPropagation();

panelToggle(true);

}

};

var panelClick = function(event) {

if (!panel.contains(event.target)) {

panelToggle(true);

}

};

function panelShowing() {

if (animate) {

return panel.style.maxHeight == panelHeight;

}

else {

return panel.style.display == 'block';

}

}

function hasChildren(element) {

var childElement = element.firstChild;

while (childElement) {

if (childElement.nodeType == 1)

return true;

childElement = childElement.nextSibling;

}

return false;

}

window.addEventListener('resize',function(event) {

panelInitialized = false;

},false);

hbButton.addEventListener('click',function(event) {

event.stopPropagation();

event.preventDefault();

panelToggle(false);

},false);

function panelToggle(suppressAnimation) {

if (panelShowing()) {

document.removeEventListener('keydown',panelKeydown,true);

document.removeEventListener('click',panelClick,false);

if (animate) {

if (suppressAnimation) {

var transition = panel.style.transition;

panel.style.transition = '';

panel.style.maxHeight = '0';

panel.style.border = 'none';

setTimeout(function() {

panel.style.transition = transition;

}, 40);

}

else {

panel.style.maxHeight = '0';

panelResetBorderTimerID = setTimeout(function() {

panel.style.border = 'none';

panelResetBorderTimerID = 0;

}, animMS);

}

}

else {

panel.style.display = 'none';

}

}

else {

if (!hasChildren(panel)) {

var xhr = new XMLHttpRequest();

xhr.onload = function() {

var doc = xhr.responseXML;

if (doc) {

var sm = doc.querySelector("ul#sitemap");

if (sm && xhr.status == 200) {

panel.innerHTML = sm.outerHTML;

showPanel();

}

}

}

xhr.open("GET", "/fossil/sitemap?popup");

xhr.responseType = "document";

xhr.send();

}

else {

showPanel();

}

}

}

})();



</script>

<script nonce="87919b061ace05b17f28cf92f744257399ef59567e7ae48b">
function debugMsg(msg){
var n = document.getElementById("debugMsg");
if(n){n.textContent=msg;}
}
</script>
</body>
</html>

(2) By Stephan Beal (stephan) on 2020-08-20 19:36:22 in reply to 1.1 [link] [source]

At least on Firefox 78.1.0esr,

Attempting to edit any wiki page, including one associated with a check-in, branch, or tag, results in this error being displayed by the browser:

Examining the JSON reveals a trainwreck between JSON, JavaScript, and HTML. Here's what comes back for this

i can reproduce this on the live site but not on my site, which is running a day-old version.

Here's what's happening, but why it's happening is unclear:

  • When wikiedit loads, it loads a list of all wiki pages.
  • Part of that is triggering an ajax-level error, which is clearing the output buffer so that it can write its JSON-format error.
  • The page generation continues, appending the tail of the page to the request.

Where this "Service Desk Technician" load error is coming from is a mystery, as fossil has no such wiki page. That mysterious failure is what is triggering the avalanche which comes next.

It apparently only affects the core repo and might only affect the real core repo: it does not reproduce on my clone of it. My initial guess is that page used to exist but was shunned.

(3) By andygoth on 2020-08-20 19:50:29 in reply to 2 [link] [source]

Try clicking that "test case" link in my original (edited) post. I can even reproduce this on my phone.

(4) By Stephan Beal (stephan) on 2020-08-20 19:55:26 in reply to 3 [link] [source]

Try clicking that "test case" link in my original (edited) post. I can even reproduce this on my phone.

It's reproducible 100% of the time, but only on fossil's main repo. It appears (though i cannot verify this) that a page was shunned but the db has not been rebuilt since then. The query which pulls the page list is seeing that page but then loading of it fails, which triggers what is supposed to be an ajax-level error response. The "list wiki pages" op is never supposed to be able to fail except for corrupt/missing manifests, so this failure mode is new. i almost have a fix for it ready, but i suspect that a rebuild on the main server would correct it as well.

(5) By Stephan Beal (stephan) on 2020-08-20 20:12:03 in reply to 3 [link] [source]

A fix for this weird case (a wiki page is in the page list but is not loadable) is now on trunk. Insofar as i can tell it doesn't affect any repos except the core one (clones are unaffected, as are the several others i tested), so it should disappear when Richard next updates the binary.

My suspicion is that the missing page was shunned but still has references in tables other than blob, in which case a rebuild would clear this up.

(6.2) By Richard Hipp (drh) on 2020-08-23 18:15:05 edited from 6.1 in reply to 5 [link] [source]

The binary has been updated. Multiple times. Yet, the problem persists. To reproduce the problem on any repo, run SQL like this:

   INSERT INTO tag(tagname) VALUES('wiki-Bogus Page');

Then try to launch the wiki editor.

Update: Seems to be cleared by check-in 5244a5484a103065.

(7.1) By Stephan Beal (stephan) on 2020-08-23 21:19:00 edited from 7.0 in reply to 6.2 [link] [source]

Yet, the problem persists. To reproduce the problem on any repo, run SQL like this:

INSERT INTO tag(tagname) VALUES('wiki-Bogus Page');

My suspicion is that this only happens on shunned pages when the repo has not been rebuilt since shunning.

Did 37409e7dbeddf00c not resolve that on the core repo? That implementation made extra effort to silently fail if it tried to load a page which did not exist, but the only repo i could reproduce it on was the core one (not a clone of it), so wasn't able to test it completely without knowing the trick shown above.

Edit: nevermind - with that trick i'm able to reproduce it locally with that version.

(8) By Richard Hipp (drh) on 2020-08-23 21:25:31 in reply to 7.1 [link] [source]

To be clear: I got wiki editing working again on core by running rebuild.

(9) By Stephan Beal (stephan) on 2020-08-23 21:32:25 in reply to 8 [link] [source]

I got wiki editing working again on core by running rebuild.

i was just able to reproduce it locally with the older, apparently incomplete, patch and resolve it with a rebuild, but with your SQL patch a rebuild is not needed as the broken name never lands in C-space.