From owner-freebsd-current@freebsd.org Sat Apr 3 18:36:33 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 476C85BB724 for ; Sat, 3 Apr 2021 18:36:33 +0000 (UTC) (envelope-from btv1==727e85f9dfb==tom@invisible-island.net) Received: from smtp-1a.his.com (smtp-1a.his.com [216.194.196.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCQcJ1r3Jz4mWh for ; Sat, 3 Apr 2021 18:36:31 +0000 (UTC) (envelope-from btv1==727e85f9dfb==tom@invisible-island.net) Received: from cuda201.his.com (cuda201.his.com [216.194.196.22]) by smtp-1a.his.com (Postfix) with ESMTPS id 11313BB for ; Sat, 3 Apr 2021 14:36:31 -0400 (EDT) X-ASG-Debug-ID: 1617474990-061c417acd1b9b80001-85yNCL Received: from smtp-nf-202.his.com (smtp-nf-202.his.com [216.194.196.20]) by cuda201.his.com with ESMTP id mld65DQ2qgFB3Am2; Sat, 03 Apr 2021 14:36:30 -0400 (EDT) X-Barracuda-Envelope-From: tom@invisible-island.net X-Barracuda-RBL-Trusted-Forwarder: 216.194.196.20 Received: from zproxy101.his.com (zproxy101.his.com [18.218.2.49]) by smtp-nf-202.his.com (Postfix) with ESMTPS id 53C4C600A0; Sat, 3 Apr 2021 14:36:30 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zproxy101.his.com (Postfix) with ESMTP id 1C980178EE0; Sat, 3 Apr 2021 14:36:30 -0400 (EDT) X-Barracuda-RBL-IP: 18.218.2.49 X-Barracuda-Effective-Source-IP: zproxy101.his.com[18.218.2.49] X-Barracuda-Apparent-Source-IP: 18.218.2.49 Received: from zproxy101.his.com ([127.0.0.1]) by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id CUjbaCGL8CoW; Sat, 3 Apr 2021 14:36:30 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zproxy101.his.com (Postfix) with ESMTP id 040FA179BAE; Sat, 3 Apr 2021 14:36:30 -0400 (EDT) X-Virus-Scanned: amavisd-new at zproxy101.his.com Received: from zproxy101.his.com ([127.0.0.1]) by localhost (zproxy101.his.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id F7kdyV6DTH1W; Sat, 3 Apr 2021 14:36:29 -0400 (EDT) Received: from prl-debianold-64.jexium-island.net (static-71-246-219-82.washdc.fios.verizon.net [71.246.219.82]) by zproxy101.his.com (Postfix) with ESMTPSA id DEBE0178EE0; Sat, 3 Apr 2021 14:36:29 -0400 (EDT) Received: from tom by prl-debianold-64.jexium-island.net with local (Exim 4.92) (envelope-from ) id 1lSl8H-00078s-Bb; Sat, 03 Apr 2021 14:36:29 -0400 Date: Sat, 3 Apr 2021 14:36:29 -0400 From: Thomas Dickey To: Juraj Lutter , Henric Jungheim , FreeBSD-current@freebsd.org Subject: Re: 13.0-RC3 bison causes tputs SIGSEGV Message-ID: <20210403183629.GA27381@prl-debianold-64.jexium-island.net> X-ASG-Orig-Subj: Re: 13.0-RC3 bison causes tputs SIGSEGV Reply-To: dickey@his.com References: <20210329233138.GA4334@prl-debianold-64.jexium-island.net> <33EE2402-4447-4168-AB5B-D98009CD03AA@FreeBSD.org> <20210331004803.GA1607@prl-debianold-64.jexium-island.net> <7E5FFF68-3FDC-42C4-A1C9-4B2F483FABC5@FreeBSD.org> <20210331224955.GA8387@prl-debianold-64.jexium-island.net> <20210331235409.GA8773@prl-debianold-64.jexium-island.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline In-Reply-To: <20210331235409.GA8773@prl-debianold-64.jexium-island.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Barracuda-Connect: smtp-nf-202.his.com[216.194.196.20] X-Barracuda-Start-Time: 1617474990 X-Barracuda-URL: https://spam.his.com:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at his.com X-Barracuda-Scan-Msg-Size: 4168 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=6.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.88990 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Rspamd-Queue-Id: 4FCQcJ1r3Jz4mWh X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of btv1==727e85f9dfb==tom@invisible-island.net designates 216.194.196.25 as permitted sender) smtp.mailfrom=btv1==727e85f9dfb==tom@invisible-island.net X-Spamd-Result: default: False [-5.20 / 15.00]; HAS_REPLYTO(0.00)[dickey@his.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:216.194.196.0/22]; REPLYTO_ADDR_EQ_FROM(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[dickey@his.com,btv1==727e85f9dfb==tom@invisible-island.net]; RCVD_IN_DNSWL_LOW(-0.10)[216.194.196.25:from]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[216.194.196.25:from]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_NEQ_ENVFROM(0.00)[dickey@his.com,btv1==727e85f9dfb==tom@invisible-island.net]; ASN(0.00)[asn:11604, ipnet:216.194.196.0/24, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[his.com]; SPAMHAUS_ZRD(0.00)[216.194.196.25:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_SEVEN(0.00)[10]; MAILMAN_DEST(0.00)[FreeBSD-current] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Apr 2021 18:36:33 -0000 --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 31, 2021 at 07:54:09PM -0400, Thomas Dickey wrote: > On Wed, Mar 31, 2021 at 06:49:55PM -0400, Thomas Dickey wrote: > > On Wed, Mar 31, 2021 at 09:40:49PM +0200, Juraj Lutter wrote: > > >=20 > > > > On 31 Mar 2021, at 15:53, Henric Jungheim wro= te: > > > >=20 > > > >>=20 > > > >> Knowing that would help me see whether the problem is faulty initi= alization > > > >> from libtextstyle (i.e., the SCREEN pointer is null, making the pa= th via > > > >> the static structure), or some ifdef-combination in ncurses that I= 've > > > >> neglected (i.e., a flaw in the pointer juggling). > > >=20 > > > I=E2=80=99ve observed that the application in question calls: > > >=20 > > > /* Create the output styled stream. */ > > > pk_ostream =3D > > > (color_mode =3D=3D color_html > > > ? html_styled_ostream_create (file_ostream_create (stdout), > > > style_file_name) > > > : styled_ostream_create (STDOUT_FILENO, "(stdout)", > > > TTYCTL_AUTO, style_file_name)); > > >=20 > > > Does it make any difference? > >=20 > > I don't know yet. I've been setting up a build for bison+libtextstyle > > so that I can study it firsthand (and use valgrind, etc., to look for > > problems). >=20 > ...valgrind on Debian/testing (iirc, valgrind doesn't work with BSDs). I did try valgrind from ports, but "valgrind" is old/blocked, and "valgrind-devel" did not run because it doesn't support "rfork". =20 > However, aside from the cgetent stuff, the terminfo part of my test-setup > matches what's in FreeBSD's build for ncurses. valgrind finds nothing > amiss with the tests that I've done to exercise the libtextstyle code. > (address-sanitizer may). >=20 > By the way, ktruss could show what files are opened in your configuration, > and a log from that would tell me if it's reading via the termcap interfa= ce. Henric Jungheim followed up with details that showed me it was using the termcap database. The core dump is due to my not making the tputs_sp function call delay_output_sp for the BSD padding special case (it's calling delay_output= ), with the result that the SCREEN pointer sp gets passed in as a null. That's a simple fix, which will be in today's update for ncurses. There're additional bugs however. The libtextstyle library is basically passing garbage down to tputs in this case. This line from the stack trace frame #4: 0x00000008009edcfb libncursesw.so.9`tputs(string=3D"4f0fdc740005b= ebaf92e5a2e00000000", affcnt=3D1, outc=3D(libtextstyle.so.0`out_char at ter= m-ostream.oo.c:1198)) at lib_tputs.c:444:12 is passing a string "4f0fdc740005bebaf92e5a2e00000000", which (because it happens to begin with a digit) runs into that special case. The string itself is garbage -- it's not a result from tparm (see attached ncurses trace), but appears to have been made up by the libtextstyle librar= y. In my own testing, these two tputs calls don't correspond to anything in the terminal description (same problem): tputs("\e]8;id=3D", 1, 0x0800838860) called tputs("933ed1a10005bf11f4fd265c00000000", 1, 0x0800838860) called called {delay_output(0x7fffffff9000,933) That comes from this chunk in libtextstyle: /* Output escape seqeuences to switch the hyperlink to NEW_HYPERLINK. */ static _GL_ASYNC_SAFE void out_hyperlink_change (term_ostream_t stream, hyperlink_t *new_hyperlink, bool async_safe) { int (*out_ch) (int) =3D (async_safe ? out_char_unchecked : out_char); assert (stream->supports_hyperlink); if (new_hyperlink !=3D NULL) { assert (new_hyperlink->real_id !=3D NULL); tputs ("\033]8;id=3D", 1, out_ch); tputs (new_hyperlink->real_id, 1, out_ch); tputs (";", 1, out_ch); tputs (new_hyperlink->ref, 1, out_ch); tputs ("\033\\", 1, out_ch); } else tputs ("\033]8;;\033\\", 1, out_ch); } If it happens to work for some people, that's purely accidental. --=20 Thomas E. Dickey https://invisible-island.net ftp://ftp.invisible-island.net --IJpNTDwzlM2Ie8A6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQTFIEjAwHSP7iJ9R6JwI1Pg9+SO2wUCYGi1pwAKCRBwI1Pg9+SO 21qPAJwJPOikC72XIKn32tNxjbWpPLWzCgCgm5Hx+t5V1JsbF1yTWfWu5nxAyZw= =6o5K -----END PGP SIGNATURE----- --IJpNTDwzlM2Ie8A6--