build: bison compat: colour mess

Steffen Nurpmeso <[email protected]> Fri, 26 Apr 2024 21:54:26 +0200
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <20240426195426.tY4qjp12@steffen%sdaoden.eu>
Hello.

I come over via https://github.com/onetrueawk/awk/issues/228.
For years the nawk build causes terminal mess in the unshare(1)d
fakeroot(1) package build environment of the Linux distro i use
(CRUX; sh(1) based).  It looks like that:

  ...
  bison -d  awkgram.y
  awkgram.yawkgram.y: : warning:warning:3399;49m;49m  62 shift/reduce confl=
icts62 shift/reduce conflicts [ [
  7 reduce/reduce conflicts] [8;id=3D5]984;dicd7=3D750909046d1c67f7101050b6=
3196dfb1d1050b03090d0b0d10;0h0t0t0p0s0:1/;/hwtwtwp.sg:n/u/.wowrwg./gsnouf.t=
owragr/es/obfitswoanr/em/abniusaoln//hmtamnlu_a
  nlo/dhet/mDli_angondoes/tDiicasg.nhotsmtli#cWsc.ohntfmlli#cWtcso-nrfrl\c-=
Wconflicts-rrt[-3r9r;\9-Wconflicts-rrm389;;;4\m]
  awkgram.y: note:note: erun with option '-Wcounterexamples' to generate co=
nflict counterexamples[f111d207]580;0i0d00=3D050919;h4ttdpcs7:/7/0w0w0w.gnu=
.org/softw6a1r6ef/1b1i1sdo2n/ma0nu7a4l2/0h0t0
  39;49m rerun with option '-Wcounterexamples' to generate conflict counter=
examplescts-rri[o3n9/;m4a9nmu]l8/;h;t\l_no]de
  cc -g -Wall -pedantic -Wcast-qual   -O2   -c -o [.]
  ...

=46rom warning:warning it is purple, from note:note turquoise, then
purple, then .. etc.  The terminal is not properly restored,
i need to do "tput reset" to see the cursor again.  The screen is
flushed, ie cleared initially, too.
Note that if i do ls(1) --color=3Dyes in the same environment,
colors are ok.  (However, vim(1) only starts up as rvim.)

It is like that for years, i can reproduce it a hundred percent
(also see the nawk issue).  Todd Miller said in the issue that
bison uses some GNU specific library for these terminal sequences,
but i have zero idea from neither.  From a fast glance into the
very large bison codebase it seems quite logical (if it really is
that isatty(STDERR) thing).
I only wanted to report this issue, finally.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)