From: Stuart Henderson Subject: Re: w3m -dump_extra segfault To: Theo Buehler Cc: ports@openbsd.org, jon@fineman.me Date: Mon, 16 Sep 2024 10:43:03 +0100 On 2024/09/15 22:15, Theo Buehler wrote: > 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. I use w3m regularly, though mostly with files from disk rather than over http (it's my default viewer for text/html in mutt) and I don't recall using it with -dump_source/-dump_extra. I can confirm the problem with -dump_source (unless using -o auto_uncompress=true) and -dump_extra (with/without auto_uncompress) and that the revert patch fixes it. If the patch breaks other sites, at least it should be no worse than before. > 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). OK. > 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); >