bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGSEGV: rl_redisplay: Long Directory Name with EM Dash character in


From: Kieran Grant
Subject: Re: SIGSEGV: rl_redisplay: Long Directory Name with EM Dash character in Graphical Terminal
Date: Sat, 3 Feb 2018 11:57:45 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 03/02/18 00:25, Chet Ramey wrote:
> I can't reproduce it on Mac OS X or Red Hat, even when using the Debian
> prompt. What is your $PS1? (The value of `prompt' in the call to readline()
> in the trace looks kind of sketchy.)
> 

PS1=\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

OK, below is the email I was going to reply with it, during testing further 
screen widths it hit my like a ton of bricks.
In short, I brainfarted in my previous email and omitted my name@host *** BUT 
THAT WAS IMPORTANT ***

Because the TOTAL string of prompt to cause error at minimum (for width 80) is:
kieran@kieran-desktop:/tmp/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/$
Is 160 characters... double screen width!

If there is EN/EM Dash in prompt that is double screen width (or more) it 
crashes!

I'll attach proof of concept, resize width to 40, total prompt must be at least 
80 characters

----- Below is other info, at the bottom you see the penny drop in my 
calculations... ---

I am going to redo as sanity check.
As long as width is 80 I can cause it.
Attached is a screenshot.

I'll redo it again. not omitting my user@host part (I brain-farted and removed 
it before)

Also, I tested booting in KVM Ubuntu 17.10.1 64-bit ISO and got same thing in 
gnome-terminal
(another screenshot)

Critically, the total length of the path before the EM/EN Dash must be 147 
Characters!
(If you don't create in /tmp but say /home/user/, reduce the number of 
characters before EN Dash to match)

It appears that it is dependent solely on number of characters in path before 
EN/EM Dash

Starting program: /home/kieran/gits/CORE/bash/bash 
kieran@kieran-desktop:~/gits/CORE/bash$ cd /tmp/
kieran@kieran-desktop:/tmp$ mkdir 
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678–
kieran@kieran-desktop:/tmp$ cd 
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678–/
kieran@kieran-desktop:/tmp/0123456789012345678901234567890123456789012345678901256789012345678901234567890123456789012345678901234567890123456789012345678–$
 cd ..
kieran@kieran-desktop:/tmp$ mkdir 
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
kieran@kieran-desktop:/tmp$ cd 
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/

Program received signal SIGSEGV, Segmentation fault.
0x00000000004bd03b in rl_redisplay () at display.c:823
823           inv_lbreaks[++newlines] = temp;
(gdb) bt
#0  0x00000000004bd03b in rl_redisplay () at display.c:823
#1  0x00000000004a858c in readline_internal_setup () at readline.c:443
#2  0x00000000004a8a1f in readline_internal () at readline.c:669
#3  0x00000000004a8452 in readline (prompt=0xa52a08 "H\001") at readline.c:376
#4  0x0000000000407987 in yy_readline_get ()
    at /usr/homes/chet/src/bash/src/parse.y:1456
#5  0x0000000000407a9c in yy_readline_get ()
    at /usr/homes/chet/src/bash/src/parse.y:1487
#6  0x00000000004078d2 in yy_getc ()
    at /usr/homes/chet/src/bash/src/parse.y:1390
#7  0x00000000004087c6 in shell_getc (remove_quoted_newline=1)
    at /usr/homes/chet/src/bash/src/parse.y:2299
#8  0x0000000000409d31 in read_token (command=0)
    at /usr/homes/chet/src/bash/src/parse.y:3115
#9  0x00000000004092c9 in yylex () at /usr/homes/chet/src/bash/src/parse.y:2675
#10 0x0000000000404425 in yyparse () at y.tab.c:1834
#11 0x0000000000403fd8 in parse_command () at eval.c:261
#12 0x00000000004040be in read_command () at eval.c:305
#13 0x0000000000403cee in reader_loop () at eval.c:149
#14 0x00000000004017c6 in main (argc=1, argv=0x7fffffffddf8, 
    env=0x7fffffffde08) at shell.c:792

If you increase screen width to 100, the length required increased:

Starting program: /home/kieran/gits/CORE/bash/bash 
kieran@kieran-desktop:~/gits/CORE/bash$ cd /tmp/
kieran@kieran-desktop:/tmp$ cd 
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
 # One that caused crashed on width 80
kieran@kieran-desktop:/tmp/01234567890123456789012345678901234567890123456789012345678901234567890125678901234567890123456789012345678901234567890123456789–$
 cd ..
kieran@kieran-desktop:/tmp$ mkdir 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
kieran@kieran-desktop:/tmp$ cd 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
 # Extra 10
kieran@kieran-desktop:/tmp/012345678901234567890123456789012345678901234567890123456789012345678901256789012345678901234567890123456789012345678901234567890123456789–$
 cd ..
kieran@kieran-desktop:/tmp$ mkdir 
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
kieran@kieran-desktop:/tmp$ cd 
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
 # Extra 10 again
kieran@kieran-desktop:/tmp/0123456789012345678901234567890123456789012345678901234567890123456789012567890123456789012345678901234567890123456789012345678901234567890123456789–$
 cd ..
kieran@kieran-desktop:/tmp$ mkdir 
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
kieran@kieran-desktop:/tmp$ cd 
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
 # Another 10
kieran@kieran-desktop:/tmp/01234567890123456789012345678901234567890123456789012345678901234567890125678901234567890123456789012345678901234567890123456789012345678901234567890123456789–$
 cd ..
kieran@kieran-desktop:/tmp$ mkdir 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
kieran@kieran-desktop:/tmp$ cd 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789–/
 # Another lot for good luck and...

Program received signal SIGSEGV, Segmentation fault.
0x00000000004bd03b in rl_redisplay () at display.c:823
823           inv_lbreaks[++newlines] = temp;
(gdb) bt
#0  0x00000000004bd03b in rl_redisplay () at display.c:823
#1  0x00000000004a858c in readline_internal_setup () at readline.c:443
#2  0x00000000004a8a1f in readline_internal () at readline.c:669
#3  0x00000000004a8452 in readline (prompt=0xa54608 "\230\001") at 
readline.c:376
#4  0x0000000000407987 in yy_readline_get () at 
/usr/homes/chet/src/bash/src/parse.y:1456
#5  0x0000000000407a9c in yy_readline_get () at 
/usr/homes/chet/src/bash/src/parse.y:1487
#6  0x00000000004078d2 in yy_getc () at 
/usr/homes/chet/src/bash/src/parse.y:1390
#7  0x00000000004087c6 in shell_getc (remove_quoted_newline=1)
    at /usr/homes/chet/src/bash/src/parse.y:2299
#8  0x0000000000409d31 in read_token (command=0) at 
/usr/homes/chet/src/bash/src/parse.y:3115
#9  0x00000000004092c9 in yylex () at /usr/homes/chet/src/bash/src/parse.y:2675
#10 0x0000000000404425 in yyparse () at y.tab.c:1834
#11 0x0000000000403fd8 in parse_command () at eval.c:261
#12 0x00000000004040be in read_command () at eval.c:305
#13 0x0000000000403cee in reader_loop () at eval.c:149
#14 0x00000000004017c6 in main (argc=1, argv=0x7fffffffddf8, 
env=0x7fffffffde08) at shell.c:792

(Had to add 40 extra characters, so seems to be related to 2x screen width? 
(maybe minus my name@host length as well at start?)
Actually... let's see 26 characters in my name@host:PATH string for /tmp... 
length for crash of 80 width was 130...

Attachment: PS1 sanity check.png
Description: PNG image

Attachment: Ubuntu 17.10.1 ISO under KVM.png
Description: PNG image

Attachment: Width just 40.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]