> On 3/25/20 4:18 PM, Daniel Colascione wrote:> > >> I haven't touched the face > code in display.c. I'd like to find a simpler> >> way to do it: the patch > seems to have a lot of overhead and adds more> >> complexity than I'd like at > a time when I'm trying to make the redisplay> >> code simpler. I don't know > of a better way to do that yet.> > > > The redisplay code needs to track the > intended attribute state of each> > character in the buffer. I'm not sure > what simpler approach might be> > viable. Fat characters? You'd still have to > support the old char*> > interface, and you'd still need something like > puts_face to "propertize"> > any strings we add to the buffer. A face system > preserves the existing> > format of the buffer at least, and the redisplay > update code is a logical> > extension of the current diffing logic.> > OK, > I've finished the initial integration of your patches, and I've done> some > initial minimal testing. The updated version is in the devel git> branch on > savannah; please take a look and see if it passes your tests.> > Chet It silently segfaults when pasting a line of text twice(or a long enough line once), seems to be length dependent, unsure.
Removing commit ea31c00845c858098d232bd014bf27b5a63a668b from only the file lib/readline/display.c works around the issue. To catch the segfault I've had to do "$ gdb bash" and then "run", then paste my string, twice. The string is(no quotes, no newlines): "/home/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash" (if you run "bash" within bash, without 'gdb', then you can see its exit code aka "$?" is 139 (aka 128 + SIGSEGV (aka 11, seen by `trap -l`)), then you have to run 'reset' or you can't see anything typed on the terminal after bash exited with 139). Please someone tell me how to disable bash's trapping of SIGSEGV so that the OS is allowed to generate a proper coredump(ctl), rather than have bash silently exit with exit code 139, for future reference.(I know I've stumbled upon this behavior at least once before, and this time what I was seeing was xfce4-terminal exiting on paste (whether via MMB or RMB->menu->Paste) and took a while to figure out it was 'bash') Here's gdb output: $ gdb ./bash GNU gdb (GDB) 10.0.50.20200302-git Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 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-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://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"... State of pagination is off. Reading symbols from ./bash... (gdb) run Starting program: /home/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash/bash TERM='xterm-256color' [Detaching after fork from child process 1114704] [Detaching after fork from child process 1114705] [Detaching after fork from child process 1114706] [Detaching after fork from child process 1114707] [Detaching after fork from child process 1114712] [Detaching after fork from child process 1114713] [Detaching after fork from child process 1114714] [Detaching after fork from child process 1114715] [Detaching after fork from child process 1114716] [Detaching after fork from child process 1114717] [Detaching after fork from child process 1114718] [Detaching after fork from child process 1114719] [Detaching after fork from child process 1114720] [Detaching after fork from child process 1114721] [Detaching after fork from child process 1114722] [Detaching after fork from child process 1114723] [Detaching after fork from child process 1114724] [Detaching after fork from child process 1114725] [Detaching after fork from child process 1114726] [Detaching after fork from child process 1114727] [Detaching after fork from child process 1114728] [Detaching after fork from child process 1114729] [Detaching after fork from child process 1114730] [Detaching after fork from child process 1114731] [Detaching after fork from child process 1114732] [Detaching after fork from child process 1114733] [Detaching after fork from child process 1114734] [Detaching after fork from child process 1114735] [Detaching after fork from child process 1114736] [Detaching after fork from child process 1114737] [Detaching after fork from child process 1114738] [Detaching after fork from child process 1114739] [Detaching after fork from child process 1114740] [Detaching after fork from child process 1114741] [Detaching after fork from child process 1114742] [Detaching after fork from child process 1114743] [Detaching after fork from child process 1114744] [Detaching after fork from child process 1114745] [Detaching after fork from child process 1114780] [Detaching after fork from child process 1114781] /usr/bin/blugon [Detaching after fork from child process 1114783] [Detaching after fork from child process 1114785] [Detaching after fork from child process 1114786] [Detaching after fork from child process 1114787] [Detaching after fork from child process 1114788] [Detaching after fork from child process 1114789] [Detaching after fork from child process 1114790] [Detaching after fork from child process 1114791] [Detaching after fork from child process 1114792] [Detaching after fork from child process 1114793] [Detaching after fork from child process 1114794] [Detaching after fork from child process 1114797] [Detaching after fork from child process 1114798] [Detaching after fork from child process 1114799] [Detaching after fork from child process 1114800] [Detaching after fork from child process 1114801] 17417.59 31787.84 [Detaching after fork from child process 1114802] [Detaching after fork from child process 1114803] [Detaching after fork from child process 1114806] [Detaching after fork from child process 1114807] [Detaching after fork from child process 1114808] [Detaching after fork from child process 1114809] ----------- user@Z575 2020/04/11 14:34:05 bash5.0.16 t:37 j:0 d:4 pp:1114630 p:1114698 ut17417 !75612 1 0 5.6.3-gf9fb85751506 #90 SMP PREEMPT Thu Apr 9 19:22:52 CEST 2020 /home/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash $ /home/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash Program received signal SIGSEGV, Segmentation fault. puts_face (str=str@entry=0x5555557e48dc "me/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash", face=face@entry=0x0, n=n@entry=73) at display.c:1585 1585 putc_face (str[i], face[i], &cur_face); (gdb) bt2 executing: 'frame apply all -q frame' #0 puts_face (str=str@entry=0x5555557e48dc "me/user/build/1packages/4used/bash-devel-git/makepkg_pacman/bash/src/bash", face=face@entry=0x0, n=n@entry=73) at display.c:1585 1585 putc_face (str[i], face[i], &cur_face); #1 0x000055555562c9cc in update_line (old=<optimized out>, old_face=<optimized out>, new=<optimized out>, new_face=0x5555556dabbb '1' <repeats 74 times>, current_line=current_line@entry=1, omax=0, nmax=74, inv_botlin=1) at display.c:2153 2153 puts_face (nfd, nfdf, temp); #2 0x000055555562d237 in rl_redisplay () at display.c:1256 1256 update_line (VIS_LINE(linenum), VIS_LINE_FACE(linenum), #3 0x0000555555616064 in _rl_internal_char_cleanup () at readline.c:519 519 (*rl_redisplay_function) (); #4 0x0000555555616a37 in readline_internal_char () at readline.c:648 648 _rl_internal_char_cleanup (); #5 0x000055555561728d in readline_internal_charloop () at readline.c:666 666 eof = readline_internal_char (); #6 readline_internal () at readline.c:678 678 _rl_eof_found = readline_internal_charloop (); #7 readline (prompt=<optimized out>) at readline.c:377 377 value = readline_internal (); #8 0x00005555555861a5 in yy_readline_get () at ./parse.y:1488 1488 current_readline_line = readline (current_readline_prompt ? #9 0x00005555555889c8 in yy_getc () at ./parse.y:1422 1422 return (*(bash_input.getter)) (); #10 shell_getc (remove_quoted_newline=1) at ./parse.y:2357 2357 c = yy_getc (); #11 shell_getc (remove_quoted_newline=1) at ./parse.y:2276 2276 shell_getc (remove_quoted_newline) #12 0x000055555558beea in read_token (command=<optimized out>) at ./parse.y:3288 3288 while ((character = shell_getc (1)) != EOF && shellblank (character)) #13 read_token (command=0) at ./parse.y:3239 3239 read_token (command) #14 0x000055555558fb4c in yylex () at ./parse.y:2795 2795 current_token = read_token (READ); #15 yyparse () at y.tab.c:1941 1941 yychar = yylex (); #16 0x00005555555856fb in parse_command () at eval.c:329 329 r = yyparse (); #17 0x0000555555585895 in read_command () at eval.c:373 373 result = parse_command (); #18 0x0000555555585aaa in reader_loop () at eval.c:138 138 if (read_command () == 0) #19 0x0000555555584367 in main (argc=1, argv=0x7fffffffd918, env=0x7fffffffd928) at shell.c:808 808 reader_loop (); (gdb) The ./bash that I just ran was at: commit b3968b54c13def5803efc82d4c63d84446fe28bf (HEAD -> makepkg, origin/devel) Date: Fri Apr 10 18:26:33 2020 -0400 commit bash-20200408 snapshot bashbug info: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -pipe -march=native -Wno-trigraphs -fno-schedule-insns2 -fno-delete-null-pointer-checks -mtune=native -fomit-frame-pointer -O2 -D_FORTIFY_SOURCE=2 -DQT_FORCE_ASSERTS -ggdb -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' -DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS -fstack-protector-strong -fno-omit-frame-pointer -ftrack-macro-expansion=2 -ggdb -fvar-tracking-assignments -O2 -Wno-parentheses -Wno-format-security uname output: Linux Z575 5.6.3-gf9fb85751506 #90 SMP PREEMPT Thu Apr 9 19:22:52 CEST 2020 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 16 Release Status: maint