Sunday, September 15, 2024

Re: w3m -dump_extra segfault

Theo Buehler <tb@theobuehler.org> writes:

> 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);


Thanks for the research Theo.

I deleted the ports w3m package added the patch and did a make install
and verified the patched version of w3m was installed.

However it still fails for me. One test session did get a little more
output than before. I also tried non-image.

Does it matter which emacs flavor of w3m you choose? I have mine set
to:
(setq mm-text-html-renderer 'gnus-w3m)


pkg_info -Q w3m
debug-w3m-0.5.3pl20240810
debug-w3m-0.5.3pl20240810-image
w3m-0.5.3pl20240810
w3m-0.5.3pl20240810-image (installed)
w3mir-1.0.10p0


w3m --version
w3m version w3m/0.5.3+git20230718, options lang=en,m17n,image,color,ansi-color,mouse,menu,cookie,ssl,ssl-verify,external-uri-loader,w3mmailer,nntp,gopher,ipv6,alarm,mark


Location: https://lobste.rs/
Cannot retrieve URL: https://lobste.rs

/usr/local/bin/w3m exits with the code 11

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Header information

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 15 Sep 2024 23:07:06 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: close
x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
link: ; rel=preload; as=style; nopush
vary: Accept
etag: W/"234ea776c1acda6bbc277c453ffefb7d"
cache-control: max-age=0, private, must-revalidate
feature-policy: accelerometer 'none'; autoplay 'none'; ambient-light-sensor 'none'; camera 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; idle_detection 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; screen-wake-lock 'none'; serial 'none'; sync-xhr 'none'; usb 'none'; web-share 'none'
set-cookie: lobster_trap=xT9flv0p8ggR%2Fvc00EZxwTqq9LszcpVVIl%2BPMqPOZbep59qHQvvCb2mbt%2FUXpxOAbpz1YwXeHZn5TzNU2%2BwyMEz4G7EQqS%2BHS4vtdB6g%2FymuLR%2F9e3iXDbyrxwB5MG%2Fzi9NyMJeYCXuw0gp0JKmr7lL%2FnjAHHN%2F9kx%2F1YEqUg2DWoa0dnWnTiIZmUPgkdTX3%2Bb36J9z7Ljs5y1yXAuNwXo3FvtdzZKmRjcIH75v0ZrWGs8BYdeOKFCLaOc4kZ3cozy%2FXJjQWMGxg77ZomCB6XnJZCgu6WppBdMnZ32S5nzmWOqhR0D21zaHV--Lhw5gpPflF6bcfQU--Wnwl9lwakIkks0AdnIdoiA%3D%3D; path=/; expires=Tue, 15 Oct 2024 23:07:06 GMT; secure; httponly; SameSite=Lax
x-request-id: 8b15a5ea-0e4e-4738-8780-b414509f62d4
strict-transport-security: max-age=63072000; includeSubDomains; preload
Content-Security-Policy: frame-ancestors 'none'
X-Robots-Tag: noai, noimageai

No comments:

Post a Comment