Segfaults over a glob with quoted UTF-8 characters

2020-11-03 Thread Frédéric Brière
  $ echo $BASH_VERSION
   5.1.0(1)-rc1
  $ echo $LC_ALL
   C.UTF-8
  $ echo é/*
   é/*
  $ echo 'é'/*
   Segmentation fault (core dumped)

The same occurs when escaping with a backslash.  Whether or not the glob
actually matches something does not appear to matter.

I could not reproduce this with 5.0.3(1)-release, so I guess this was
introduced with version 5.1.

Here's the backtrace:

#5  0x564e8eb3a4fb in wdequote_pathname 
(pathname=pathname@entry=0x564e8f46b6d0 "é/") at ../../.././lib/glob/glob.c:487
ps = {__count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}}
len = 4
n = 
wpathname = 0x0
i = 
j = 
orig_wpathname = 0x564e8f5b60b0 L"é/"
#6  0x564e8eb3b0eb in dequote_pathname (pathname=0x564e8f46b6d0 "é/") at 
../../.././lib/glob/glob.c:504
No locals.
#7  glob_filename (pathname=pathname@entry=0x564e8f46b790 "\\é/*", flags=0) at 
../../.././lib/glob/glob.c:1466
temp_results = 
result = 0x564e8f5d8a50
new_result = 
result_size = 1
directory_name = 0x564e8f46b6d0 "é/"
filename = 0x564e8f46b794 "*"
dname = 
fn = 
directory_len = 4
free_dirname = 1
dflags = 
hasglob = 
#8  0x564e8eb05c2d in shell_glob_filename (pathname=, 
qflags=qflags@entry=8) at .././pathexp.c:470
temp = 0x564e8f46b790 "\\é/*"
results = 
gflags = 
quoted_pattern = 
#9  0x564e8eaf33e6 in glob_expand_word_list (tlist=0x564e8f45d380, 
eflags=31) at .././subst.c:11383
glob_array = 0x0
temp_string = 
glob_index = 
glob_list = 
output_list = 0x564e8f45d160
disposables = 0x0
next = 0x0
tword = 
x = 
#10 0x564e8eb00685 in expand_word_list_internal (eflags=31, list=) at .././subst.c:11983
new_list = 
temp_list = 
tint = 
savecmd = 
new_list = 
temp_list = 
tint = 
savecmd = 
assign_func = 
is_special_builtin = 
is_builtin_or_func = 
#11 expand_words (list=) at .././subst.c:11331
No locals.
#12 0x564e8ead25f3 in execute_simple_command (fds_to_close=0x564e8f45d6e0, 
async=0, pipe_out=-1, pipe_in=-1, simple_command=) at 
.././execute_cmd.c:4377
words = 
first_word_quoted = 
result = 
builtin_is_special = 0
old_last_async_pid = 
command_line = 0x0
temp = 
dofork = 
fork_flags = 
old_builtin = 0
lastarg = 
cmdflags = 0
builtin = 
lastword = 
already_forked = 0
func = 
old_command_builtin = 0
words = 
lastword = 
command_line = 
lastarg = 
temp = 
first_word_quoted = 
result = 
builtin_is_special = 
already_forked = 
dofork = 
fork_flags = 
cmdflags = 
old_last_async_pid = 
builtin = 
func = 
old_builtin = 
old_command_builtin = 
p = 
disposer = 
l = 
cmdtype = 
job = 
jflags = 
started_status = 
#13 execute_command_internal (command=0x564e8f44af10, asynchronous=, pipe_in=-1, pipe_out=, fds_to_close=0x564e8f45d6e0) at 
.././execute_cmd.c:846
exec_result = 0
user_subshell = 
invert = 
ignore_return = 0
was_error_trap = 0
fork_flags = 
my_undo_list = 0x0
exec_undo_list = 0x0
tcmd = 
save_line_number = 3
ofifo = 0
nfifo = 0
osize = 0
saved_fifo = 0
ofifo_list = 0x0
#14 0x564e8ead3865 in execute_command (command=0x564e8f44af10) at 
.././execute_cmd.c:395
bitmap = 0x564e8f45d6e0
result = 
#15 0x564e8eab99db in reader_loop () at .././eval.c:170
code = 
our_indirection_level = 1
current_command = 0x564e8f44af10
#16 0x564e8eab8668 in main (argc=1, argv=0x7ffef0ca95a8, 
env=0x7ffef0ca95b8) at .././shell.c:811
i = 
code = 
old_errexit_flag = 0
saverst = 
locally_skip_execution = 0
arg_index = 1
top_level_arg_index = 1



Re: Segfaults over a glob with quoted UTF-8 characters

2020-11-03 Thread Chet Ramey
On 11/3/20 4:09 PM, Frédéric Brière wrote:
>   $ echo $BASH_VERSION
>5.1.0(1)-rc1
>   $ echo $LC_ALL
>C.UTF-8
>   $ echo é/*
>é/*
>   $ echo 'é'/*
>Segmentation fault (core dumped)
> 
> The same occurs when escaping with a backslash.  Whether or not the glob
> actually matches something does not appear to matter.

Thanks for the report. This has already been fixed, the result of

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972286

The fix is in bash-5.1-rc2.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



[bash-5.1-rc2.] Do not leave /tmp/fchist-nnnn, please.

2020-11-03 Thread Kiyoshi KANAZAWA
Hello,
Testing bash-5.1-rc2.
make & make check passed, but /tmp/fchist- is made and not removed in make 
check ( seems to be precess id).

Environment:
$ uname -a
SunOS hidden 5.11 11.3 i86pc i386 i86pc

$ gcc --version
gcc (GCC) 10.2.0


Regards,

--- Kiyoshi