Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -Wno-parentheses -Wno-format-security uname output: Linux elite.mainst 4.16.12-300.fc28.x86_64 #1 SMP Fri May 25 21:13:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu
Bash Version: 4.4 Patch Level: 19 Release Status: release Description: Segfault from reading a history file not starting with # with HISTTIMEFORMAT set and history_multiline_entries nonzero and with the history cleared and read on the same input line. Repeat-By: env -i bash --noprofile --norc echo $'#1\necho a'>a echo 'echo b'>b HISTTIMEFORMAT='%s ' history -r a # force history_multiline_entries to be nonzero history -c; history -r b # force history_length to be zero when reading Segmentation fault (core dumped) Fix: history_multiline_entries probably shouldn't be sticky over unset HISTTIMEFORMAT, but here is the minimal fix: --- /usr/src/debug/bash-4.4.19-2.fc28.x86_64/lib/readline/histfile.c 2016-01-25 10:34:03.000000000 -0500 +++ histfile.c 2018-06-10 03:12:17.750218417 -0400 @@ -385,7 +385,7 @@ { if (HIST_TIMESTAMP_START(line_start) == 0) { - if (last_ts == NULL && history_multiline_entries) + if (history_length > 0 && last_ts == NULL && history_multiline_entries) _hs_append_history_line (history_length - 1, line_start); else add_history (line_start);