Date: Wed, 30 Nov 2022 11:04:53 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268076] dc(1): crash on window size change Message-ID: <bug-268076-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268076 Bug ID: 268076 Summary: dc(1): crash on window size change Product: Base System Version: CURRENT Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: saper@saper.info > dc --version dc 5.3.3 Copyright (c) 2018-2022 Gavin D. Howard and contributors Report bugs at: https://git.yzena.com/gavin/bc This is free software with ABSOLUTELY NO WARRANTY. > bc --version bc 5.3.3 Copyright (c) 2018-2022 Gavin D. Howard and contributors Report bugs at: https://git.yzena.com/gavin/bc This is free software with ABSOLUTELY NO WARRANTY I am running -CURRENT as of 75217c2b470 on my laptop and noticed that dc du= mps core on SIGWINCH (I am using x11-wm/dwm as a window manager so this happens often): Window size change occurs after 4 is printed: radziecki> dc 2 2 + p 4 Memory fault(coredump) Core was generated by `dc'. Program terminated with signal SIGSEGV, Segmentation fault. Address not mapped to object. #0 terminal_get_size (el=3Del@entry=3D0x0, lins=3Dlins@entry=3D0x3cd5864c5= b1c, cols=3Dcols@entry=3D0x3cd5864c5b18) at /usr/src/contrib/libedit/terminal.c:931 --Type <RET> for more, q to quit, c to continue without paging-- 931 *cols =3D Val(T_co); (gdb) bt #0 terminal_get_size (el=3Del@entry=3D0x0, lins=3Dlins@entry=3D0x3cd5864c5= b1c, cols=3Dcols@entry=3D0x3cd5864c5b18) at /usr/src/contrib/libedit/terminal.c:931 #1 0x00003cd587453ff8 in el_resize (el=3D0x0) at /usr/src/contrib/libedit/el.c:614 #2 <signal handler called> #3 _read () at _read.S:4 #4 0x00003ccd6561e351 in bc_read_chars (vec=3D0x3ccd65626848 <vm+896>, prompt=3D0x3ccd655f297c ">>> ") at /usr/src/contrib/bc/src/read.c:165 #5 bc_read_line (vec=3D0x3ccd65626848 <vm+896>, prompt=3D0x3ccd655f297c ">= >> ") at /usr/src/contrib/bc/src/read.c:238 #6 0x00003ccd65622c0b in bc_vm_readLine (clear=3D<optimized out>) at /usr/src/contrib/bc/src/vm.c:1053 #7 bc_vm_stdin () at /usr/src/contrib/bc/src/vm.c:1099 #8 0x00003ccd65621e9d in bc_vm_exec () at /usr/src/contrib/bc/src/vm.c:1420 #9 bc_vm_boot (argc=3D1, argv=3D0x3cd5864c62d0) at /usr/src/contrib/bc/src/vm.c:1570 #10 0x00003ccd65606334 in main (argc=3D1, argv=3D0x3cd5864c62d0) at /usr/src/contrib/bc/src/bc.c:60 (gdb) frame 4 #4 0x00003ccd6561e351 in bc_read_chars (vec=3D0x3ccd65626848 <vm+896>, prompt=3D0x3ccd655f297c ">>> ") at /usr/src/contrib/bc/src/read.c:165 165 r =3D read(STDIN_FILENO, vm.buf + vm.buf_len, (gdb) p vm.history $1 =3D {el =3D 0x0, hist =3D 0x0, badTerm =3D false} vm.history.el seems to be zero at this point. bc, however, behaves different, and frankly I must say I don't like its err= or handling that obscures things: radziecki> gdb /usr/bin/bc GNU gdb (GDB) 12.1 [GDB v12.1 for FreeBSD] Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm= l> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd14.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/bin/bc... Reading symbols from /usr/lib/debug//usr/bin/bc.debug... (gdb) run Starting program: /usr/bin/bc=20 warning: Could not load shared library symbols for [vdso]. Do you need "set solib-search-path" or "set sysroot"? 2+2 4 Fatal error: I/O error Function: (main) [Inferior 1 (process 26153) exited with code 04] After a bit of digging I figured out I had to do this: (gdb) b bc_vm_handleError Breakpoint 1 at 0x1050c87: file /usr/src/contrib/bc/src/vm.c, line 311. (gdb) run Starting program: /usr/bin/bc=20 warning: Could not load shared library symbols for [vdso]. Do you need "set solib-search-path" or "set sysroot"? 2+2 4 Breakpoint 1, bc_vm_handleError (e=3DBC_ERR_FATAL_IO_ERR, line=3D0) at /usr/src/contrib/bc/src/vm.c:311 311 uchar id =3D bc_err_ids[e]; (gdb) bt #0 bc_vm_handleError (e=3DBC_ERR_FATAL_IO_ERR, line=3D0) at /usr/src/contrib/bc/src/vm.c:311 #1 0x0000000001036482 in bc_history_line (h=3D<optimized out>, vec=3D0x105= 7848 <vm+896>, prompt=3D0x102397c ">>> ") at /usr/src/contrib/bc/src/history.c:268 #2 0x000000000104f194 in bc_read_line (vec=3D0x1057848 <vm+896>, prompt=3D<optimized out>) at /usr/src/contrib/bc/src/read.c:236 #3 0x0000000001053c0b in bc_vm_readLine (clear=3D<optimized out>) at /usr/src/contrib/bc/src/vm.c:1053 #4 bc_vm_stdin () at /usr/src/contrib/bc/src/vm.c:1099 #5 0x0000000001052e9d in bc_vm_exec () at /usr/src/contrib/bc/src/vm.c:1420 #6 bc_vm_boot (argc=3D1, argv=3D0x7fffffffe6d0) at /usr/src/contrib/bc/src/vm.c:1570 #7 0x0000000001037334 in main (argc=3D1, argv=3D0x7fffffffe6d0) at /usr/src/contrib/bc/src/bc.c:60 (gdb) up #1 0x0000000001036482 in bc_history_line (h=3D<optimized out>, vec=3D0x105= 7848 <vm+896>, prompt=3D0x102397c ">>> ") at /usr/src/contrib/bc/src/history.c:268 268 bc_err(BC_ERR_FATAL_IO_ERR); (gdb) list - 263 { 264 // If this is true, there was an error. Otherwise, = it's just EOF. 265 if (len =3D=3D -1) 266 { 267 if (errno =3D=3D ENOMEM) bc_err(BC_ERR_FATAL_ALLOC_ERR); 268 bc_err(BC_ERR_FATAL_IO_ERR); 269 } 270 else 271 { 272 bc_file_printf(&vm.fout, "\n"); (gdb) p errno $1 =3D 4 which is EINTR As noted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264010 edit= line integration is tough, but attempting to hide all the errors is not making things better :( Can't reproduce this with 5.2.2 versions from 13.1-RELEASE --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268076-227>