Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
w3m -dump_extra segfault
To:
ports@openbsd.org, jon@fineman.me
Date:
Sun, 15 Sep 2024 22:15:11 +0200

Download raw body.

Thread
See https://marc.info/?l=openbsd-misc&m=172641752723332&w=2 for
background. In short: 'w3m -dump_extra https://lobste.rs' crashes and
that breaks this emacs plugin.

The below reverts the code change from

https://git.sr.ht/~rkta/w3m/commit/e933cf831f32fd4cf763c64aa60e51dbf025ec94

and makes lobste.rs, duckduckgo and google work with M-x w3m-browse-url
in emacs. The problem is that the hack results in loadSomething() being
called with a NULL loadproc, which it doesn't know how to handle. No
idea how this was supposed to work...

Thankfully the FreeBSD w3m maintainer posted a very detailed analysis to
https://todo.sr.ht/~rkta/w3m/59

While the below diff makes the reported sites work, it may well break
other sites. So I'm unsure what the best course of action is. I can
commit this workaround, but maybe someone who is interested in using
w3m (from within emacs or not) could keep an eye on the issue and port
the proper fix (if upstream finds one).

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/w3m/Makefile,v
diff -u -p -r1.105 Makefile
--- Makefile	18 Aug 2024 11:11:45 -0000	1.105
+++ Makefile	15 Sep 2024 19:58:31 -0000
@@ -4,6 +4,7 @@ C=		5ae3ef7cb20cd2209629ac0508c05206fd0d
 DIST_TUPLE=	srht rkta w3m $C .
 WRKDIST=	${WRKDIR}/w3m-$C
 DISTNAME=	w3m-0.5.3pl20240810
+REVISION=	0
 
 CATEGORIES=	www
 
Index: patches/patch-file_c
===================================================================
RCS file: patches/patch-file_c
diff -N patches/patch-file_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-file_c	15 Sep 2024 19:59:09 -0000
@@ -0,0 +1,15 @@
+Revert e933cf831f32fd4cf763c64aa60e51dbf025ec94.
+See also https://todo.sr.ht/~rkta/w3m/59
+
+Index: file.c
+--- file.c.orig
++++ file.c
+@@ -2263,8 +2263,6 @@ loadGeneralFile(char *path, ParsedURL *volatile curren
+     }
+     else if (w3m_dump & DUMP_FRAME)
+ 	return NULL;
+-    else
+-	proc = NULL;
+ 
+     if (t_buf == NULL)
+ 	t_buf = newBuffer(INIT_BUFFER_WIDTH);