Mobileread
Linux-only libxml2 bug that affects Sigil on newer systems
#1  DiapDealer 08-24-2016, 06:13 PM
Linux Sigil Users Only!

There's a bug in libxml2-2.9.3 and higher that affects how QtWebKit renders html entities. Which means Sigil is affected on systems which use those versions.

To quickly tell if your system is affected:

Type a visible html entity (like ©) into Sigil's Code View (epub2). If it appears twice in Sigil's Preview or Book View, then you have the buggy version of libxml2.

I've released an executable, makeself Linux-only "updater" that installs a patched version of libxml2 into an existing Sigil installation to work around the issue.

NOTE: At no time will your system version of libxml2 be altered/affected by this update.

Download the installer (make sure it's executable bit is set) and use:

sudo ./sigil_libxml2_update.run

to install.

You'll have the option to bail out if you get cold feet.

See the Github README for more options/explanations.

---------
EDIT:

The latest git version of Sigil now includes the ability to clone, patch, configure and install a working version of libxml2 alongside Sigil (does not affect the system version of libxml2). To enable it, just add the -DBUILD_PATCHED_LIBXML2=1 option to the initial cmake configuration command.

From the documentation:
Quote
-DBUILD_PATCHED_LIBXML2=(0|1) Some newer versions of libxml2 have a bug that causes QtWebKit to render html entities twice. Adding -DBUILD_PATCHED_LIBXML2=1 to the cmake command will clone the libxml2 git repo, checkout a specific commit, patch the source, build it and install it alongside Sigil (does not affect the system version of libxml2). Requires git, libtool, autoconf and automake packages to be installed (as well as a working internet connection). Cmake should notify of any missing programs needed. The default is to NOT build the patched version of libxml2 (-DBUILD_PATCHED_LIBXML2=0).
Reply 

#2  kovidgoyal 08-28-2016, 03:10 AM
FYI, as far as I know, libxml2 is an optional dependency of WebKit, you can compile WebKit without it. That will mean that WebKit wont have support for XSLT, but I doubt that is used anywhere Sigil cares about.
Reply 

#3  KevinH 08-28-2016, 10:41 AM
AFAIK, it is used by webkit to evaluate named entities which we allow in the source and also to process as you say xslt transformations which are used inside MathJax to handle some of the extended mathml.

So disabling it means a few specific mathml elements will not show properly in Preview.

See this bug report for mml3.js not working on builds of Qt without libxml2

https://github.com/pkra/MathJax-single-file/issues/3

KevinH
Reply 

#4  DiapDealer 08-28-2016, 11:33 AM
The bug is really going to affect those Linux users who:
a) Build Sigil themselves on a system with libxml2 2.9.3 or higher.
b) Install Sigil from a repo on a system with libxml2 2.9.3 or higher.

Those numbers are probably pretty small right now, but those going with method B) are only going to grow more numerous. Their only hope is that Ubuntu patches libxml2 (or that libxml2 gets fixed very quickly), or this workaround.

If I can ever get a Linux installer package together that I have a high degree of confidence in, I'll of course include a patched version of libxml2 in it. But I was really hoping the repo version would gain traction and make that step unnecessary.

Those using method A) will soon have an option to build/include a patched version of libxml2 while compiling Sigil themselves. I hope anyway ... a few more kinks to work out.
Reply 

#5  eschwartz 08-28-2016, 12:03 PM
For reference (all you members that see this thread and aren't sure what it is talking about), this was originally discovered in this Sigil bug: https://github.com/Sigil-Ebook/Sigil/issues/232

There is a link there to the upstream libxml2 bug.
Reply 

#6  kovidgoyal 08-28-2016, 12:37 PM
@KevinH: I'm fairly certain that when libxml2 is absent, webkit uses something else to evaluate named entities. Named entities are common enough that is that were not the case, there would be hundreds of bug reports against Qt WebKit on windows, since as far as I know, Qt WebKit has never linked against libxml2 on windows.
Reply 

#7  KevinH 08-28-2016, 01:00 PM
According to the bug report filed at libxml2 by Apple, it is used by webkit, but if you can build it without, then they must have an alternative way of handling it. Either way, the mml3.js MathJax extension needs xslt for some mathml element support.

And you are right none of those mathml elements work on Windows, and thus the bug report I filed with mathjax to eliminate the use of xslt.

KevinH
Reply 

#8  gbm 08-28-2016, 03:43 PM
Quote DiapDealer
Linux Sigil Users Only!

There's a bug in libxml2-2.9.3 and higher that affects how QtWebKit renders html entities. Which means Sigil is affected on systems which use those versions.

To quickly tell if your system is affected:

Type a visible html entity (like ©) into Sigil's Code View (epub2). If it appears twice in Sigil's Preview or Book View, then you have the buggy version of libxml2.

I've released an executable, makeself Linux-only "updater" that installs a patched version of libxml2 into an existing Sigil installation to work around the issue.

NOTE: At no time will your system version of libxml2 be altered/affected by this update.

Download the installer (make sure it's executable bit is set) and use:

sudo ./sigil_libxml2_update.run

to install.

You'll have the option to bail out if you get cold feet.

See the Github README for more options/explanations.
Worked perfect on my Mint 18 system once the human got his act together.

bernie
Reply 

#9  DiapDealer 08-28-2016, 03:51 PM
Quote gbm
Worked perfect on my Mint 18 system once the human got his act together.

bernie
Great! Thanks for the report.
Reply 

#10  DiapDealer 09-02-2016, 07:54 PM
I got excited to see a new patched version of libxml2-2.9.4 come down the pipe on Arch Linux (2.9.4+0+gbdec218-2 -> 2.9.4+4+g3169602-1), but alas ... it doesn't resolve this issue. It's just a couple of cherry-picked commits from the official libxml2 git repo made since 2.9.4's release.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register