[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coredump from C-c-ed function
From: |
xftroxgpx |
Subject: |
Re: coredump from C-c-ed function |
Date: |
Tue, 23 Jan 2018 10:39:20 -0500 |
-------- Original Message --------
On January 23, 2018 2:54 PM, Chet Ramey <chet.ramey@case.edu> wrote:
>On 1/23/18 3:30 AM, xftroxgpx wrote:
>
>>Bash Version: 4.4
>> Patch Level: 12
>> Release Status: release
>>Description:
>> bash coredumps by interrupting a called a function via C-c
>>Repeat-By:
>>1. get interactive bash shell
>>
>>2. paste this function definition at command prompt
>> function dv3() {
>> local ec=1
>> time while test "$ec" -ne "0"; do
>> sleep 1
>> ls /$RANDOM
>> ec="$?"
>> done
>> }
>>
>>3. now call it: $ dv3
>>
>>4. C-c at any point
>>
>>
> $ ./bash
> $ echo $BASH_VERSION
> 4.4.12(2)-release
> $ function dv3() {
>>local ec=1
>> time while test "$ec" -ne "0"; do
>> sleep 1
>> ls /$RANDOM
>> ec="$?"
>> done
>> }
>>
>$ type dv3
> dv3 is a function
> dv3 ()
> {
> local ec=1;
> time while test "$ec" -ne "0"; do
> sleep 1;
> /bin/ls -F /$RANDOM;
> ec="$?";
> done
> }
> $ dv3
> /bin/ls: cannot access /10692: No such file or directory
> /bin/ls: cannot access /8614: No such file or directory
> /bin/ls: cannot access /22963: No such file or directory
> ^C
>
> real 0m3.189s
> user 0m0.002s
> sys 0m0.008s
> $
>
> (I have an alias for ls.)
Seems like you hit variant B) here.
where you get to see the prompt but there still was a coredump, which looks
like this on `journalctl -efa --no-hostname`, for me:
$ type dv3
dv3 is a function
dv3 ()
{
local ec=1;
time while test "$ec" -ne "0"; do
sleep 1;
ls --color=auto /$RANDOM;
ec="$?";
done
}
$ dv3
ls: cannot access '/10004': No such file or directory
ls: cannot access '/9610': No such file or directory
^C
real 0m3.001s
user 0m0.001s
sys 0m0.008s
$
#still got prompt
#(in another terminal) partial output of `journalctl -efa --no-hostname` is:
Jan 23 16:19:50 systemd-coredump[2517]: Process 2515 (bash) of user 1000 dumped
core.
Stack trace of thread 2515:
#0 0x00007f3763d7649d _int_malloc (libc.so.6)
#1 0x00007f3763d782f3 malloc (libc.so.6)
#2 0x000000000047224e xmalloc (bash)
#3 0x000000000042a1c9 make_bare_word (bash)
#4 0x000000000043c8ed copy_word_list (bash)
#5 0x000000000043ce3f copy_command (bash)
#6 0x000000000043ce09 copy_command (bash)
#7 0x000000000043cf5e n/a (bash)
#8 0x000000000043cbb1 copy_command (bash)
#9 0x000000000043cbf9 copy_command (bash)
#10 0x000000000043cc3a copy_command (bash)
#11 0x0000000000434c01 n/a (bash)
#12 0x00000000004310d9 n/a (bash)
#13 0x0000000000431e4c execute_command_internal (bash)
#14 0x000000000047894f parse_and_execute (bash)
#15 0x000000000044dd71 command_substitute (bash)
#16 0x000000000045285e n/a (bash)
#17 0x0000000000453d11 n/a (bash)
#18 0x0000000000455409 expand_prompt_string (bash)
#19 0x000000000041dd74 decode_prompt_string (bash)
#20 0x000000000041e791 n/a (bash)
#21 0x0000000000427c46 yyparse (bash)
#22 0x000000000041c12f parse_command (bash)
#23 0x000000000041c218 read_command (bash)
#24 0x000000000041c3f9 reader_loop (bash)
#25 0x000000000041b1b5 main (bash)
#26 0x00007f3763d16f4a __libc_start_main (libc.so.6)
#27 0x000000000041b6fa _start (bash)
Jan 23 16:19:50 systemd-coredump[2522]: Process 2520 (bash) of user 1000 dumped
core.
Stack trace of thread 2520:
#0 0x00007f3763d7649d _int_malloc (libc.so.6)
#1 0x00007f3763d782f3 malloc (libc.so.6)
#2 0x000000000047224e xmalloc (bash)
#3 0x000000000042a1c9 make_bare_word (bash)
#4 0x000000000043c8ed copy_word_list (bash)
#5 0x000000000043ce3f copy_command (bash)
#6 0x000000000043cdf4 copy_command (bash)
#7 0x000000000043cbf9 copy_command (bash)
#8 0x000000000043cbe8 copy_command (bash)
#9 0x000000000043cc3a copy_command (bash)
#10 0x0000000000434c01 n/a (bash)
#11 0x00000000004310d9 n/a (bash)
#12 0x0000000000431e4c execute_command_internal (bash)
#13 0x000000000047894f parse_and_execute (bash)
#14 0x000000000044dd71 command_substitute (bash)
#15 0x000000000045285e n/a (bash)
#16 0x0000000000453d11 n/a (bash)
#17 0x0000000000455409 expand_prompt_string (bash)
#18 0x000000000041dd74 decode_prompt_string (bash)
#19 0x000000000041e791 n/a (bash)
#20 0x0000000000427c46 yyparse (bash)
#21 0x000000000041c12f parse_command (bash)
#22 0x000000000041c218 read_command (bash)
#23 0x000000000041c3f9 reader_loop (bash)
#24 0x000000000041b1b5 main (bash)
#25 0x00007f3763d16f4a __libc_start_main (libc.so.6)
#26 0x000000000041b6fa _start (bash)
#continuing in original terminal, where I still got a prompt
$ echo a
a
$
#still got a prompt
#looking at journalctl again:
Jan 23 16:22:44 systemd-coredump[2726]: Process 2724 (bash) of user 1000 dumped
core.
Stack trace of thread 2724:
#0 0x00007f3763d7649d _int_malloc (libc.so.6)
#1 0x00007f3763d782f3 malloc (libc.so.6)
#2 0x000000000047224e xmalloc (bash)
#3 0x000000000042a1c9 make_bare_word (bash)
#4 0x000000000043c8ed copy_word_list (bash)
#5 0x000000000043ce3f copy_command (bash)
#6 0x000000000043ce09 copy_command (bash)
#7 0x000000000043cf5e n/a (bash)
#8 0x000000000043cbb1 copy_command (bash)
#9 0x000000000043cbf9 copy_command (bash)
#10 0x000000000043cc3a copy_command (bash)
#11 0x0000000000434c01 n/a (bash)
#12 0x00000000004310d9 n/a (bash)
#13 0x0000000000431e4c execute_command_internal (bash)
#14 0x000000000047894f parse_and_execute (bash)
#15 0x000000000044dd71 command_substitute (bash)
#16 0x000000000045285e n/a (bash)
#17 0x0000000000453d11 n/a (bash)
#18 0x0000000000455409 expand_prompt_string (bash)
#19 0x000000000041dd74 decode_prompt_string (bash)
#20 0x000000000041e791 n/a (bash)
#21 0x0000000000427c46 yyparse (bash)
#22 0x000000000041c12f parse_command (bash)
#23 0x000000000041c218 read_command (bash)
#24 0x000000000041c3f9 reader_loop (bash)
#25 0x000000000041b1b5 main (bash)
#26 0x00007f3763d16f4a __libc_start_main (libc.so.6)
#27 0x000000000041b6fa _start (bash)
Jan 23 16:22:44 systemd-coredump[2731]: Process 2729 (bash) of user 1000 dumped
core.
Stack trace of thread 2729:
#0 0x00007f3763d7649d _int_malloc (libc.so.6)
#1 0x00007f3763d782f3 malloc (libc.so.6)
#2 0x000000000047224e xmalloc (bash)
#3 0x000000000042a1c9 make_bare_word (bash)
#4 0x000000000043c8ed copy_word_list (bash)
#5 0x000000000043ce3f copy_command (bash)
#6 0x000000000043cdf4 copy_command (bash)
#7 0x000000000043cbf9 copy_command (bash)
#8 0x000000000043cbe8 copy_command (bash)
#9 0x000000000043cc3a copy_command (bash)
#10 0x0000000000434c01 n/a (bash)
#11 0x00000000004310d9 n/a (bash)
#12 0x0000000000431e4c execute_command_internal (bash)
#13 0x000000000047894f parse_and_execute (bash)
#14 0x000000000044dd71 command_substitute (bash)
#15 0x000000000045285e n/a (bash)
#16 0x0000000000453d11 n/a (bash)
#17 0x0000000000455409 expand_prompt_string (bash)
#18 0x000000000041dd74 decode_prompt_string (bash)
#19 0x000000000041e791 n/a (bash)
#20 0x0000000000427c46 yyparse (bash)
#21 0x000000000041c12f parse_command (bash)
#22 0x000000000041c218 read_command (bash)
#23 0x000000000041c3f9 reader_loop (bash)
#24 0x000000000041b1b5 main (bash)
#25 0x00007f3763d16f4a __libc_start_main (libc.so.6)
#26 0x000000000041b6fa _start (bash)
#now continuing at the prompt of original terminal
$ dv3
#that causes immediate exit(ie. variant A.) due to the final coredump(and if
running inside xfce4-terminal, the window is closed only now), as seen in
journalctl:
Jan 23 16:25:45 systemd-coredump[2893]: Process 2352 (bash) of user 1000 dumped
core.
Stack trace of thread 2352:
#0 0x00007f3763d7649d _int_malloc (libc.so.6)
#1 0x00007f3763d782f3 malloc (libc.so.6)
#2 0x000000000047224e xmalloc (bash)
#3 0x000000000045b39b unwind_protect_mem (bash)
#4 0x000000000043500a n/a (bash)
#5 0x00000000004310d9 n/a (bash)
#6 0x0000000000431e4c execute_command_internal (bash)
#7 0x0000000000433a6e execute_command (bash)
#8 0x000000000041c492 reader_loop (bash)
#9 0x000000000041b1b5 main (bash)
#10 0x00007f3763d16f4a __libc_start_main (libc.so.6)
#11 0x000000000041b6fa _start (bash)
Sometimes, depending on timing, variant A. happens without variant B. first. (I
believe this is the one you hit in your subsequent reply here
https://lists.gnu.org/archive/html/bug-bash/2018-01/msg00063.html ). But
usually variant B. (then A.) is what happens, as I tried to illustrate above.
If by any chance, more env. stuff is needed to reproduce (at least PS1 is not
really needed, i tested - but it could modify the stacktraces, maybe) then here
are my .bashrc, .bash_profile, .extend.bashrc and .second.bashrc , in this
directory:
https://github.com/xftroxgpx/a3/tree/864b56c5f0821e2d25a647315168f14739889f98/system/Z575/OSes/3archlinux/on_baremetal/filesystem_now/archlinux/home/xftroxgpx/bin/confHOME/home/xftroxgpx
Thank you for taking a look at this, Chet.
Cheers!
>
>The lyf so short, the craft so long to lerne.'' - ChaucerArs longa, vita
>brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.eduhttp://tiswww.cwru.edu/~chet/
>