bug-bash
[Top][All Lists]
Advanced

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

current bash.git.devel segfaults on my code


From: Alex fxmbsw7 Ratchev
Subject: current bash.git.devel segfaults on my code
Date: Mon, 11 Oct 2021 17:17:34 +0200

as the topic says
i fetched it earlier today, compiled, and tho it rather segfaults

due to i dunno to debug this, this mail consists of 3 parts, 1 gdb + bt
./bash (loading in bashrc a script which makesnit segfault)
and once with gdb ./bash -vx
third part is the code
forth part is around where in the code it happens


Reading symbols from ./bash...
(gdb) r
Starting program: /root/bash5/bash
[Detaching after fork from child process 12977]
[Detaching after fork from child process 12978]

Program received signal SIGSEGV, Segmentation fault.
0x00000030000fba28 in internal_malloc (n=5, file=0x0, line=0, flags=0)
    at malloc.c:879
879       nextf[nunits] = CHAIN (p);
(gdb) bt
#0  0x00000030000fba28 in internal_malloc (n=5, file=0x0, line=0, flags=0)
    at malloc.c:879
#1  0x0000007ff7e5b230 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#2  0x0000007ff7e5b4c0 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#3  0x0000007ff7e59148 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#4  0x0000007ff7e58968 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#5  0x00000030000fba60 in internal_malloc (n=5, file=0x0, line=0, flags=0)
    at malloc.c:886
#6  0x0000007ff7e5b230 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#7  0x0000007ff7e5b4c0 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#8  0x0000007ff7e59148 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#9  0x0000007ff7e58968 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#10 0x00000030000fba60 in internal_malloc (n=10,
    file=file@entry=0x30001167f0 "glob.c", line=line@entry=936,
    flags=flags@entry=1) at malloc.c:886
#11 0x00000030000fcb38 in sh_malloc (bytes=<optimized out>,
    file=file@entry=0x30001167f0 "glob.c", line=line@entry=936) at
malloc.c:1431
#12 0x00000030000baffc in glob_vector (pat=pat@entry=0x300024d05f "*",
    dir=dir@entry=0x300024ca90 "/root/xbl5/bin", flags=flags@entry=1024)
    at glob.c:936
#13 0x00000030000bb6e4 in glob_filename (
    pathname=pathname@entry=0x300024d010
"/\\r\\o\\o\\t/\\x\\b\\l\\5/@(eval[12]|bin|set|shopt|declare|function|alias|pc|runtime)/*",
flags=1024) at glob.c:1360
#14 0x0000003000083ab4 in shell_glob_filename (pathname=<optimized out>,
    qflags=qflags@entry=8) at pathexp.c:470
#15 0x0000003000070fec in glob_expand_word_list (tlist=0x300024e2d0,
eflags=30)
    at subst.c:11774
#16 0x000000300007e188 in expand_word_list_internal (eflags=30,
    list=0x300024ca10) at subst.c:12447
#17 0x00000030000895f4 in expand_compound_array_assignment (
    var=var@entry=0x300024f410,
    value=value@entry=0x300024da90 "\"$rarg\"$supported", flags=flags@entry
=0)
    at arrayfunc.c:563
#18 0x000000300008aa04 in assign_array_var_from_string (flags=0,
    value=0x300024da90 "\"$rarg\"$supported", var=0x300024f410)
    at arrayfunc.c:836
#19 assign_array_var_from_string (flags=0,
    value=0x300024da90 "\"$rarg\"$supported", var=0x300024f410)
    at arrayfunc.c:826
#20 assign_array_from_string (name=name@entry=0x300024d9d0 "pos",
    value=value@entry=0x300024da90 "\"$rarg\"$supported", flags=flags@entry
=0)
    at arrayfunc.c:480
#21 0x0000003000073ea4 in do_compound_assignment (flags=0,
    value=0x300024da90 "\"$rarg\"$supported", name=0x300024d9d0 "pos")
    at subst.c:3212
#22 do_assignment_internal (word=0x300024d990, expand=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--c
    at subst.c:3321
#23 0x000000300006a824 in do_assignment_statements
(varlist=varlist@entry=0x300024d910,
command=command@entry=0x0, is_nullcmd=is_nullcmd@entry=1) at subst.c:12337
#24 0x000000300007df78 in expand_word_list_internal (eflags=31,
list=0x300024b750) at subst.c:12417
#25 expand_words (list=list@entry=0x300024b750) at subst.c:11722
#26 0x000000300004ee14 in execute_simple_command
(fds_to_close=0x300024ee90, async=0, pipe_out=-1, pipe_in=-1,
simple_command=<optimized out>) at execute_cmd.c:4493
#27 execute_command_internal (command=0x300024b410,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ee90)
at execute_cmd.c:847
#28 0x0000003000051f54 in execute_connection
(command=command@entry=0x300024b790,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ee90)
at execute_cmd.c:2742
#29 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024b790,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ee90)
at execute_cmd.c:1021
#30 0x00000030000502dc in execute_command (command=0x300024b790) at
execute_cmd.c:396
#31 0x0000003000051f14 in execute_connection
(command=command@entry=0x300020d730,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ed50)
at execute_cmd.c:2733
#32 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300020d730,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ed50)
at execute_cmd.c:1021
#33 0x00000030000502dc in execute_command (command=0x300020d730) at
execute_cmd.c:396
#34 0x0000003000051f14 in execute_connection
(command=command@entry=0x300021ca10,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024c790)
at execute_cmd.c:2733
#35 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300021ca10,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024c790)
at execute_cmd.c:1021
#36 0x00000030000502dc in execute_command (command=0x300021ca10) at
execute_cmd.c:396
#37 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024be90,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024e1d0)
at execute_cmd.c:2733
#38 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024be90,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024e1d0)
at execute_cmd.c:1021
#39 0x00000030000502dc in execute_command (command=0x300024be90) at
execute_cmd.c:396
#40 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024c390,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024e0d0)
at execute_cmd.c:2733
#41 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024c390,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024e0d0)
at execute_cmd.c:1021
#42 0x00000030000502dc in execute_command (command=0x300024c390) at
execute_cmd.c:396
#43 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024ce50,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024df10)
at execute_cmd.c:2733
#44 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024ce50,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024df10)
at execute_cmd.c:1021
#45 0x00000030000502dc in execute_command (command=0x300024ce50) at
execute_cmd.c:396
#46 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024e390,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ded0)
at execute_cmd.c:2733
#47 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024e390,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024ded0)
at execute_cmd.c:1021
#48 0x00000030000502dc in execute_command (command=0x300024e390) at
execute_cmd.c:396
#49 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024ea50,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024dd50)
at execute_cmd.c:2733
#50 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024ea50,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024dd50)
at execute_cmd.c:1021
#51 0x00000030000502dc in execute_command (command=0x300024ea50) at
execute_cmd.c:396
#52 0x0000003000051f14 in execute_connection
(command=command@entry=0x300024e7d0,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024d650)
at execute_cmd.c:2733
#53 0x000000300004da94 in execute_command_internal
(command=command@entry=0x300024e7d0,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024d650)
at execute_cmd.c:1021
#54 0x00000030000502dc in execute_command (command=0x300024e7d0) at
execute_cmd.c:396
#55 0x000000300004eacc in execute_for_command (for_command=<optimized out>)
at execute_cmd.c:2960
#56 execute_command_internal (command=0x300024e950,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300024e6d0)
at execute_cmd.c:933
#57 0x00000030000a7418 in parse_and_execute (string=<optimized out>,
from_file=from_file@entry=0x3000249010 "/root/xbl5/xbl.bash",
flags=flags@entry=20) at evalstring.c:509
#58 0x00000030000a6270 in _evalfile (filename=0x3000249010
"/root/xbl5/xbl.bash", flags=270) at evalfile.c:285
#59 0x00000030000a6428 in source_file (filename=filename@entry=0x3000249010
"/root/xbl5/xbl.bash", sflags=<optimized out>) at evalfile.c:380
#60 0x00000030000b1844 in source_builtin (list=0x300021cd10) at
./source.def:195
#61 0x0000003000049cb4 in execute_builtin (builtin=builtin@entry=0x30000b1710
<source_builtin>, words=words@entry=0x300021cc90, flags=flags@entry=0,
subshell=subshell@entry=0) at execute_cmd.c:4958
#62 0x000000300004fe3c in execute_builtin_or_function (flags=0,
fds_to_close=0x300021c850, redirects=<optimized out>, var=<optimized out>,
builtin=0x30000b1710 <source_builtin>, words=0x300021cc90) at
execute_cmd.c:5471
#63 execute_simple_command (fds_to_close=0x300021c850, async=0,
pipe_out=<optimized out>, pipe_in=<optimized out>,
simple_command=<optimized out>) at execute_cmd.c:4724
#64 execute_command_internal (command=0x300021c690,
asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1,
pipe_out=pipe_out@entry=-1, fds_to_close=fds_to_close@entry=0x300021c850)
at execute_cmd.c:847
#65 0x00000030000a7418 in parse_and_execute (string=<optimized out>,
from_file=from_file@entry=0x3000216810 "/root/.bashrc", flags=flags@entry=20)
at evalstring.c:509
#66 0x00000030000a6270 in _evalfile (filename=filename@entry=0x3000216810
"/root/.bashrc", flags=flags@entry=9) at evalfile.c:285
#67 0x00000030000a633c in maybe_execute_file (fname=<optimized out>,
force_noninteractive=force_noninteractive@entry=1) at evalfile.c:330
#68 0x0000003000035170 in run_startup_files () at shell.c:1229
#69 main (argc=1, argv=0x7ffffffcf8, env=<optimized out>) at shell.c:711




part 2 i cant do, cant find how to pass args to gdbs cmd

part four: it happens between

pos=( "$rarg"$supported )

and

unset inroot

as that -vx snippet segfaulting

++ rarg=/root/xbl5
++ pos=("$rarg"$supported)
Segmentation fault



in figure 3 here the code

#!/bin/bash

set -mb
shopt -s nullglob extglob dotglob globstar lastpipe expand_aliases

unset ye1
me=$( realpath "$BASH_SOURCE" ) medir=${me%/*} states=~/.xbl-states
PATH=$PATH:$medir/bin mein=$PWD \
supported='/@(eval[12]|bin|set|shopt|declare|function|alias|pc|runtime)/*' \
xblpp=${xblp+cat${ye1=}}${ye1-.}

[[ ! -d $states ]] && mkdir -p "$states"

[[ -v xblpe ]] && eval -- "$xblpe"

for arg in "$medir" "$@"; do
 [[ ! -e $arg ]] && continue

 rarg=$( realpath "$arg" 2>&- ) || rarg=$arg
 pos=( "$rarg"$supported )

 unset inroot
 [[ -d $rarg/root ]] && {
  inroot=$rarg/root
  cd "$inroot"
 }

 [[ -d $rarg/bin ]] && PATH=$PATH:$rarg/bin
 [[ -d $rarg/state ]] && states2=$rarg/state || states2=

tt=$states/files.long.$SRANDOM$SRANDOM hash=$(
 cksum < <(
  kopi.gawk "$tt" < <(
   find \
    "${pos[@]}" \
     \( -name '*.off' -o -name '*.old' -o -name '*.old.*' -o -name
'*.off.*' -o -name '*.sw[a-z]' \) -prune -o \
     -printf '%Y\0%s\0%m\0%T@\0%f\0%p\0\0'
  )
 )
) t=$states/$hash ttt=$tt.$hash t2=${states2:+$states2/$hash} \

mv -- "$tt" "$ttt"

$xblpp <(
 if [[ -s $t ]] ; then
  cat -- "$t"
 elif [[ -s $t2 ]] ; then
  cat -- "$t2"
 else
  kopi.gawk "$t." < <(
   xbl.gawk < <(
    kopi.gawk "$t.files" < <(
     xbl.files.gawk -v name="$arg" -v base="$rarg" <"$ttt"
    )
   )
  )
  mv -- "$t"{.,}
  mv -- "$ttt" "$t.files.long"
 fi
 true
)

[[ -v inroot ]] && cd "$mein"

done

mkPATH

[[ -v xble ]] && eval -- "$xble"
true


reply via email to

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