Failed to parse the xml log file

22 views
Skip to first unread message

Kostas Katsioulis

unread,
Apr 20, 2021, 1:57:50 PM4/20/21
to Subsurface Divelog
Hi!

I installed yesterday the latest Subsurface 5.0.1 version on a mac osx with Mojave.

After having installed I get the error message:

Failed to parse '/Users/kk/Library/Application Support/Subsurface/logbook.xml'

where all my dives are saved.

The full path exists, the file exists.

Do you have any idea what is this error?

Thank you!

Dirk Hohndel

unread,
Apr 20, 2021, 2:00:15 PM4/20/21
to subsurfac...@googlegroups.com
Well, without trying to sound glib... I think the app couldn't parse the XML file for some reason.
No idea why that would be the case.

I'm happy to take a look - if you don't mind sending that file to me off list (di...@hohndel.org)

/D

Linus Torvalds

unread,
Apr 20, 2021, 2:09:49 PM4/20/21
to Subsurface Divelog
On Tue, Apr 20, 2021 at 10:57 AM Kostas Katsioulis
<kostaska...@gmail.com> wrote:
>
> Failed to parse '/Users/kk/Library/Application Support/Subsurface/logbook.xml'

Sadly, our error reporting in this area isn't great, because xml
parsing is all done by a different library (libxml2), and it's just
xmlReadMemory() failing. It doesn't tell us where or anything like
that.

Send the XML file in private email to me
(torv...@linux-foundation.org) or Dirk, and unless it's something
like actual filesystem corruption (which *can* happen - backups are a
good thing) it's likely some silly "we screwed up quoting of special
characters".

Linus

Kostas Katsioulis

unread,
Apr 20, 2021, 2:17:22 PM4/20/21
to Subsurface Divelog
Thank you Linus for your email. I have already sent it to Dirk.

Kostas

PS: I am so excited to contact you! I am one of the first linux users in Greece

Dirk Hohndel

unread,
Apr 20, 2021, 4:08:03 PM4/20/21
to Subsurface Divelog

Your dive notes are in Greek and for one of the notes there was clearly an error saving them / encoding them.
And Subsurface then fails to parse them when you open the (HUGE!!!) dive log.

I will send you an edited version of the log back off list - that one had the dive notes for two dives removed. And now things seem to parse correctly.

It's really hard for me to guess what triggered it. The encoding of the Greek characters is inconsistent between the different notes sections - and I don't understand why.
But at least you can open the file again.

/D

--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/subsurface-divelog/271d7ff5-4ff0-4594-922c-e0d3e04a5e08n%40googlegroups.com.

Linus Torvalds

unread,
Apr 20, 2021, 5:26:15 PM4/20/21
to Subsurface Divelog, Dirk Hohndel, Kostas Katsioulis
On Tue, Apr 20, 2021 at 11:09 AM Linus Torvalds
<torv...@linuxfoundation.org> wrote:
>
> Sadly, our error reporting in this area isn't great, because xml
> parsing is all done by a different library (libxml2), and it's just
> xmlReadMemory() failing. It doesn't tell us where or anything like
> that.

Dirk forwarded the problematic file to me for checking, and it
actually seems to be an outright problem with libxml2.

Adding the XML_PARSE_HUGE flag to the xmlReadMemory() call seems to
fix it. Very odd broken defaults for libxml2.

It might possibly be a good idea to also add

XML_PARSE_COMPACT = 65536 : compact small text nodes; no
modification of the tree allowed afterwards (will possibly crash if
you try to modify the tree)

which should make the libxml2 parser use less memory, but I didn't
test that. Afaik, we never modify the xml tree - we only use libxml2
for parsing - so that should be good.

But I didn't do that part. I only added the XML_PARSE_HUGE flag, and
verified that that seems to fix the problem with that particular Greek
input.

I did a github pull request at

https://github.com/subsurface/subsurface/pull/3231

for this, but I really don't know libxml2 very well, so let's at least
wait for all the tests to finish.

Linus
Reply all
Reply to author
Forward
0 new messages