site  contact  subhomenews

HelpSurfer internal help viewer crashes

February 19, 2020 — BarryK

Easy has HelpSurfer, executable /usr/bin/surfer, which is a tiny HTML v4 viewer, for viewing local help pages.

Fine, except that it crashes under a certain circumstance. Instability of HelpSurfer has been an ongoing problem, but this latest one is probably the last straw.

The menu "Help -> Help Links", will bring up /usr/share/doc/easy/help.htm. If you then click on the "Welcome" link, HelpSurfer crashes. However, it can be brought up OK directly:

# surfer /usr/share/doc/easy/welcome.htm

The HTML in 'welcome.htm' is very simple, so it is mighty peculiar that HelpSurfer crashes when coming via the hyperlink. I did test taking bits out of welcome.htm and then the hyperlink worked, no crash. But there is no apparent logic to what is causing the crash.

HelpSurfer is currently at version 0.5, see blog post in 2017:

There was a lot of help from forum member SFR to improve HelpSurfer back in 2017, see this forum thread:

I liked the mods we did to it. Any "http://" or "https://" hyperlinks brought up the full web browser (SeaMonkey). Hyperlinks with "exec:" prefix launched local applications.

So, stuck. maybe should take another look at Netsurf. 

EDIT 2020-02-19:
I have implemented a workaround, that avoids the crash. HelpSurfer is now version 0.6, with a patch to run a hyperlink prefixed with "file://" in the default browser (SeaMonkey). Here is the patch to apply to HelpSurfer 0.5:

diff -Naur helpsurfer-0.5/src/ghtml-gtkhtml.c helpsurfer-0.6/src/ghtml-gtkhtml.c
--- helpsurfer-0.5/src/ghtml-gtkhtml.c 2017-08-07 18:39:56.000000000 +0800
+++ helpsurfer-0.6/src/ghtml-gtkhtml.c 2020-02-19 20:02:06.452973984 +0800
@@ -558,6 +558,8 @@
return g_strdup(url);
if(strncmp("https://", url, 8) == 0)
return g_strdup(url);
+ if(strncmp("file://", url, 7) == 0) /*BK v0.6*/
+ return g_strdup(url);
if(strncmp("mailto:", url, 7) == 0)
return g_strdup(url);
//BK highly non-standard!...
@@ -1073,7 +1075,7 @@
fprintf(stderr, "DEBUG: %s(\"%s\") base=\"%s\" => \"%s\"\n", __func__,
url, _ghtml_get_base(ghtml), link);
- if (g_regex_match_simple("^http://|^https://|^ftp://", link, 0, 0))
+ if (g_regex_match_simple("^http://|^https://|^ftp://|^file://", link, 0, 0)) /*BK v0.6 add file://*/
syscmd = g_strdup_printf("%s '%s' %s", "defaultbrowser", link, "&");

And here is the source: 

HelpSurfer has three dependencies, gnet, libSystem and libgtkhtml. I have recompiled the first two. These are my notes:

gnet 2.0.8
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --disable-network-tests --enable-debug=no
edited examples/Makefile and examples/xmlrpc/Makefile, appended:
LIBS = -lresolv -lnsl -lgobject-2.0 -lglib-2.0
# make
# new2dir make install

libSystem 0.1.6-patched1
src/Makefile, commented out this line:
# make
# new2dir make install DESTDIR=/

helpsurfer 0.6
# make
# new2dir make install

I have changed the hyperlinks, for example in help.htm:

<td valign="top"><b><a href="/usr/share/doc/easy/welcome.htm">${MSGg3}</a></b>
<td valign="top"><b><a href="file:///usr/share/doc/easy/welcome.htm">${MSGg3}</a></b>

...probably not ideal, would prefer to open welcome.htm in the local HTML viewer.  

Tags: easy