Files
bash/ChangeLog
2025-06-02 12:05:51 -04:00

11271 lines
409 KiB
Plaintext

12/6/2020
---------
[bash-5.1 released]
12/7
----
Makefile.in
- bashline.o: add dependency on ${DEFDIR}/builtext.h. Report from
Fazal Majid <fazal@majid.org>
12/11
-----
builtins/wait.def
- wait_builtin: don't assign the variable given with -p if there are no
jobs to wait for. Report and fix from OÄuz <oguzismailuysal@gmail.com>
arrayfunc.c
- kvpair_assignment_p: return non-zero if argument L appears to be a
key-value pair associative array compound assignment
- expand_and_quote_kvpair_word: run a single word in a key-value pair
associative array compound assignment through the appropriate
expansions and single-quote the result
arrayfunc.h
- kvpair_assignment_p, expand_and_quote_kvpair_word: extern declarations
subst.c
- expand_oneword: detect whether VALUE appears to be a key-value
pair compound assignment and call the appropriate function to expand
each word in the resulting list. Fixes inconsistency reported by
oguzismailuysal@gmail.com
12/12
-----
subst.c
- command_substitute: don't reset pipeline_pgrp to shell_pgrp if we
are already forked to run a command (SUBSHELL_FORK). Fixes SIGINT
in command substitution in here-document in forked child issue
reported by oguzismailuysal@gmail.com
12/18
-----
execute_cmd.c
- execute_pipeline: execute the lastpipe code even if prev == 0. It
can only be 0 here if stdin was closed when this function was
executed
- execute_pipeline: if prev == 0, set lstdin to a sentinel (-1) that
means to close fd 0 after executing the command, and call close(prev)
before restoring stdin. restore_stdin now understands -1, and closes
fd 0. Fixes issue reported by Tomas Janousek <tomi@nomi.cz>
12/21
-----
doc/bashref.texi
- PROMPT_COMMANDS: clean up a couple of remaining instances of this
name. Report from Eli Schwartz <eschwartz@archlinux.org>
12/26
-----
subst.c
- command_substitute: make sure that the child process always has
pipeline_pgrp == shell_pgrp: if pipeline_pgrp is non-zero when we
get to the child, meaning that we're part of an already-forked
child that is, for instance, running redirections, we need to reset
shell_pgrp to it to preserve the invariant. Fixes bug with terminal
being set to the incorrect pgrp reported by oguzismailuysal@gmail.com
12/29
-----
configure.ac,builtins/shobj-conf,m4/threadlib.m4
- midnightbsd: update auto-configuration to treat MidnightBSD like
FreeBSD. From https://savannah.gnu.org/patch/?10006
12/30
-----
examples/loadables/stat.c
- stattime: use strftime with a default format or the format supplied
with the -F option to format the file time information
- stat_builtin: now takes a -F fmt option for a strftime format string;
change to function calling sequences to pass the format down to
stattime
examples/loadables/Makefile.in
- stat: now built and installed by default
12/31
-----
command.h
- SUBSHELL_IGNTRAP: new flag value
jobs.c
- make_child: set SUBSHELL_IGNTRAP in subshell_environment in the
child process, meaning that we should not execute trap handlers for
trapped signals
execute_cmd.c
- execute_in_subshell, execute_simple_command, execute_disk_command:
make sure to unset SUBSHELL_IGNTRAP after a child process restores
the original signal dispositions
- execute_simple_command: make sure to set SUBSHELL_IGNTRAP after
make_child returns and we're setting subshell_environment directly
subst.c
- command_substitute,process_substitute: unset SUBSHELL_IGNTRAP after
the child process has reset the trapped signal dispositions
trap.c
- trap_handler: if we get a signal for which we have set a trap, but
SUBSHELL_IGNTRAP is set in subshell_environmnent, make sure we
restore the original signal disposition and resend the signal to
ourselves. Fixes issue reported by Nikolay Borisov <nborisov@suse.com>
(or at least makes the race window much smaller)
sig.c
- initialize_terminating_signal: set the original signal handler from
the return value from sigaction; a minor optimization that saves a
system call or two
1/5/2021
--------
builtins/declare.def
- declare_internal: make some option combinations that don't make
sense errors (e.g., -f and -a/-A/-i/-n)
- declare_internal: if we build a new variable name by expanding the
value of a nameref variable, make sure to chop the `+' in a `+='
off before going on
1/7
---
doc/{bash.1,bashref.texi}
- bind: add an example to the synopsis making it clear that you can
use any readline command line as a non-option argument, as it says
in the text. From a report from Dan Jacobson <jidanni@jidanni.org>
1/12
----
locale.c
- local_shiftstates -> locale_shiftsates in the non-multibyte code
branch. Reported by Henry Bent <henry.r.bent@gmail.com>
subst.c
- expand_compound_assignment_word: make sure to call dispose_words on
the WORD_LIST * returned from expand_oneword after turning it back
into a string. Fixes memory leak reported by Alexander Mescheryakov
<alexander.s.m@gmail.com>
1/13
----
variables.c
- bind_variable_internal: when performing an assignment to a subscripted
array variable that was the value of a nameref (used in the original
assignment), don't call make_variable_value on the value, since that
messes up +=. Just call assign_array_element and let that take care
of calling make_variable_value appropriately. Fixes bug reported by
Oguz <oguzismailuysal@gmail.com>
1/14
----
findcmd.c
- search_for_command: if `checkhash' is set, don't add non-executable
files to the command hash table, since we will just remove them
later
lib/sh/winsize.c
- get_new_window_size: set *rp and *cp even if READLINE is not defined
1/15
----
lib/sh/winsize.c
- get_new_window_size: call rl_set_window_size only if we can determine
we're using readline: an interactive shell without no-line-editing,
or if we've already initialized readline, presumably in a non-
interactive shell
support/Makefile.in
- man2html: add LDFLAGS_FOR_BUILD to the recipe. Report from
Jeffrey Walton <noloader@gmail.com>
1/17
----
lib/readline/misc.c
- rl_operate_and_get_next: fix old K&R function declaration. Report
from Tom Tromey <tom@tromey.com>
lib/readline/readline.c
- _rl_internal_char_cleanup: move code that cleans up the active region
and deactivates the mark inside this function so callback mode
applications get the intended functionality. Report and fix from
sparrowhawk996@gmail.com
lib/readline/bind.c
- rl_parse_and_bind: when using the arithmetic comparison operators on
the version, make sure to invert the tests so that we stop parsing
if the test fails. Report and fix from Tom Tromey <tom@tromey.com>
1/19
----
Makefile.in
- pipesize.h: add dependency on ${BUILTINS_LIBRARY} to avoid parallel
makes trying to create it twice. Report and fix from
Richard Purdie <richard.purdie@linuxfoundation.org>
1/21
----
subst.c
- param_expand: if a nameref expands to array[@] or array[*], make sure
to call chk_atstar so the right variables are set to split the
result. Report from Oguz <oguzismailuysal@gmail.com>
1/22
----
builtins/declare.def
- Rewrote to reduce complexity. Still needs some work.
lib/readline/*.h, lib/tilde/tilde.h
- PARAMS: remove, rely on compilers understanding function prototypes
lib/readline/{undo.c,histlib.h}
- _hs_replace_history_data: move extern declaration to histlib.h
lib/readline/readline.c
- _rl_parse_colors: instead of an extern declaration for this, include
"parse-colors.h" for it
lib/readline/{histfile.c,histlib.h}
- _hs_append_history_line: move extern declaration to histlib.h
lib/readline/history.h
- HS_HISTORY_VERSION: define to 0x0801 (current library version) if
it's not already defined. We conditionally define it in case an
application has (unwisely) chosen to use it, since the history
library doesn't do anything with it yet
lib/readine/{rlprivate.h,{search,misc,readline}.c}
- _rl_free_history_entry: add extern declaration to rlprivate.h, remove
extern declaration from c source files. Use HS_HISTORY_VERSION as a
sentinel that it's ok to use HIST_ENTRY in rlprivate.h
lib/readline/{rlprivate.h,{isearch,search,undo}.c}
- _rl_saved_line_for_history: add extern declaration to rlprivate.h,
remove extern declaration from c source files, using HS_HISTORY_VERSION
in the same way
1/24
----
lib/readline/signals.c
- _rl_handle_signal: make sure that all sigprocmask calls are protected
by HAVE_POSIX_SIGNALS. Report and fix from Tom Tromey <tom@tromey.com>
1/26
----
lib/readline/callback.c
- rl_callback_read_char: make sure rl_linefunc is non-NULL before
calling through the pointer. The line function could have been
removed by the application before readline processes any typeahead
input. Bug reported by Matthias Klose <doko@debian.org>, pointer
to root cause from Koichi Murase <myoga.murase@gmail.com>
lib/glob/glob.c
- skipname,wskipname: put in some additional checks for `.' to ensure
that we don't get false positives (or incomplete tests) that can
affect the results of extglob patterns. Reported by
gregrwm <rhn-users@greatlakedata.com>
1/27
----
lib/glob/glob.c
- extglob_skipname,wextglob_skipname: fixed an off-by-one error (SE
was being set to one character before the end of the pattern string,
not the null character at the end of the pattern string like other
callers of glob_patscan) that caused the last character of the last
subpattern to be cut off when calling skipname
- extglob_skipname,wextglob_skipname: some cleanups so the code is
closer to identical for the single-byte and wide character versions
2/1
---
execute_cmd.c
- execute_simple_command: in posix mode, if we have a variable
assignment error while assigning into the temporary environment (e.g.,
assigning to a readonly variable), a non-interactive shell running a
special builtin exits; a non-interactive shell running anything else
jumps back to the top level. A shell compiled with -DSTRICT_POSIX
exits unconditionally.
- execute_simple_command: make sure posix mode sets $? to non-zero
if a variable assignment error occurs preceding a non-special builtin
subst.c
- do_assignment_statements: take the code from expand_word_list_internal
that performs assignment statements, either standalone or preceding
simple command names, and factor it out into this function
- expand_word_list_internal: call do_assignment_statements where
appropriate
2/2
---
lib/glob/glob.c
- dequote_pathname: fix function definition for non-multibyte systems.
Report and fix from Marc Aurèle La France <tsi@tuyoix.net>
Makefile.in,doc/Makefile.in
- for certain targets, remove files before creating them to deal with
symlinked build trees.
Report and fix from Marc Aurèle La France <tsi@tuyoix.net>
examples/loadables/accept.c
- include limits.h before typemax.h
Report and fix from Marc Aurèle La France <tsi@tuyoix.net>
builtins/gen-helpfiles.c
- if USING_BASH_MALLOC is defined, make sure to undefine malloc as well
as free. Fixes bug reported by George R Goffe <grgoffe@yahoo.com>
builtins/Makefile.in
- install-help: now depends on $(HELPFILES_TARGET) so we make sure the
separate helpfiles are created before we try to install them if we
don't go through the `all' makefile target
configure.ac
- HELPDIR: now ${datadir}/bash/helpfiles
2/3
---
parse.y
- parse_string_to_word_list: before expanding a compound assignment
statement body, make sure to save any alias that's currently being
expanded. Restore the alias after the compound assignment is parsed.
Reported back in 11/2020 by Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
2/4
---
lib/readline/histexpand.c
- history_expand_internal: when calling the history_inhibit_expansion
function, make sure to call it using the string as we've expanded it
to that point (RESULT), adding the expansion and next characters
temporarily, since we make expansion decisions based on what we've
accumulated, not what we started with. This makes things like
echo abc!$!$ work, where before the second `!' inhibited expansion
because bash_history_inhibit_expansion mistakenly took it as the
second character in a `$!' word expansion. Fixes bug reported back
in 10/2020 by Paul Fox <paul.d.fox@gmail.com>
array.h
- array_pop: instead of calling array_dispose_element from this macro,
just call array_shift with the AS_DISPOSE flag
2/5
---
bashhist.c
- shell_comment: move condition to return 0 if the delimiter stack is
not empty or the shell is parsing a here document into the function
itself, don't have the callers check so the check is in one place.
Fixes bug reported by Oguz <oguzismailuysal@gmail.com>
array.h,variables.c
- ARRAY_ELEMENT_REPLACE: convenience define for modifying an array
element's value
variables.c
- pop_args: a couple of code simplifications
2/7
---
lib/malloc/malloc.c
- pagesz: at least MALLOC_PAGESIZE_MIN (4096) bytes
- union mhead: now 16-byte aligned on all systems, 32-bit and 64-bit
pointers
- binsizes: since the smallest allocation overhead is now 16 bytes,
redo the buckets so binsizes[0] == 32; adjust the thresholds for
split/coalesce/prepopulate/mmap (NBUCKETS = 28; STARTBUCK = 0).
Sizes stay pretty much the same; indices change
- consistently use MALLOC_SIZE_T instead of long/unsigned int/int
- use MAGIC8_NUMBYTES as the length of the mh_magic8 buffer, in case
it changes later for alignment
- internal_remap: new function, calls mremap to reallocate a chunk of
memory allocated using mmap(); called from internal_realloc if the
old size and new size are both bigger than the mmap threshold
- internal_realloc: call internal_remap if the old size and new size
are both above the threshold where we use mmap for allocation
2/10
----
include/timer.h
- new file, declaration for a timer struct to be used by a set of
functions to implement timers using SIGALRM or select/pselect
lib/sh/timers.c
- new file, set of functions to manipulate timer objects and timeouts
using SIGALRM or select/pselect. Inspired by a patch from
Koichi Murase <myoga.murase@gmail.com>. Not used yet
2/11
----
builtins/read.def
- read_builtin: if there is a timeout set, block SIGCHLD around calls
to zread and its siblings, or calls to readline for `read -e', so
SIGCHLD (and the consequent waitpid) doesn't interrupt the read.
Fixes bug reported by Koichi Murase <myoga.murase@gmail.com>, but
there may be a different fix coming
Makefile.in,builtins/Makefile.in
- fix up dependencies, especially on builtins.h and builtext.h
2/12
----
lib/readline/input.c
- rl_read_key: if we set rl_done == 1, set RL_STATE_DONE as well
Reported by Koichi Murase <myoga.murase@gmail.com>
lib/readline/isearch.c
- _rl_search_getchar: only call _rl_read_mbstring if rl_read_key returns
>= 0, avoid some work
lib/readline/vi_mode.c
- _rl_vi_callback_change_char,_rl_vi_change_char: don't overwrite the
last replacement string if _rl_vi_callback_getchar returns -1.
It will likely make no difference, since the next read will return
an error or EOF, but being careful
- rl_vi_overstrike: if _rl_overwrite_char doesn't return 0, break out
of the loop
lib/readline/text.c
- _rl_overwrite_char: return 1 if _rl_read_mbstring returns < 0 so
we don't try to insert garbage
bashline.c
- posix_edit_macros: handle rl_read_key() returning <= 0
2/15
----
parse.y
- read_comsub: make sure to turn on the LEX_RESWDOK flag if we are in
a case statement and read a `)', since we can get a valid `esac'.
Fixes bug reported by Oguz <oguzismailuysal@gmail.com>
- read_comsub: if we're in a case statement, recognize `}' as a
reserved word and set the LEX_RESWDOK flag for the next word, since
we can get an esac (or another reserved word) after it
2/16
----
parse.y
- reserved_word_acceptable: add ARITH_CMD and COND_END to the list of
tokens that can precede a reserved word, so you can use reserved
words after ((...)) and [[...]].
Reported by Koichi Murase <myoga.murase@gmail.com>
2/17
----
parse.y
- parse_comsub: use new LEX_CASEWD flag to track when we are reading
the WORD in `case WORD in' and turn on the LEX_RESWDOK flag when
that word ends. This allows $(case x in esac), which no one uses.
- parse_comsub: use LEX_PATLIST flag to track when we are reading a
case pattern list so `|' doesn't turn on the LES_RESWDOK flag
- parse_comsub: case_level: simple counter to count the number of esacs
we need to see before we're no longer in a case statement; analog of
esacs_needed_count from the lexer
2/19
----
parse.y
- CHECK_FOR_RESERVED_WORD: don't return ESAC if we read `esac' after a
left paren in a case pattern list. From an austingroup-bugs discussion
about https://www.austingroupbugs.net/view.php?id=1454
- parse_comsub: if we read a `(' while looking for a case pattern list
and LEX_CKESAC is set, we have a leading left paren in the pattern
list and should turn off LEX_CKESAC so (esac) doesn't prematurely
terminate the case command. From an austingroup-bugs discussion
about https://www.austingroupbugs.net/view.php?id=1454
2/26
----
builtins/history.def
- history_builtin: when checking negative offsets to -d, which are
supposed to count back from the end of the history list, check the
range against 0 instead of history_base, because the calculation is
done against history_length, which is independent of history_base.
Report and fix from Christopher Gurnee <chris@gurneeconsulting.net>
2/28
----
doc/bashref.texi
- replaced a number of uses of @var with a mixture of @env and @dfn
to better match up with the texinfo standards
doc/{bash.1,bashref.texi}
- clarify some aspects of the coproc description, especially the
use of NAME and when it's optional
3/1
---
subst.c
- read_comsub: fix off-by-one error in mbrtowc that causes a read one
character past the end of buf. Report and fix from
Platon Pronko <platon7pronko@gmail.com> in
https://savannah.gnu.org/patch/?10035
3/3
---
builtins/ulimit.def
- ulimit_builtin: Posix compatibility: if the last command specified
by an option does not have an option argument, but there is an
operand remaining after all the options are parsed, treat the
operand as an argument to that last command. From an austin-group
discussion and a Geoff Clare suggestion back in November, 2020.
Austin Group interpretation 1418
examples/shellmath
- a package of shell functions to perform floating-point math entirely
in bash. Contributed by Michael Wood <mawood20@gmail.com>. Available
at https://github.com/clarity20/shellmath
3/4
---
support/shobj-conf
- darwin: take out the -arch-only option in SHOBJ_XLDFLAGS and
SHOBJ_ARCHFLAGS; no longer needed
doc/{bash.1,bashref.texi}
- coprocesses: suggested changes from rms@gnu.org; recommend the
`coproc NAME { commands; }' form as the simplest and most flexible
3/5
---
builtins/exec.def
- exec_builtin: set last_command_exit_value before calling exit_shell
so any exit trap gets the right value for $?. From Matthew Bauer
<mjbauer95@gmail.com> via https://savannah.gnu.org/patch/?10039
3/8
---
include/timer.h
- SHTIMER_ALRMSET: new flag, indicates that there is an active alarm
associated with this timer (falarm() was called)
lib/sh/timers.c
- shtimer_set: set the SHTIMER_ALRMSET flag after calling falarm
- shtimer_unset: don't call falarm(0,0) unless the SHTIMER_ALRMSET flag
is set
3/9
---
include/posixtime.h
- added some BSD convenience defines if they are not present
parse.y,shell.h
- {save,restore}_parser_state: save and restore shell_eof_token and
pushed_string_list; change callers (e.g., xparse_dolparen) so they
don't have to manage them
3/10
----
builtins/common.h
- extern declarations for moving to timers (sh_timer) for read builtin
timeouts
quit.h
- CHECK_ALRM: remove, no longer used
trap.c
- check_signals: call check_read_timeout instead of CHECK_ALRM
bashline.c
- bash_event_hook: use read_timeout instead of checking `sigalrm_seen';
that no longer exists
- bash_event_hook: accommodate readline timing out (not used yet)
lib/sh/zread.c
- zread: call read_builtin_timeout() to check for a timeout before
calling a blocking read()
builtins/read.def
- sigalrm,reset_timeout,check_read_timeout,read_builtin_timeout: new
and modified functions to use sh_timers for timeouts instead of
SIGALRM. Based on work contributed by Koichi Murase
<myoga.murase@gmail.com>
- read_builtin: use sh_timers for read timeouts (-t N) instead of
using SIGALRM
- edit_line: simulate receiving SIGALRM if readline times out (not
used yet)
3/11
----
lib/readline/readline.c
- rl_initialize: call _rl_timeout_init to set things up for any timeout
that was set with rl_set_timeout
- readline_internal_charloop: if we longjmped because of a timeout,
make sure to set rl_done/RL_STATE_DONE and return; we are
abandoning this call to readline(). The readline timeout changes
were based on work contributed by Koichi Murase
<myoga.murase@gmail.com>
lib/readline/readline.h
- extern declarations for new timeout functions and hook
- rl_clear_timeout: new define
lib/readline/callback.c
- rl_callback_read_char: if we longjmped because of a timeout,
make sure to set rl_done/RL_STATE_DONE and return; we are
abandoning this call to readline()
lib/readline/util.c
- _rl_abort_internal: if we time out, don't ring the bell; let the
caller handle it
lib/readline/input.c
- extern declarations for public and readline-library-private functions
and hooks to implement timeouts
- rl_set_timeout,rl_timeout_remaining: new public functions
- _rl_timeout_select: new function, uses select/pselect to implement
read timeouts that take timeouts set with rl_set_timeout into account;
calling hook function if a timeout occurs
- rl_gather_tyi, _rl_input_available: use _rl_timeout_select, taking
any existing timeout into consideration if it expires before the
timeout passed as an argument
- rl_getc: use _rl_timeout_select and handle any timeouts by calling
_rl_timehout_handle
- set_alarm,reset_alarm: new functions to implement timeouts using
SIGALRM for systems that lack a working select/pselect
- _rl_timeout_init: new function, sets things up for reading input
with a specified timeout
- _rl_timeout_handle: a timeout handler; calls any event hook and
sets up to abort the current readline() call
- _rl_timeout_handle_sigalrm: a timeout handler for systems using
SIGALRM to implement timeouts
lib/readline/parens.c
- rl_insert_close: use _rl_timeout_select to take timeouts into account
lib/readline/rlprivate.h
- extern declarations for readline-library-private timeout functions
lib/readline/rltty.c
- rl_deprep_terminal: don't print a newline after the bracketed paste
disable sequence if we timed out
lib/readline/signals.c
- _rl_handle_signal: if sig is SIGALRM, call _rl_timeout_handle_sigalrm()
lib/readline/doc/rltech.texi
- rl_set_timeout,rl_timeout_remaining: document new public functions
- RL_STATE_TIMEOUT: document new possible state value for rl_readline_state
- rl_timeout_event_hook: document new hook function, called when
readline times out
builtins/read.def
- read_builtin: changes to use the readline timeout functions to
implement timeouts with `read -e'; these use rl_set_timeout and
sh_timer structs together
3/12
----
subst.c
- expand_string_dollar_quote: new function, expands $'...' and $"..."
in a string for those code paths that don't expand it themselves
subst.h
- expand_string_dollar_quote: extern declaration
parse.y
- read_secondary_line: if $'...' or $"..." appears in the line, call
expand_string_dollar_quote to expand them. This now returns new
memory, need to change callers
make_cmd.c
- make_here_document: account for read_secondary_line returning newly
allocated memory, free `full_line' appropriately
bashline.c
- shell_expand_line,history_and_alias_expand_line: expand $'...' and
$"..." in the line by calling expand_string_dollar_quote, since
that happens after history expansion and before alias expansion in
normal processing
3/15
----
subst.c
- expand_string_dollar_quote: fix out-of-order initialization
Makefile.in
- {TAGS,tags}: add ETAGS/ETAGSFLAGS/CTAGS/CTAGS flags; make sure to
cd to the source directory before running them to get source files
that don't have absolute paths. Fix from Mike Jonkmans
<bashbug@jonkmans.nl>
parse.y
- xparse_dolparen: don't longjmp if FLAGS includes SX_NOLONGJMP. From
a report by Xu Lu <oliver_lew@outlook.com>
3/16
----
subst.c
- process_substitute: set startup_state and parse_and_execute_level
to see if we can avoid a fork()
bashline.c
- bash_spell_correct_word: bindable command (spell-correct-word) to
perform spelling correction on the current `shellword', using the
same code as the `cdspell' option and directory spelling correction
during completion. Feature suggested by in 10/2020 by
Karl Kleinpaste <karl@kleinpaste.org>
- bash_spell_correct_word: bound to "C-x s" by default in emacs mode
lib/readline/display.c
- rl_redisplay: fix redisplay problem that occurs when switching from
the rl-digit-argument prompt "(arg: N)" back to the regular prompt,
and the regular prompt contains invisible characters
doc/bash.1,lib/readline/doc/rluser.texi
- spell-correct-word: document new function and its default binding
3/17
----
doc/{bash.1,bashref.texi}
- cd: slight changes to specify that it sets PWD and OLDPWD
- {pushd,popd}: make it clear that these builtins use cd to change
the current working directory; change wording to simplify the
description and clarify the exit status
3/18
----
execute_cmd.c
- execute_disk_command: after performing redirections, call
unlink_all_fifos() to remove the FIFOs created as part of
expanding redirections. They should have been opened by then, and
we're going to call shell_execve right away anyway, so we won't be
around to remove the FIFOs. From a report from
Michael Felt <aixtools@gmail.com>
3/22
----
parse.y
- alias_expand_token: slight tweak to check for alias expansion: perform
expansion unconditionally if PST_ALEXPNEXT is set, and disable it
in case statement pattern lists if the previous token indicates a
command name is acceptable.
From a report by Oguz <oguzismailuysal@gmail.com>
config-bot.h
- HAVE_MKDTEMP: fix typo
3/25
----
lib/readline/terminal.c
- look in terminfo for key sequences for page up (kP) and page down
(kN) and bind them to history-search-{backward,forward},
respectively. From a patch from Xose Vazquez Perez
<xose.vazquez@gmail.com>
3/30
----
doc/bashref.texi
- expand the node describing $"..." string translation with additional
details and examples
3/31
----
misc.c
- rl_fetch_history: moved here from vi_mode.c
- rl_fetch_history: negative arguments count back from the end of
the history, instead of taking you to the beginning of the history
list
- rl_fetch_history: in vi mode, an out-of-range argument rings the
bell and doesn't change the line
vi_mode.c
- rl_vi_fetch_history: call rl_fetch_history
readline.h
- rl_fetch_history: new extern declaration
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- rl_fetch_history: add description
builtins/setattr.def
- show_var_attributes: if a variable's value indicates that it should
be ANSI-C quoted, use ansic_quote instead of sh_double_quote to
format the value string. From proposal by Greg Wooledge
<greg@wooledge.org>
4/5
---
arrayfunc.c
- unbind_array_element: if FLAGS includes VA_ONEWORD, don't use
skipsubscript to parse the subscript, just assume the entire SUB is
the subcript and that it contains the closing `]', so we just want
everything in SUB except the last character.
parse.y:
- select_command: use compound_list instead of list, like for_command.
Report by Greywolf <greywolf@starwolf.com>
- list: move this into compound_list (replacing the instance of `list'
in the compound_list production), remove from the grammar
4/6
---
arrayfunc.c
- unbind_array_element: use VA_NOEXPAND instead of literal 1
4/7
---
lib/readline/funmap.c
- default_funmap: add missing `vi-undo' to the list of vi-mode bindable
functions. Reported by Xirui Zhao <quinean@icloud.com>
4/8
---
config-top.h
- DEFAULT_LOADABLE_BUILTINS_PATH: default value for BASH_LOADABLES_PATH
doc/{bash.1,bashref.texi}
- enable: note that it uses $BASH_LOADABLES_PATH, and that the default
is system-dependent
variables.c
- initialize_shell_variables: initialize BASH_LOADABLES_PATH to the
default given in DEFAULT_LOADABLE_BUILTINS_PATH
4/12
----
doc/{bash.1,bashref.texi}
- add link to git master tar file as a place to get the current version
4/14
----
bashline.c
- attempt_shell_completion: use -1 as a sentinel value for
in_command_position indicating that we cannot be in a command position
(e.g., because we're the target of a redirection) and should not
check for a programmable command completion or tell the programmable
completion code to use command completion. Report and fix from
Marc Aurèle La France <tsi@tuyoix.net>
4/16
----
builtins/bind.def
- bind_builtin: reverse sense of strvec_search return value when
deciding whether or not to remove a unix-command binding from the
cmd keymap. Bug report by Dale Sedivec <dale@codefu.org>
lib/readline/doc/rltech.texi
- RL_PROMPT_{START,END}_IGNORE: document current values of \001 and
\002. Report from Mingye Wang <arthur200126@gmail.com>
4/19
----
arrayfunc.c
- assign_assoc_from_kvlist: fix memory leak reported by konsolebox
<konsolebox@gmail.com>
4/20
----
command.h,subst.c
- W_ITILDE: remove, replace with a variable since it's only used inside
a single call to expand_word_internal
4/21
----
{subst.c,make_cmd.c,parse.y}
- W_DQUOTE: no longer used, use W_NOPROCSUB and W_NOTILDE directly
(for arithmetic commands and words in arithmetic for commands)
4/24
----
bashline.c
- executable_completion: since this function gets an unquoted filename
from rl_filename_completion_function, we need to quote special
characters before passing it to bash_directory_completion_hook.
Report from Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
4/26
----
lib/readline/search.c
- _rl_nsearch_abort: move function calls around so _rl_restore_prompt
happens before rl_clear_message, like when aborting an incremental
search. Suggested by sparrowhawk996@gmail.com
subst.h
- ASS_ALLOWALLSUB: new assignment flag value, means to allow @ and * as
valid array subscripts when assigning to existing associative arrays
arrayfunc.c
- assign_array_element: allow assignment of key `@' to an existing
associative array if the caller passes ASS_ALLOWALLSUB
- assign_compound_array_list: allow ( [@]=value ) to an existing
associative array
builtins/declare.def
- declare_internal: allow assignment of key `@' to an existing
associative array by passing ASS_ALLOWALLSUB to assign_array_element
as part of local_aflags. This affects declare, local, and typeset
subst.c
- do_assignment_internal: allow a[@]=value to an existing associative
array by passing ASS_ALLOWALLSUB to assign_array_element
4/27
----
builtins/common.[ch]
- builtin_bind_var_to_int: wrapper for bind_var_to_int to be used by
builtin commands; placeholder for future work
builtins/wait.def
- builtin_bind_var_to_int: use instead of bind_var_to_int
builtins/common.c
- builtin_bind_variable: allow assignment of key `@' to an existing
associative array by passing ASS_ALLOWALLSUB to assign_array_element.
This affects printf and read
builtins/variables.[ch]
- bind_var_to_int: add third `flags' argument to pass to bind_variable
instead of always passing 0
redir.c,builtins/common.c,builtins/printf.def
- bind_var_to_int: change callers, add third flags argument
builtins/common.c
- builtin_bind_var_to_int: pass ASS_ALLOWALLSUB to bind_var_to_int so
builtins like wait can assign to assoc[@] and assoc[*]
4/28
----
bashline.c
- command_word_completion_function: make sure to initialize
old_glob_ignore_case before trying to restore from it
- command_word_completion_function: if we are completing a glob
pattern, make sure to set rl_filename_completion_desired, so we get
quoting and appending -- we are completing a filename, after all.
From a report from Manuel Boni <ziosombrero@gmail.com>
lib/readline/bind.c
- enable-active-region: separate control of the active region and
bracketed paste. Still set to the same default value as bracketed
paste, and enabling bracketed paste enables the active region.
Now you can enable bracketed paste and then turn off the active
region.
doc/bash.1,lib/readline/doc/{readline.3,rltech.texi}
- enable-active-region: document new bindable readline variable and
its effects
4/30
----
command.h
- W_ARRAYREF: new flag, meaning the word is a valid array reference
with subscript, replaces W_DOLLARSTAR, which was unused
subst.c
- expand_subscript_string,expand_array_subscript: new functions to
parse and expand-and-quote array subscripts. For future use
5/3
---
builtins/mapfile.def
- mapfile: if the delimiter is a newline, set unbuffered_read = 1
for any file descriptor that isn't seekable and lseek sets errno
to ESPIPE (pipes, FIFOs, maybe terminal devices). If it's not a
newline, only allow buffered reads if the file descriptor is a
regular file. Report from Koichi Murase <myoga.murase@gmail.com>
builtins/read.def
- read_builtin: only set unbuffered_read = 1 if the input is coming
from a pipe (which we can't seek on) or the input is a terminal and
we want to read a specified number of characters or we're using a
non-standard delimiter
5/4
---
builtins/mapfile.def
- mapfile: call zsyncfd before calling the callback. Suggested by
Koichi Murase <myoga.murase@gmail.com>; we'll see how it goes
5/5
---
subst.h
- expand_subscript_string: extern declaration
{arrayfunc,subst}.c
- expand_subscript_string: replace expand_assignment_string_to_string
with calls to this when expanding array subscripts
subst.c
- cond_expand_word: call expand_word_internal with Q_ARITH if `special'
says we should quote for an arithmetic expression context
- expand_word_internal: call expand_array_subscript when we see `[' in
arithmetic or array subscript contexts, make conditional on the
compatibility level later
- expand_word_internal: make sure W_ARRAYREF makes it through this
function and into the returned word
5/6
---
arrayfunc.c
- array_expand_index: call evalexp with a flag of 0 since we call
expand_arith_string with Q_ARITH and we want evalexp to remove
the quotes
execute_cmd.c
- eval_arith_for_expr,execute_arith_command: now that Q_ARITH has an
effect on array subscripts (it quotes the special expansion
characters), call evalexp with 0 as the flags arg so quote removal
is performed on this quoted argument. Make this conditional on the
shell compatibility level later
- execute_cond_command: make sure to expand the argument to -v by
calling cond_expand_node with Q_ARITH, and correspondingly turn off
assoc_expand_once when calling unary_test with that argument, since
we want it to be expanded again to remove the quotes
- execute_cond_command: expand the arguments to the arithmetic operators
with Q_ARITH and pass TEST_ARITHEXP to binary_test to ensure that
it lets evalexp expand the arguments to remove the quoting
test.c
- arithcomp: if TEST_ARITHEXP is in FLAGS, call evalexp with a flag
if 0 to force evalexp to expand the arguments to remove the quoting
subst.c
- param_expand: since we call expand_arith_string with Q_ARITH, we need
to call evalexp with 0 instead of EXP_EXPANDED for $((...)) expansion
- expand_word_internal: if we recursively call expand_word_internal to
expand the contents of a double-quoted string, make sure we pass
through Q_ARITH if it appears in QUOTED
- verify_substring_values: call expand_arith_string with Q_ARITH and
correspondingly call evalexp with 0 instead of EXP_EXPANDED
execute_cmd.c
- execute_cond_node: if -v is the operator, and the operand is a valid
array reference, pass TEST_ARRAYEXP flag to unary_test
5/7
---
builtins/common.[ch]
- set_expand_once: set array_expand_once to the value passed as the
first argument, returning the original value
builtins.h
- ARRAYREF_BUILTIN: new flag for shell builtins, means that the builtin
can take array references, with subscripts, as arguments
builtins/mkbuiltins.c
- set ARRAYREF_BUILTIN flag on builtins given in the arrayvar_builtins
array
execute_cmd.c
- execute_cond_node: use set_expand_once to set array_expand_once to 0
before calling unary_test with -v (see change from 5/6)
arrayfunc.c
- unbind_array_element: allow the caller to choose whether or not a
subscript of `*' or `@' unsets the entire array by passing
VA_ALLOWALL in FLAGS. Right now, since the unset builtin doesn't
pass VA_ALLOWALL, those subscripts unset individual elements for
associative arrays. We preserve the old behavior of unsetting
indexed arrays for the time being with new indexed-array-specific
code
5/9
---
builtins/shopt.def
- expand_once_flag: "assoc_expand_once" option now sets this flag,
calls set_assoc_expand on change
- set_assoc_expand: sets assoc_expand_once to mirror expand_once_flag;
placeholder for future changes
builtins/common.h
- expand_once_flag: extern declaration
5/10
----
doc/{bash.1,bashref.texi}
- note that case patterns undergo quote removal. Reported by
AlvinSeville7cf <alvinseville7cf@gmail.com>
5/11
----
builtins/bashgetopt.c
- list_optflags: flags associated with the word corresponding to
list_optarg, assuming list_optarg is a separate argument
builtins/bashgetopt.h
- list_optflags: extern declaration
builtins/set.def
- unset_builtin: set VFLAGS each time through the loop, since we take
whether or not the word has W_ARRAYREF set into account
- unset_builtin: don't pass VA_ALLOWALL to unbind_array_element for
now
test.c
- unary_test: in the -v case, use assoc_expand_once in the first call
to valid_array_reference ()
builtins/printf.def
- printf_builtin: only set VA_ONEWORD if the option argument to -v has
W_ARRAYREF set (look at list_optflags)
5/12
----
subst.c
- expand_array_subscript: don't quote @ or * in the expanded subscript
at all, even when they are the only character in the subscript. See
how this works out -- it might uncover places where we need to allow
`*' and `@' as subscripts where they are not allowed now
expr.c
- expr_bind_variable: pass ASS_ALLOWALLSUB to bind_int_variable so we
can allow (( A[@]=value )) when A is an existing associative array
arrayfunc.h
- AV_ATSTARKEYS: new flag value, means to accept a[@] and a[*] but
treat them as keys/expressions and not special values
arrayfunc.c
- array_value_internal: check AV_ATSTARKEYS and don't treat them as
ALL_ELEMENT_SUB values; they fall through to use as keys/indices
test.c
- unary_test: if -v is passed an array reference, add AV_ATSTARKEYS to
the flags passed to array_value so we treat @ and * as keys for an
existing associative array
5/13
----
subst.c
- expand_cond_word: if SPECIAL == 3 (arithmetic expression), dequote the
resulting WORD_LIST * as if special == 0, because we don't want to
quote the list for pattern matching. Report from
Adjudicator Darren <adjudicatordarren@protonmail.com>
5/14
----
subst.c
- expand_array_subscript: add double quote (") to the list of characters
that are backslash-quoted in subscripts after word expansion.
skipsubscript treats them specially, so you have to quote them to
do things like `key='"' ; array[$key]=1 ; [[ -v array[$key] ]]'
5/16
----
builtins/wait.def
- wait_builtin: if we longjmp to wait_intr_buf, call unset_waitlist if
we have called set_waitlist (wflags & JWAIT_WAITING). Fixes bug with
wait -n interrupted by a trapped signal (not SIGINT) reported by
Jonas Alfredsson <jonas.alfredsson@protonmail.com>
jobs.c
- wait_sigint_cleanup: restore the old sigint handler before we longjmp
out by calling restore_sigint_handler()
5/17
----
builtins/read.def
- bind_read_variable: now takes an additional argument, flags to pass
to builtin_bind_variable; change callers
- SET_VFLAGS: set vflags and bindflags
- read_builtin: call SET_VFLAGS to set vflags and bindflags from each
word before calling valid_array_reference and bind_read_variable
builtins/common.c
- builtin_bind_variable: set vflags (for valid_array_reference) and
bindflags (for bind_variable/assign_array_element) separately for
clarity
arrayfunc.c
- assign_array_element: sanity check: make sure that the subscript
returned by array_variable_name consumes the entire NAME, otherwise
flag it as a subscript error. This keeps things like
`KEY=' ]'; read assoc[$KEY] <<< hello' from assigning to incomplete
subscripts
builtins/printf.def
- printf_builtin: if LIST_OPTFLAGS includes W_ARRAYREF, set VA_NOEXPAND
in VFLAGS
5/17
----
lib/readline/complete.c
- compute_lcd_of_matches: move a couple of strlen calls out of a loop
in calls to mbrtowc; performance improvement only. Report and fix
from sparrowhawk996@gmail.com
lib/readline/bind.c
- rl_trim_arg_from_keyseq: take a key sequence and its length and
return the index into the key sequence following any initial numeric
argument. Return -1 if there is no numeric argument (the caller is
expected to make sure) or if the key sequence consists *only* of
the numeric argument. The caller should use the remainder of the
key sequence to look up the desired key binding.
lib/readline/readline.h
- rl_trim_arg_from_keyseq: extern declaration
bashline.c
- bash_execute_unix_command: if the argument count is > 1 or we have
an explicit argument, call rl_trim_arg_from_keyseq to get past the
numeric argument and deal with the rest of the key sequence. We still
need a way to pass it to the invoked program or function. From
a report from Jesper Nygards <jesper.nygards@gmail.com>
5/18
----
bashline.c
- bash_execute_unix_command: if the user supplied a numeric argument
when invoking bash_execute_unix_command, pass it to the command in
the READLINE_ARGUMENT variable
lib/readline/readline.[ch]
- _rl_del_executing_keyseq: convenience function to `delete' the last
character added to the executing key sequence. Intended to be used
before calling rl_execute_next or similar functions that push input
back to be re-read
doc/{bash.1,bashref.texi}
- READLINE_ARGUMENT: documented new variable available for commands
defined using `bind -x' keybindings
lib/readline/doc/rltech.texi
- rl_trim_arg_from_keyseq: documented new function
5/19
----
builtins/evalstring.c
- should_suppress_fork: suppress the fork if we're in a process
substitution subshell, in addition to being a simple command
without redirections. From a report back in 10/2020 from
Hyunho Cho <mug896@gmail.com>
bashline.c
- command_word_completion_function: if we're trying to complete an
absolute program (one containing a slash), don't run strcmp or
strcasecmp on the return value from rl_filename_completion_function,
since that duplicates work the filename completion function already
does. From a report back in 1/2021 by awa54@cdak.net
5/22
----
parse.y
- CHECK_FOR_RESERVED_WORD: if we are returning an ESAC and unsetting
PST_CASESTMT, decrement esacs_needed_count
parse.y,shell.h
- sh_parser_state_t: save and restore esacs_needed_count and
expecting_in_token in the shell parser state struct and
save_parser_state/restore_parser_state
print_cmd.c
- print_simple_command: don't bother to call command_print_word_list
with an empty list
- print_simple_command: don't print a space before a redirection list
if there weren't any command words to print
5/24
----
lib/sh/input_avail.c
- nchars_avail: make sure SET and OSET are declared on systems with
select(2). Reported by Larkin Nickle <me@larbob.org>
parse.y
- cond_term: if we read a `!' toggle CMD_INVERT_RETURN instead of
setting it unconditionally. Report and patch from
Vincent Menegaux <vincent.menegaux@gmail.com> via
https://savannah.gnu.org/patch/?10070
5/25
----
doc/{bash.1,bashref.texi}
- test: add the ( $2 $3 ) case to the description of the four-argument
behavior. Inspired by a discussion with Christoph Anton Mitterer
<calestyo@scientia.net>
5/27
----
doc/bashref.texi
- replace most of the GNU parallel section with a reference to the
tutorial on gnu.org
lib/glob/glob.h
- GX_NEGATE: new flag; indicates whether the pattern is being negated
as part of an extglob pattern. Not used yet
lib/glob/glob.c
- extglob_skipname,wextglob_skipname: pass GX_NEGATE to the skipname
functions if the pattern is being negated. Not checked yet
5/28
----
doc/{bash.1,bashref.texi}
- dotglob: add text to clarify that `.' and `..' have to be matched by
a pattern beginning with `.' or -- and this is the sketchy part --
that a pattern beginning with `.' has to be one of the patterns in
an extended glob expression
lib/glob/glob.c
- skipname,wskipname: perform the special checks for `.' only if the
pattern is not being negated
6/3
---
parse.y,shell.h
- eol_ungetc_lookahead: save and restore as part of the parser state
included in {save,restore}_parser_state
6/7
---
lib/readline/display.c
- puts_face: make sure to cast each member of STR to unsigned char, so
it's not misinterpreted as EOF, which putc_face does not display.
Report and fix from Volodymyr Prodan <vovcat@gmail.com> in
https://savannah.gnu.org/patch/?10076
examples/shobj-conf
- aix*gcc: change SHOBJ_LD to ${CC}, prefix the SHOBJ_LDFLAGS flags
with -Wl, so gcc will pass them to the linker. Report from
lehel@maxer.hu in https://savannah.gnu.org/support/?110505
6/11
----
doc/{bash.1,bashref.texi}
- cd: additional arguments are not ignored; they raise an error.
Report from Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
lib/glob/strmatch.h
- FNM_DOTDOT: enable special handling for `.' and `..': if FNM_PERIOD
is not set, `.' and `..' at the start of a string or as a pathname
component need to be matched by a `.' in the pattern and cannot be
matched by `?', `*', or a bracket expression
lib/glob/glob.c
- glob_vector: pass FNM_DOTDOT to strmatch() if noglob_dot_filenames
is not set to enable special handling of `.' and `..'. Prompted by a
discussion with Nora Platiel <nplatiel@gmx.us>
- skipname,wskipname: remove special checks for `.' and (disabled)
checks for `..'
lib/glob/sm_loop.c
- GMATCH: implement special handling for FNM_DOTDOT and `.' and `..':
make sure they can't be matched by any special glob characters at
the start of the string or as a pathname component (if FNM_PATHNAME
is set). This also means that !(pattern) won't return `.' or `..'
if dotglob is set
- GMATCH,EXTMATCH: don't pass FNM_DOTDOT down to recursive calls, like
FNM_PERIOD, once we process the first character in the string or
pathname component
lib/glob/smatch.c
- ISDIRSEP,PATHSEP,SDOT_OR_DOTDOT,PDOT_OR_DOTDOT: provide definitions
for single-byte or wide character strings for sm_loop.c to use
6/16
----
doc/{bash.1,bashref.texi},lib/readline/doc/{rluser,rltech}.texi
- slight wording changes to rewrite gender-specific language. From a
report by Vipul Kumar <kumar+bug-bash@onenetbeyond.org>, suggested
language from G. Branden Robinson <g.branden.robinson@gmail.com>,
Lawrence Velázquez <vq@larryv.me>,
and Andrew Church <achurch+bash@achurch.org>
builtins/fc.def
- fc_builtin: make sure an entry in the history list is non-null
before trying to write it to stdout or the temporary file. From a
report from Sibo Dong <sibo.dong@outlook.com>
builtins/common.[ch]
- builtin_arrayref_flags: given a WORD_DESC * (which includes flags)
and a base set of flags, return a set of flags to pass to
valid_array_reference and similar functions
builtins/set.def
- unset_builtin: call builtin_arrayref_flags to set vflags
6/19
----
parse.y
- parse_comsub: rewrite to recursively call the parser (yyparse()) and
return a string constructed from the resulting parse tree. Probably
will only work with bison. Error reporting is more accurate about
line numbers and invalid tokens, and command substitution errors
are caught earlier, before expansion
- DOLPAREN: new token, never created by yylex; only ever set by
parse_comsub and xparse_dolparen to indicate we're recursively
calling the parser for a command substitution
- comsub: new grammar production that's triggered by DOLPAREN and
parses a command substitution, returning a <command>. It's one of
the possible end states for the top-level parser
- grammar: only call rewind_input_string if the shell's input is
coming from a string
- shell_ungets: push a string back onto the shell input; only used by
make_here_document for backwards compatibility -- allowing a here-
document to be terminated by a token at the end of a command
substitution
- yylex: don't need any more special handling when returning
shell_eof_token, but we keep the clause for future work
- read_token_word: don't handle backslashes (leave them in the input
stream) if we are reading a command substitution (PST_NOEXPAND)
- reserved_word_acceptable: allow reserved words after DOLPAREN
- report_syntax_error: better error handling if we hit EOF while
looking for the ending right paren in a command substitution
- parse_string_to_word_list,parse_compound_assignment: make sure to
turn off parse_comsub sentinel temporarily
make_cmd.c
- make_here_document: backwards compatibility: if we end a here
document on the same line as the end of a command substitution,
allow the token to terminate the here document (without requiring
a newline) and push the remainder of the line back for the parser
to consume and terminate the command substitution
builtins/evalstring.c
- parse_string: if we read shell_eof_token and use it to terminate a
command, rewind the input string here before returning, instead of
guessing where to rewind it in the caller
6/22
----
redir.c
- do_redirection_internal: if VARASSIGN_REDIR_AUTOCLOSE is non-zero,
add a redirect to automatically close {var}<fn and other styles of
varassign redirection. It's zero by default
builtins/shopt.def
- varredir_close: new shell option, mirrors the value of
varassign_redir_autoclose. Suggested multiple times by multiple
people
doc/{bash.1,bashref.texi}
- varredir_close: document new shell option (the name is tentative)
6/24
----
parse.y
- yylex: if read_token returns a value < 0, return YYerror to the
parser
- parse_comsub: if the current_token is not shell_eof_token when
yyparse returns, return an error to read_token_word instead of
trying to keep parsing. Fixes interactive-only (?) bug reported by
Koichi Murase <myoga.murase@gmail.com>
parser.h
- PST_NOERROR: don't print error messages in yyerror(), just reset
the parser and return
parse.y
- yyerror: if parser_state & PST_NOERROR, don't print an error message
- xparse_dolparen: if the flags includes SX_COMPLETE, add PST_NOERROR
to parser_state, to inhibit error messages. Fixes bug with adding
lines with incomplete command substitutions to the history list
reported by Koichi Murase <myoga.murase@gmail.com>
subst.c
- skip_matched_pair: make sure to pass the SX_COMPLETE flag to
extract_delimited_string
6/28
----
lib/readline/bind.c
- rl_trim_arg_from_keyseq: handle rl_vi_arg_digit if VI_MODE is
defined. Report and fix from Koichi Murase <myoga.murase@gmail.com>
- rl_trim_arg_from_keyseq: rework to handle case where the digit
argument is given as a discrete sequence of multiple rl_digit_argument
commands (e.g, "M-1 M-2" instead of "M-1 2"). Report and fix from
Koichi Murase <myoga.murase@gmail.com>
subst.c
- pat_subst: avoid calling RESIZE_MALLOCED_BUFFER with STRLEN(s) as an
argument, since it ends up going into a loop. Report and fix from
Koichi Murase <myoga.murase@gmail.com>
lib/sh/casemod.c
- cval: take the string length as an argument, to avoid having to call
strlen every time (in HANDLE_MULTIBYTE mode). The caller already has
this info. Report and fix from Koichi Murase <myoga.murase@gmail.com>
builtins/complete.def
- print_cmd_name: single-quote the command name if it contains any
shell metacharacters
- print_one_completion: call print_arg with a second arg of 1 if the
function name contains shell metacharacters. Report and fix from
Koichi Murase <myoga.murase@gmail.com>
6/30
----
configure.ac
- substitute BASE_CFLAGS_FOR_BUILD and STYLE_CFLAGS into Makefile
targets
- take STYLE_CFLAGS out of the CFLAGS_FOR_BUILD variable that gets
substituted
- remove STYLE_CFLAGS from CFLAGS
- use `:+' expansion to set variables based on whether $GCC is set
or null, since configure can do GCC=
support/Makefile.in
- man2html: remove CCFLAGS_FOR_BUILD from the recipe, leaving only
LDFLAGS_FOR_BUILD. Report from Jay K <jayk123@hotmail.com>
- gen-helpfiles: remove CCFLAGS_FOR_BUILD from the recipe, leaving
only LDFLAGS_FOR_BUILD
- man2html: use $(STYLE_CFLAGS) in BASE_CCFLAGS variable for C file
compilation options
{,builtins}/Makefile.in, lib/{sh,readline,malloc,glob}/Makefile.in
- use STYLE_CFLAGS so specifying CFLAGS=-g to make doesn't clutter the
output with warnings about parens and format strings
7/9
---
lib/readline/search.c
- make_history_line_current: call _rl_free_saved_history_line to clean
up _rl_saved_line_from_history and get all the code that frees it
into one place
lib/readline/misc.c
- _rl_free_saved_history_line: if rl_undo_list points to the data
member of _rl_saved_line_from_history, set it to NULL to avoid having
it point to freed memory, since the next thing we do now is to free
the undo list the data member points to
- _rl_start_using_history: call _rl_free_saved_history_line instead of
calling _rl_free_history_entry directly. Fixes memory leak reported
by Trung Dam <trungdam@yahoo.com>
7/12
----
lib/readline/search.c
- make_history_line_current: free rl_undo_list before replacing the
current line with the line from history, since it is a private
undo list from reading the search string
lib/readline/rlmbutil.h
- Since wchar_t/mbrtowc/wcrtomb are limited to 16 bits on Windows
with MSVC, start abstracting the differences using WCHAR_T/
MBRTOWC/WCRTOMB
7/13
----
lib/readline/{complete,display,input,text,util,vi_mode}.c
- use WCHAR_T/MBRTOWC/WCRTOMB. Part of a set of Windows MSVC fixes
from sparrowhawk996@gmail.com
builtins/{enable,hash,help}.def
- enable_builtin: use sh_chkwrite after output to check for write errors
7/16
----
arrayfunc.c
- quote_compound_array_word: free SUB and VALUE after assigning from
sh_single_quote(). From a coverity report from
Siteshwar Vashisht <svashisht@redhat.com>
bashhist.c
- bash_remove_history_range: free DISCARD_LIST after freeing its
elements
bashline.c
- bash_directory_expansion: add code to free D as a separate branch,
though it's never hit in practice
builtins/trap.def
- showtrap: free T even if show_default == 1 if it's a non-default
trap string
7/17
----
execute_cmd.c
- execute_coproc: free NAME on invalid identifier error
lib/glob/glob.c
- glob_vector: make sure NEXTLINK is allocated using malloc before
passing it to free()
- glob_filename: free RESULT before returning glob_error_return when
there is only a filename
print_cmd.c
- indirection_level_string: make sure we free PS4 after calling
decode_prompt_string if *ps4 == 0
subst.c
- parameter_brace_transform: if vtype == VT_VARIABLE, we need to free
a non-null VAL
variables.c
- assign_in_env: if NAME is not a valid shell identifier, free it
after printing the error message and before returning. These are
the rest of the fixes from Siteshwar Vashisht <svashisht@redhat.com>
7/22
----
shell.c
- main: set dollar_vars[0] to shell_script_filename before calling
run_startup_files() in the non-interactive case. Restore it after
run_startup_files returns so we can get better error messages if
we can't open a script file. Suggested by several people, originally
by Marc Aurèle La France <tsi@tuyoix.net> back in 2/2021 (in a
different form) and most recently by Tapani Tarvainen
<bash@tapanitarvainen.fi>
7/28
----
trap.c
- any_signals_trapped: return that a signal is trapped only if it's
not ignored. This is an additional opportunity for optimization,
reported in https://bugzilla.redhat.com/show_bug.cgi?id=1981926
7/30
----
examples/loadables/sleep.c
- main: if the uconvert conversion fails, but the argument appears to
contain a GNU-like interval specifier like "1m30s", return
EX_DISKFALLBACK so the execute_builtin code tries to run the
external version
builtins/enable.def
- enable_shell_builtin: if the builtin isn't found, return EX_NOTFOUND
to allow the caller (enable_builtin) to react differently if it
wants to
- dyn_load_builtin: if the shared object isn't found, return EX_NOTFOUND,
change enable_builtin to deal with it
- enable_builtin: if there are no supplied options, and we attempt to
enable a non-existent builtin, try modifying `enable name' to the
equivalent of `enable -f name name' and return success if we
successfully load a builtin from a shared object. Proposed several
times, most recently by Robert Elz <kre@munnari.OZ.AU>
doc/{bash.1,bashref.texi}
- enable: document new behavior of `enable NAME' when NAME is not a
current shell builtin
8/3
---
lib/glob/sm_loop.c
- GMATCH: check for interrupts or terminating signals each time through
the loop and return FNM_NOMATCH immediately if received. Let the
higher layers deal with interrupting the match and jumping out.
Inspired by a report from andrej@podzimek.org
8/6
---
subst.c
- {parameter_brace_remove_pattern,parameter_brace_transform,
parameter_brace_substring,parameter_brace_casemod,
parameter_brace_patsub}: make sure the IND argument is of type
arrayind_t to handle the full range of subscripts. Reported by
felix@f-hauri.ch
builtins/printf.def
- printf_builtin: take new format specifier: %Q. This acts like %q
but applies any supplied precision to the original unquoted
argument, then quotes that result and outputs the entire quoted
string, preserving the original field width. Originally suggested
back in 4/2020 by Sam Liddicott <sam@liddicott.com>
subst.c
- char_is_quoted: check whether or not we are on the second or later
line of a command with an unclosed quoted string from a previous
line. If we are, see if it's closed before the character we're
checking, so we don't interpret a closing quote as starting a new
quoted string. Reported several times, most recently by
Phi Debian <phi.debian@gmail.com> in 6/2021.
8/9
---
parse.y,subst.c
- locale_expand: if the variable SINGLEQUOTE_TRANSLATIONS is non-zero,
single-quote the translated result of $"..." (if it's different from
the untranslated string)
builtins/shopt.def
- noexpand_translation: new option to expose the value of
SINGLEQUOTE_TRANSLATIONS
8/10
----
doc/{bash.1,bashref.texi}
- noexpand_translation: add description of new option
8/16
----
builtins/printf.def
- printf_builtin: initialize retval after parsing arguments, since we
use it for the `v' option. Bug report from Keith Thompson
<Keith.S.Thompson@gmail.com>
lib/sh/unicode.c
- u32tocesc: fix typo that returned \uXXXXXXXX instead of \UXXXXXXXX.
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992257 by
<nabijaczleweli@nabijaczleweli.xyz>
8/17
----
siglist.c
- include command.h before general.h for PARAMS and prototypes. Report
from Osipov, Michael (LDA IT PLM) <michael.osipov@siemens.com>
8/18
----
lib/readline/colors.c
- S_ISBLK: make sure it's defined before we use it, like in complete.c
lib/readline/complete.c,{bashline,variables}.c
- minor changes to prep for making rl_completer_word_break_characters
`const'
subst.[ch],pcomplete.c
- split_at_delims: the DELIMS argument is now `const'; change callers
lib/readline/rlmbutil.h
- _rl_wcwidth: add function prototype for inline function declaration
lib/readline/bind.c
- _rl_get_keyname: print keys greater than 160 (which are valid UTF-8)
as octal escape sequences
lib/readline/text.c
- do_lowercase_version: return 99999 to prevent the linker from
combining it with _rl_null_function and optimizing away the separate
copy. That messes with function pointer comparisons. Part of this
batch of fixes from sparrowhawk996@gmail.com
8/19
----
complete.c,readline.c,readline.h
- rl_completer_word_break_characters: now const char * like
rl_basic_word_break_characters; element of readline state struct
used to save it also const. THIS IS AN API CHANGE
bashline.c
- orig_rl_completer_word_break_characters: now const char * like
rl_completer_word_break_characters
8/20
----
bashline.c
- bash_directory_completion_hook: if direxpand and dirspell are both
set while trying to complete an absolute pathname as a command, don't
take a spell-corrected directory name that is shorter than the
original hint. https://bugzilla.redhat.com/show_bug.cgi?id=1782809
builtins/common.[ch]
- sh_noassign: convenience function to print an error message when a
user attempts an assignment to a "noassign" variable. Not used yet
assoc.[ch]
- assoc_to_kvpair_list: new function, returns a WORD_LIST containing
key-value pairs as separate words
array.[ch]
- array_to_kvpair_list: new function, returns a WORD_LIST containing
index-value pairs as separate words
subst.c
- string_transform: handle '@k' transform like '@K'
- valid_parameter_transform: 'k' is a valid transform operator
- array_transform: handle '@k' transformation by calling one of
array_to_kvpair_list or assoc_to_kvpair_list and treating the
result as if expanding the array depending on whether the index is
`@' or `*' with the usual meanings
doc/{bash.1,bashref.texi}
- document new '@k' parameter transformation operator
8/27
----
lib/readline/kill.c
- rl_unix_filename_rubout: handle pathnames that consist only of one
or more slashes. The old code went too far and deleted the previous
word as well. From dabe@dabe.com
8/31
----
parse.y
- STRING_SAVER: now save and restore shell_input_line_len; not sure
why it wasn't done before; fix push_string and pop_string accordingly
- prompt_again: now takes a parameter FORCE; not used yet (every
caller passes 0), needs more thought
builtins/evalstring.h
- open_redir_file: broke code that expands the redirection and opens
the resultant filename into a new function, called from cat_file
redir.h
- open_redir_file: extern declaration here for now
builtins/evalstring.c
- parse_string: takes a new argument: COMMAND **cmdp; if non-null, saves
the parsed command to *cmdp and lets the caller manage it itself.
global_command is still not modified. Changed callers in parse.y
9/1
---
parse.y
- parse_string_to_command: stripped-down version of xparse_dolparen
that takes a string, runs it through the parser, and returns the
resultant COMMAND *; uses parse_string with the new argument
externs.h
- parse_string_to_command: extern declaration
builtins/evalstring.c
- can_optimize_cat_file: new function, takes a COMMAND * argument and
returns true if the command can be optimized like $(<file); changed
parse_and_execute to call it
subst.c
- optimize_cat_file: new function, optimizes $(<file) without creating
a new process. Uses redir_open to open the redirection file, after
expansion, and calls read_comsub to read from it directly
- read_comsub: now reads into a 4096 byte buffer (COMSUB_PIPEBUF)
- command_substitute: if the string begins with a `<' and isn't followed
by any of "<>&", see if we can optimize the command and call
optimize_cat_file to do it if we can.
9/2
---
configure.ac,config.h.in,lib/sh/setlinebuf.c
- SETVBUF_REVERSED: remove all references
configure.ac,aclocal.m4
- AC_OUTPUT: move created files and commands to AC_CONFIG_FILES and
AC_CONFIG_COMMANDS; call AC_OUTPUT without any arguments
- require autoconf version 2.63
- AC_HELP_STRING -> AS_HELP_STRING
- replace references to $ac_cv_prog_gcc with $GCC
- AC_C_LONG_DOUBLE -> AC_TYPE_LONG_DOUBLE
- enable-alt-array-implementation: new configure option, placeholder
for later
unwind_prot.c
- stddef.h: include if HAVE_STDDEF_H is defined, not STDC_HEADERS
bashansi.h
- memory.h: don't include any more; assume <string.h> has all the
necessary defines
aclocal.m4
- AC_HEADER_STDC: remove AC_REQUIRE calls to this; change tests to use
appropriate checks instead of STDC_HEADERS
9/3
---
configure.ac,config.h.in
- AC_TYPE_SIGNAL,BASH_TYPE_SIGHANDLER: remove calls, remove mention of
RETSIGTYPE and VOID_SIGHANDLER
- AC_USE_SYSTEM_EXTENSIONS: use this instead of AC_ISC_POSIX (which is
well and truly obsolete) and AC_MINIX (which just calls it anyway).
All the right defines are already present
- AC_HEADER_TIME: removed
- AC_HEADER_STDC: removed
- AC_DECL_SYS_SIGLIST: replaced with BASH_DECL_SYS_SIGLIST
- BASH_FUNC_CTYPE_NONASCII: removed
sig.h,lib/readline/signals.c
- RETSIGTYPE -> void, SIGHANDLER_RETURN -> return
include/posixtime.h
- don't bother with TIME_WITH_SYS_TIME, just include <sys/times.h> if
we have it and include <time.h> unconditionally
include/chartypes.h,lib/readline/chardefs.h
- IN_CTYPE_DOMAIN: no longer uses STDC_HEADERS define, checks against
CHAR_MAX for non-C89 systems, still a no-op on C89 systems
lib/readline/chardefs.h
- memory.h: don't include, no need for STDC_HEADERS; assume the mem*
functions are defined in <string.h> as in C89
- now that we assume IN_CTYPE_DOMAIN bounds its argument to unsigned
chars, we don't need NON_NEGATIVE checks at all
lib/readline/chardefs.h,util.c
- ALPHABETIC -> _rl_alphabetic_p
9/8
---
lib/sh/strftime.c
- include <posixtime.h> after reworking above; include <sys/types.h>
unconditionally in case it defines time_t. From a report by
Ori Sky Farrell <bash@ori.mx>
9/9
---
lib/readline/search.c
- rl_history_search_internal: set rl_undo_list to NULL after calling
rl_maybe_save_line, since it will be restored one way or another
after the search completes, and we don't want it to be freed twice
- rl_history_search_internal: leave the current history offset at the
position of the last matching history entry. This means that things
like ^P will start back from that history entry, ^N will move
forward from there, and operate-and-get-next will work like it does
with incremental searches. Reported by Vandrus Zoltán
<vandrus.zoltan@gmail.com>
9/10
----
aclocal.m4
- BASH_C_LONG_LONG: removed
- BASH_TYPE_LONG_DOUBLE: removed
- BASH_TYPE_LONG_LONG,BASH_TYPE_UNSIGNED_LONG_LONG: removed
- BASH_FUNC_CTYPE_NONASCII: removed
- BASH_SYS_SIGNAL_VINTAGE,BASH_SYS_REINSTALL_SIGHANDLERS: don't
require AC_TYPE_SIGNAL, use void instead of RETSIGTYPE
- BASH_TYPE_SIGHANDLER: removed
configure.ac,aclocal.m4,config.h.in
- BASH_TYPE_LONG_LONG: removed, call AC_TYPE_LONG_LONG_INT directly,
change #define to HAVE_LONG_LONG_INT
- BASH_TYPE_UNSIGNED_LONG_LONG: removed, call AC_TYPE_UNSIGNED_LONG_LONG_INT
directly, change #define to HAVE_UNSIGNED_LONG_LONG_INT
externs.h,include/typemax.h,lib/sh/{fmtullong,snprintf,strtoimax,strtoll,
strtoull,strtoumax}.c
- HAVE_LONG_LONG -> HAVE_LONG_LONG_INT
- HAVE_UNSIGNED_LONG_LONG -> HAVE_UNSIGNED_LONG_LONG_INT
configure.ac
- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- BASH_CHECK_TYPE (intmax_t) -> AC_TYPE_INTMAX_T
- BASH_CHECK_TYPE (uintmax_t) -> AC_TYPE_UINTMAX_T
- BASH_CHECK_TYPE (sig_atomic_t): removed
aclocal.m4
- BASH_FUNC_STRSIGNAL: changed to use AC_LINK_IFELSE
- BASH_FUNC_LSTAT: changed to use AC_LINK_IFELSE
- BASH_FUNC_SBRK: changed to use AC_LINK_IFELSE and AC_RUN_IFELSE,
fixed typo
- BASH_CHECK_SPEED_T: changed to use AC_COMPILE_IFELSE
- BASH_TYPE_SIG_ATOMIC_T: use BASH_CHECK_TYPE instead of AC_CHECK_TYPE
- BASH_STRUCT_DIRENT: new macro, like _AC_STRUCT_DIRENT but public and
sets a different bash-specific shell variable
- BASH_STRUCT_DIRENT_D_{INO,FILENO,NAMLEN}: call BASH_STRUCT_DIRENT
with a different first argument instead of using inline code and
AC_TRY_COMPILE
9/11
----
[prayers for the victims of 9/11/2001]
aclocal.m4
- BASH_CHECK_DECL: just call AC_CHECK_DECLS and use the default
includes, which includes the files we used to specify
- BASH_FUNC_INET_ATON: changed to use AC_LINK_IFELSE
- BASH_STRUCT_WEXITSTATUS_OFFSET: changed to use AC_RUN_IFELSE
- BASH_FUNC_OPENDIR_CHECK: changed to use AC_RUN_IFELSE
- BASH_FUNC_ULIMIT_MAXFDS: changed to use AC_RUN_IFELSE
- BASH_UNDER_SYS_SIGLIST: changed to use AC_RUN_IFELSE
- BASH_SYS_SIGLIST: changed to use AC_RUN_IFELSE
- BASH_FUNC_DUP2_CLOEXEC_CHECK: changed to use AC_RUN_IFELSE
- BASH_FUNC_GETENV: changed to use AC_RUN_IFELSE
- BASH_FUNC_GETCWD: changed to use AC_RUN_IFELSE
- BASH_FUNC_FNMATCH_EXTMATCH: changed to use AC_RUN_IFELSE
- BASH_FUNC_POSIX_SETJMP: changed to use AC_RUN_IFELSE
- BASH_FUNC_STRCOLL: changed to use AC_RUN_IFELSE
- BASH_FUNC_PRINTF_A_FORMAT: changed to use AC_RUN_IFELSE
- BASH_SYS_PGRP_SYNC: changed to use AC_RUN_IFELSE
- BASH_SYS_SIGNAL_VINTAGE: changed to use AC_RUN_IFELSE
- BASH_SYS_NAMED_PIPES: changed to use AC_RUN_IFELSE
- BASH_CHECK_RTSIGS: changed to use AC_RUN_IFELSE
- BASH_CHECK_MULTIBYTE: changed to use AC_RUN_IFELSE
- RL_LIB_READLINE_VERSION: changed to use AC_RUN_IFELSE
- BASH_CHECK_WCONTINUED: changed to use AC_RUN_IFELSE
- BASH_FUNC_SNPRINTF: changed to use AC_RUN_IFELSE
- BASH_FUNC_VSNPRINTF: changed to use AC_RUN_IFELSE
- BASH_FUNC_FNMATCH_EQUIV_FALLBACK: changed to use AC_RUN_IFELSE
- BASH_DECL_PRINTF: changed to use AC_RUN_IFELSE
- BASH_TYPE_RLIMIT: rewrote to avoid quad_t, now uses AC_COMPILE_IFELSE
to determine whether rlim_t is available, otherwise determines the
value of RLIMTYPE based on sizeof(rlim.rlim_cur): int, long, or
long long
- BASH_SIZEOF_RLIMIT,BASH_SIZEOF_QUAD_T: helper macros for
BASH_TYPE_RLIMIT in the case that rlim_t is not present
configure.ac
- BASH_CHECK_DECL -> AC_CHECK_DECLS
- quad_t: use AC_CHECK_TYPE (new style) instead of BASH_CHECK_TYPE
9/14
----
execute_cmd.c
- time_command: if we longjmp back to the top_level we saved, make sure
we're in the same subshell environment before printing the timing
stats. We could have longjmped back from a child process of the
command or pipeline we want to time. From a report by
Sergej Alikov <sergej@alikov.com>
- time_command: restore command->flags even if we longjmp back
general.c
- check_binary_file: if the first line of the ENOEXEC file starts with
a `#!', check the rest of the buffer for NULs to determine whether
this is a binary file. Since we only check the first line, a #! line
followed by binary data could be confused for a shell script
9/16
----
bashjmp.h
- EXITBLTIN: new longjmp `code' value: used by the exit builtin
{execute_cmd,shell,subst,trap}.c,builtins/evalstring.c
- treat EXITBLTIN exactly the same as EXITPROG (for now)
builtins/exit.def
- exit_builtin: jump_to_top_level with value EXITBLTIN
builtins/evalstring.c
- parse_and_execute: EXITBLTIN has its own case, with the same contents
as EXITPROG
9/17
----
builtins/evalstring.c
- parse_and_execute: change EXITBLTIN case to avoid running the
unwind-protect stack to the `pe_dispose' tag (which has the effect
of running all the unwind-protects installed by the commands in
the string) if we're executing in a function and EXIT is trapped.
This has the effect of running the EXIT trap in the function context,
which is what we do when we're not in parse_and_execute (eval,
bash -c, command substitution, etc.)
9/18
----
arrayfunc.c
- expand_and_quote_kvpair_word,quote_compound_array_word,
expand_and_quote_assoc_word,quote_compound_array_list: make sure
the value has CTLESC characters doubled even when being single-
quoted, since that's what the parser does with standalone assignment
statements. From https://savannah.gnu.org/support/?110538
9/19
----
aclocal.m4
- AC_TRY_COMPILE -> AC_COMPILE_IFELSE (AC_TRY_LINK calls left to
modify to avoid obsolete warnings)
- BASH_STRUCT_WINSIZE: broke out checks for separate headers into new
macros, call them and work with the results; needed to avoid two
calls to AC_TRY_COMPILE
- BASH_CHECK_KERNEL_RLIMIT: avoid multiple calls to AC_TRY_COMPILE by
breaking basic test for RLIMIT_ defines into a separate test and
calling the HPUX-specific _KERNEL test only if that fails
m4/gettext.m4,configure.ac
- AM_GNU_GETTEXT -> BASH_GNU_GETTEXT: remove deprecation warning, since
[no-libtool] is how we use this; rename to avoid someone's local
copy from overriding ours
9/20
----
aclocal.m4
- BASH_CHECK_MULTIBYTE: take out code that checks for nl_langinfo(CODESET)
since that's already provided by AM_LANGINFO_CODESET, which is
called by BASH_GNU_GETTEXT. We AC_REQUIRE it here, though, to avoid
problems from future changes
- BASH_SYS_SIGNAL_VINTAGE: broke the code that checks for the different
signal vintages into different AC_DEFUNed macros, changed
BASH_SYS_SIGNAL_VINTAGE to stitch them together with shell code
testing the cached variables
- AC_TRY_LINK -> AC_LINK_IFELSE: there are no more autoconf warnings
9/21
----
array.[ch]
- array_from_argv: new convenience function
array.h
- num_elements: now an arrayind_t, since that's the type of indices, it
makes sense to allow that many elements
9/22
----
lib/readline/terminal.c
- rl_term_kP: fix typo. Fix from Koichi Murase <myoga.murase@gmail.com>
9/25
----
lib/readline/display.c
- rl_clear_visible_line: call _rl_clear_to_eol with _rl_screenwidth as
the argument so we clear out the entire line even if the terminal
doesn't have a clear-to-eol sequence; make sure to add a call to
rl_cr after that so we know we're always in column 0
- _rl_redisplay_after_sigwinch: just call rl_clear_visible_line instead
of erasing the last line of the display
- _rl_redisplay_after_sigwinch: if the prompt is longer than the screen
width, make sure to call _rl_reset_prompt to recalculate the
local_prompt_newlines array. Should fix issue from
https://savannah.gnu.org/support/index.php?110543
redir.c
- do_redirection_internal: if given [N]<&WORD- or [N]>&WORD- and WORD
expands to null, make it identical to <&- or >&- and close file
descriptor N (default 0). From a discussion back in 5/2021
9/27
----
arrayfunc.c
- expand_compound_array_assignment: since we run the string through
the parser to turn it into a list (so we can make sure all shell
metacharacters are properly quoted), we need to remove the CTLESC
the parser uses to quote CTLESC and CTLNUL in *unquoted* words.
The rest of the code assumes this has been done, and assumes that
any CTLESC characters passed to expansion are part of the original
word and should themselves be quoted, doubling the number of CTLESCs
9/28
----
arrayfunc.c
- expand_and_quote_kvpair_word,quote_compound_array_word,
expand_and_quote_assoc_word,quote_compound_array_list: if we are
single-quoting associative array subscripts and associative and
indexed array values, we need to quote CTLESC characters, because
that's how they come out of the parser and how the assignment
statement code expects to see them.
Fixes https://savannah.gnu.org/support/index.php?110538
9/29
----
subst.c
- parameter_brace_transform: invalid transformation operators are now
fatal errors in non-interactive shells, as with the other word
expansions. Reported by Martin Schulte <gnu@schrader-schulte.de> in
https://lists.gnu.org/archive/html/bug-bash/2020-10/msg00026.html
execute_cmd.c
- execute_disk_command: if we're optimizing out the fork (nofork) and
not directly in a pipeline (pipe_in == pipe_out == NO_PIPE), only
modify shell_level if subshell_environment says we're not already in
a pipeline. Reported by Paul Smith <psmith@gnu.org> 10/11/2020
against GNU make
evalstring.c
- should_suppress_fork: remove #if 1 for code that tries to suppress
the fork in a process substitution subshell
9/30
----
builtins/mapfile.def
- do_chop: make sure we're comparing unsigned chars when checking
whether the delim is the last character on the line. Reported by
Greg Wooledge <greg@wooledge.org>
10/1
----
lib/readline/rltty.c
- rl_deprep_terminal: if we're not echoing to the terminal
(_rl_echoing_p == 0), and we just output the bracketed paste end
sequence, output a newline to compensate for the \r at the end of
BRACK_PASTE_FINI, since redisplay didn't do it for us. Reported by
Siteshwar Vashisht <svashisht@redhat.com>
shell.h
- MATCH_EXPREP: new matching flag, understood only by pattern
substitution; means to expand unquoted `&' in the replacement
STRING to the match of PATTERN
subst.c
- shouldexp_replacement: uncommented
- pat_subst: we expand & in the replacement string if MATCH_EXPREP
appears in MFLAGS
- parameter_brace_patsub: push call to shouldexp_replacement out here,
after the replacement string is expanded; set MATCH_EXPREP if there
is an unquoted `&' (by backslash) in the expanded replacement
string
doc/{bash.1,bashref.texi}
- pattern substitution: overhauled the description, moved each of the
possible forms to be tags in the tagged paragraph. The description
now specifies the expansions that the replacement string undergoes
- pattern substitution: documented new behavior of unquoted & in the
replacement string
10/4
----
shell.c
- include <malloc/shmalloc.h> if we're debugging malloc (MALLOC_DEBUG)
so we can get an extern declaration of trace_malloc_stats
10/5
----
subst.c
- expand_subscript_string: allocate new memory for td.word, copying
STRING, in case it gets freed on error by expand_word_internal.
Report and fix from Koichi Murase <myoga.murase@gmail.com>
lib/malloc/malloc.c
- malloc_usable_size: return the allocated size instead of the chunk
size, since writing over the bounds checking will cause fatal errors.
Reported by Julien Moutinho <julm+bash@sourcephile.fr>, fix from
Dominique Martinet <asmadeus@codewreck.org>
arrayfunc.c
- unbind_array_elememnt: pass (flags&VA_NOEXPAND) to skipsubscript(),
instead of unconditionally passing 1 if we're operating on an
associative array. This is consistent with how valid_array_reference
determines the length of the subscript.
Report and fix from Koichi Murase <myoga.murase@gmail.com>
10/6
----
subst.c
- skip_to_delim: add a new value for FLAGS. If FLAGS&2, we assume that
START is one character after the opening OPEN. If not, we assume that
START is at OPEN, and needs to be incremented past it. Part of fix
from Koichi Murase <myoga.murase@gmail.com>
arrayfunc.c
- unbind_array_element: make sure to pass FLAGS to skipsubscript with
bit 2 set, since we are passed a SUB index that's one past the
opening bracket. Rest of fix from
Koichi Murase <myoga.murase@gmail.com>
- array_variable_name: make sure we pass (FLAGS&1) to skipsubscript, so
we don't inadvertently pass a value with bit 2 set, which would
cause an off-by-one error in subscript parsing
10/8
----
trap.c
- restore_traps: inverse of reset_signal_handlers. This understands
how reset_signal_handlers changes the signal disposition while
leaving the trap string in place, and knows how to restore flags
and state based on that preserved trap string and whether or not
the signal is "special" to the shell.
builtins/exec.def
- exec_builtin: instead of using restore_original_signals to completely
cancel the traps, call reset_signal_handlers so the trap strings are
preserved. Then if the exec fails (and we're not exiting) we can
look at the trap strings and see how to restore the trap state.
This calls restore_traps after reinitializing the shell signal
handlers, using the trap strings saved by reset_signal_handlers.
Fixes issue with not exiting after a failed exec clearing the EXIT
trap reported by Mark March <march@systempad.org>, using the
approach suggested by Robert Elz <kre@munnari.OZ.AU>
subst.c
- expand_declaration_argument: when parsing options that modify
attributes that affect how the value is handled (i, c, u, etc.),
make sure to create an option string and call make_internal_declare
with options that start with a `+' so the attribute is off when
the assignment is performed and changes how the value is expanded.
From a report by Léa Gris <lea.gris@noiraude.net>
lib/readline/complete.c
- rl_display_match_list: even if _rl_completion_prefix_display_length
is set to a non-zero value, pass the common prefix length to
fnprint if we've turned on colored completion prefixes; passes
through to fnprint via print_filename
- fnprint: add the ellipsis if prefix_bytes exceeds the
_rl_completion_prefix_display_length, add explicit check for
prefix_bytes being longer since print_filename passes it through
if colored-completion-prefix is set. This means that while
completion-prefix-display-length still has precedence over
colored-completion-prefix, it doesn't override it if both are set
and the common prefix length is shorter than
completion-prefix-display-length. From a report by
Christoph Anton Mitterer <calestyo@scientia.net>
10/10
-----
parse.y
- parse_dparen: if the last token is FOR, increment word_top and assign
word_lineno like for other for loops. Fixes bug with LINENO after
arithmetic for commands reported by
Tom Coleman <thomas.james.coleman@gmail.com>
10/11
-----
execute_cmd.c
- shell_execve: if execve fails with ENOENT, but executable_file()
succeeds, display a slightly more descriptive error message. Prompted
by a report from Andrea Monaco <andrea.monaco@autistici.org>
stringlib.c
- strcreplace: allow backslash to escape a backslash, since we allow it
to escape a `&'
10/14
-----
pcomplib.c
- COMPLETE_HASH_BUCKETS: double to 512
stringlib.c
- strcreplace: the last argument is now a flags argument. 1 has its
previous meaning (glob); 2 means to allow backslash to escape a
backslash (as added on 10/11)
subst.c
- pat_subst: call strcreplace with 2 as the flags value
10/15
-----
doc/bashref.texi
- updates to Installation section
doc/{mkposix,mkinst,mkrbash},doc/Makefile.in
- changes to allow scripts to be run outside the source directory
10/18
-----
subst.c
- patsub_replacement: controls whether pattern substitution expands `&'
in the replacement string. Initialized to 1 by default
10/19
-----
doc/{bash.1,bashref.texi}
- document bash's WCE SIGINT behavior when job control is not enabled
and the shell receives a SIGINT while waiting for the foreground
command to complete. Added at Red Hat's request. A complete
discussion is at https://www.cons.org/cracauer/sigint.html
10/25
-----
builtins/shopt.def
- patsub_replacement: new shell option, exposes patsub_replacement
variable controlling whether pattern substitution expands `&' in
the replacement string. Still enabled by default.
doc/{bash.1,bashref.texi}
- patsub_replacement: document new shopt option
10/26
-----
lib/readline/display.c
- expand_prompt: group runs of invisible characters at the right edge
of the screen with the previous physical characters when setting
local_prompt_newlines, since that's how update_line() expects to
get it. Fix from sparrowhawk996@gmail.com.
lib/readline/macro.c
- rl_end_kbd_macro: make sure current_macro_index is > 0 after
subtracting the key sequence length, clamp it to 0 before writing
the ending NULL. From a fuzzing report by
Tillmann Osswald <tosswald@ernw.de>
lib/readline/isearch.c
- _rl_isearch_dispatch: in the bracketed paste case, don't assume the
pasted text is null-terminated, so use memcpy instead of strcpy for
the length of the pasted text, then make sure the search string is
null-terminated. From a fuzzing report by
Tillmann Osswald <tosswald@ernw.de>
lib/readline/text.c
- rl_transpose_words: make sure to preserve the value of rl_end from
the beginning to the end of the function. From a fuzzing report by
Tillmann Osswald <tosswald@ernw.de>
lib/readline/vi_mode.c
- rl_vi_delete_to,rl_vi_change_to,rl_vi_yank_to: if we are redoing a
command (_rl_vi_redoing == 1), save the old _rl_vimvcxt, allocate a
new one, and restore the old one before returning. Prevents some
pointer aliasing problems. From a fuzzing report by
Tillmann Osswald <tosswald@ernw.de>
10/29
-----
arrayfunc.c
- tokenize_array_reference: take valid_array_reference and add a third
argument (char **SUBP), which, if non-NULL, gets the null-terminated
subscript parsed from the NAME argument. If it's NULL, the caller
gets the old valid_array_reference behavior. Fix from
Koichi Murase <myoga.murase@gmail.com>
- valid_array_reference: just call tokenize_array_reference with a
NULL third argument
- unbind_array_element: assume the caller (unset_builtin) passes a
null-terminated SUB that's already been validated by a call to
tokenize_array_reference so we don't need to call skipsubscript() or
check VA_ONEWORD. Fix from Koichi Murase <myoga.murase@gmail.com>
arrayfunc.h
- tokenize_array_reference: extern declaration
builtins/set.def
- unset_builtin: use tokenize_array_reference to figure out T and pass
that to unbind_array_element. Fix from
Koichi Murase <myoga.murase@gmail.com>
- unset_builtin: pass non-null argument to array_variable_part to get
the length of the subscript (T), then cut off any final `]' before
passing it to unbind_array_element, since that's what it now
expects
subst.c
- expand_string_for_rhs,expand_string_for_pat: assign td.word from
newly-allocated memory in case it gets freed on error during the
call to call_expand_word_internal(); free it manually when that
call returns
11/1
----
findcmd.c
- search_for_command: if FLAGS includes CMDSRCH_STDPATH, don't look in
the hash table for the command name. Prompted by a report from
Roger Morris <roger.morris@gmail.com>
aclocal.m4
- BASH_FUNC_POSIX_SETJMP: add a check by fetching the signal mask
after the siglongjmp and making sure that SIGINT is not blocked,
indicating we restored the original signal mask
11/2
----
subst.c
- expand_string_assignment: make sure to add W_TILDEEXP to the flags so
expand_word_internal performs the right tilde expansion on tildes
following an unquoted colon. Report from Anders Kaseorg
<andersk@mit.edu>
11/3
----
aclocal.m4
- BASH_FUNC_POSIX_SETJMP: if cross-compiling, default to `present' if
we've determined we have posix signal functions
11/4
----
execute_cmd.c
- SET_LINE_NUMBER: set line_number, but don't set line_number_for_err_trap
if we're already running the ERR trap
- GET_LINE_NUMBER: evaluates to line_number_for_err_trap if we're
running the ERR trap and executing_line_number() otherwise
- execute_function: use GET_LINE_NUMBER to push the value for the line
number into the BASH_LINENO array
- execute_command_internal,execute_arith_command,execute_cond_command:
use SET_LINE_NUMBER to avoid overwriting line_number_for_err trap
while executing the ERR trap. Tentative fix for `caller' problem
reported by Quinn Grier <quinn@quinngrier.com>
configure.ac,patchlevel.h
- set bash version to 5.2-devel, meaning shell_compatibility_level = 52,
which required updating tests (array.tests, array21.sub,
quotearray3.sub, new-exp10.sub, history2.sub). The first three are
because bash-5.2 flushes an indexed array but does not unset the
variable when given `unset a[@]' or `unset[*]' (that is, it acts
like `a=()' instead of `unset a'); the other two are because the
version number changed
11/8
----
doc/Makefile.in
- bash.info: use `makeinfo -o' instead of calling infopost.sh to edit
the filename, since the tags table includes absolute byte offsets to
nodes. From https://savannah.gnu.org/support/?110557
11/15
-----
examples/loadables/realpath.c
- add -a NAME argument to put canonicalized pathnames into an indexed
array instead of displaying them on stdout. Suggested by
felix@f-hauri.ch
lib/readline/colors.c
- _rl_custom_readline_prefix: new function, looks in $LS_COLORS for a
custom extension (*.readline-colored-completion-prefix) and uses that,
if found, as the default color for the common prefix displayed when
`colored-completion-prefix' is set. Suggested by
Christoph Anton Mitterer <calestyo@scientia.net>
- _rl_print_prefix_color: try the return value from _rl_custom_readline_prefix
before defaulting to the C_PREFIX (C_SOCK) color. Suggested by
Christoph Anton Mitterer <calestyo@scientia.net>
lib/readline/doc/{readline.3,rluser.texi},doc/bash.1
- readline-colored-completion-prefix: document new custom suffix for
readline's colored-completion-prefix color
11/16
-----
doc/{bash.1,bashref.texi},builtins/set.def
- set: modify usage synopsis slightly, based on
https://bugzilla.redhat.com/show_bug.cgi?id=2022324
builtins/set.def
- unset_builtin: add shell compatibility level check <= bash-5.1 to
force `unset a[@]' to unset array variable `a', like in previous
versions, instead of unsetting associative array element `@' or
removing all elements of an indexed array without unsetting the
variable itself
builtins/common.c
- set_expand_once: now a no-op if the shell compatibility level is
<= bash-5.1, preserving the previous versions' behavior for [[ -v
(dependent on assoc_expand_once instead of forcing it)
subst.c
- parameter_brace_expand_rhs: make sure that the final value assigned
is always returned from ${a:=b}, even when `a' has a variable
attribute that modifies the value on assignment. Reported back on
1/20/2021 by oguzismailuysal@gmail.com; bash-5.2 tag removed
11/22
-----
doc/{bashref.texi,bash.1}
- unset: change the description of `unset name[@]' (unset name[*])
to reflect the new behavior (unset associative array subscripts or
remove all elements from an indexed array) and the difference from
previous versions
- set: document -r for restricted shell mode
- restricted shell: change occurrences of `set +o restricted' to
`shopt -u restricted_shell'. From a report from
Jin Xiang <jxiang.sd@gmail.com>
- read: note that read -t0 may return 0 if a subsequent read will
return EOF. From a suggestion by Dale R. Worley
<worley@alum.mit.edu>
execute_cmd.c
- execute_arith_command,eval_arith_for_expr: don't pass EXP_EXPANDED
to evalexp if shell_compatibility_level > 5.1, assuming that the
expression has been quoted by Q_ARITH handling
test.c
- test_arithcomp: if we're being called by the conditional command
code and treating the arguments to the arithmetic operators as
expressions, don't pass EXP_EXPANDED to evalexp if the shell
compatibility level is > 5.1, assuming that the expression has been
quoted by Q_ARITH handling
11/29
-----
examples/loadables/getconf.[ch]
- getconf: new implementation of loadable builtin, based on glibc
getconf
examples/loadables/sleep.c
- parse_gnutimefmt: parse GNU interval format (2m30s), returning
seconds and microseconds like uconvert
- sleep: use parse_gnutimefmt if uconvert can't parse the format right
away and "dhms" appears in the format string. Don't return
EX_DISKFALLBACK under any circumstances
11/30
-----
builtins/wait.def
- wait_builtin: refer to unset_waitlist only if JOB_CONTROL is enabled.
Report from Joel Ebel <jbebel@google.com>
parse.y,builtins/set.def
- changes for minimal config restrictions
configure.ac,config.h.in
- --enable-translatable-strings: new configuration option to allow
$"..." support to be compiled in or out; not included in the minimal
shell configuration
shell.c
- main: don't include any of the dump-strings options if
TRANSLATABLE_STRINGS is not defined
lib/sh/shquote.c
- sh_backslash_quote_for_double_quotes: needed for translatable strings
parse.y
- support for translating $"..." strings now conditional on
TRANSLATABLE_STRINGS
locale.c
- locale_expand: now conditional on TRANSLATABLE_STRINGS
subst.c
- expand_string_dollar_quote: support for $"..." now conditional on
TRANSLATABLE_STRINGS
doc/bashref.texi
- --enable-translatable-strings: document new configuration option
12/2
----
subst.c
- verify_substring_values: now that the default compatibility level is
52, and the Q_ARITH code is enabled, make the EXP_EXPANDED flag for
evalexp() dependent on the compatibility level
- param_expand: arithmetic substitution: make EXP_EXPANDED flag
for evalexp() dependent on the compatibility level
- expand_word_internal: don't call expand_array_subscript if the
shell compatibility level is 51 or below (Q_ARITH)
test.c
- test_unop: if the shell compatibility level is > 51, using [@] with
an existing associative array will report on a key of `@'
arrayfunc.c
- array_expand_index: if the compatibility level is > 51, Q_ARITH is
used and we don't pass EXP_EXPANDED to evalexp()
COMPAT,doc/bashref.texi
- shell compatibility mode: document effects of setting the
compatibility mode to 51
12/3
----
lib/malloc/malloc.c
- mremap: only use if MREMAP_MAYMOVE is defined, since we use the Linux
version of the function signature
12/6
----
bashhist.c
- bash_add_history: if we're parsing a here-document (PST_HEREDOC), only
suppress adding the newline between lines if we're not at the first
line of the here-document (here_doc_first_line != 0). From a report
by S0AndS0 <strangerthanbland@gmail.com>
12/8
----
lib/readline/colors.c
- _rl_custom_readline_prefix: use STREQN to check for the extension
string in $LS_COLORS, since it's not necessarily null-terminated.
From https://savannah.gnu.org/patch/?10158
12/10
-----
variables.c
- set_int_value,set_string_value: broke common code for setting int
and string dynamic variable values out into separate functions;
changed all callers to use them where appropriate. set_int_value
takes a flags argument saying whether or not to force the integer
attribute on
- assign_random: store the value assigned as the variable value so
things like RANDOM=42; RANDOM+=7 generate consistent sequences
like in ksh93
- assign_seconds: store the value assigned as the variable value so
things like SECONDS=42 ; SECONDS+=7 generate what's expected
doc/Makefile.in
- changes to allow man pages that include others (.so FN) to be built
outside the source tree
12/13
-----
arrayfunc.c
- assign_array_element_internal: take an additional argument: char **NVALP.
If non-null, it gets the value eventually assigned to the array
element
- assign_array_element: take an additional NVALP argument; pass it to
assign_array_element_internal
arrayfunc.h
- assign_array_element: new extern function declaration
{subst,variables}.c,builtins/{common.c,declare.def}
- assign_array_element: change callers
subst.c
- parameter_brace_expand_rhs: for the ${param:=value}, use the value
returned by assign_array_element in NVALP as the return value, since
it's the value ultimately assigned to the variable after possible
modification (e.g., arithmetic evaluation). Reported by
oguzismailuysal@gmail.com after flawed fix applied 11/16
12/14
-----
arrayfunc.h
- array_eltstate_t: an object that encapsulates an array element's
state (type, index, key, value) whether it's an indexed or
associative array
arrayfunc.c
- {init,flush}_eltstate: new functions to initialize and flush any
allocated memory from array_eltstate_t objects. No allocation/
deallocation functions yet; the only use is with a static instance
- assign_array_element_internal: take an array_eltstate_t * instead of
a char ** as the final argument, so we can return keys/indices and
values depending on the type of array; populates it with the
appropriate values
- assign_array_element: take array_eltstate_t * as final argument
instead of a char **; pass it to assign_array_element_internal
{subst,variables}.c,builtins/{common.c,declare.def}
- assign_array_element: change callers to modify final argument
12/15
-----
arrayfunc.c
- array_value_internal: now takes an array_eltstate_t * as the final
argument; there is no more `rtype' argument in favor of the
`subtype' member; returns the appropriate values in its members
- array_value: changed to pass array_eltstate_t to array_value_internal,
saves and fetches its `ind' member into *indp; saves `subtype'
member into *rtype
- get_arrary_value: changed to take array_eltstate_t as third argument,
passes it to array_value_internal
{redir,expr}.c
- get_array_value: changed callers; initializing the array_eltstate_t
argument as necessary
test.c
- test_builtin: changed to use get_array_value, adding AV_ALLOWALL to
the flags, since it didn't use any QUOTED argument. Pass
array_eltstate_t * as final argument and get subtype from it (the
only thing we're interested in, to deallocate memory)
12/16
-----
arrayfunc.c
- array_value: now takes a final argument of array_eltstate_t *, which
it passes to array_value_internal; no more rtype and indp args.
Callers are responsible for marshalling values into estatep
arrayfunc.h
- array_value: changed function signature
subst.c
- get_var_and_type,parameter_brace_expand_word: changed calls to
array_value to use array_eltstate_t argument and initialize it
appropriately. Copy values back from it to the parameters we need
to modify
variables.c
- assign_lineno: call set_int_value to store the value, like with
RANDOM and SECONDS (from 12/10)
12/17
-----
{eval,execute_cmd}.c
- when bypassing a parsed command because read_but_dont_execute is
set, don't modify last_command_exit_value. From a report by
Robert Elz <kre@munnari.OZ.AU>
parse.y
- parse_comsub: make sure the first call to shell_getc to check whether
or not it's an arithmetic expansion skips a quoted newline. From a
report by Robert Elz <kre@munnari.OZ.AU>
12/21
-----
subst.c
- parameter_brace_remove_pattern,parameter_brace_patsub,parameter_brace_casemod,
parameter_brace_transform,parameter_brace_substring: now take an
array_eltstate_t * argument in place of the arrayind_t argument, pass
it to get_var_and_type; this generalizes the indexed array behavior
of expanding array subscripts once to associative arrays via an
eventual call to array_value_internal with a non-null KEY member
- get_var_and_type: now takes an array_eltstate_t * argument in place
of the arrayind_t argument; use it in calls to array_value so we
can only expand array subscripts once whether they are indexed or
associative arrays
- parameter_brace_expand_word: take an array_eltstate_t * argument in
place of the arrayind_t * argument; pass it to array_value; use a
static version (which we init and flush) if the argument passed is
NULL so we can get the right state passed back and forth
- parameter_brace_expand: pass a pointer to a static array_eltstate_t
to parameter_brace_expand_word, and use that in the various calls to
parameter_brace_XXX functions that perform specific expansions in
place of the old arrayind_t argument; make sure to flush it before
returning, even on errors
12/22
-----
{trap,variables}.c
- internal_warning: calls changed to use translatable strings
consistently
error.[ch]
- internal_debug: new function, prints a message like internal_warning,
no-op if DEBUG is not defined
- INTERNAL_DEBUG: macro that expands to internal_debug when DEBUG is
defined, and nothing otherwise
{jobs,trap}.c
- changed some internal_warning and internal_inform calls to use
internal_debug, since they were active only when DEBUG is defined
parse.y
- parse_comsub: add internal_debug call when a command substitution
ends with unterminated here-documents
builtins/common.c
- number_of_args: unconditionally return posparam_count
{jobs,execute_cmd,subst}.c,parse.y,builtins/{command.def,evalstring.c}
- INTERNAL_DEBUG: use instead of calls to itrace protected by #ifdef
DEBUG
12/26
-----
lib/glob/glob.c
- glob_always_skip_dot_and_dotdot: initialize to 1 (enabled)
builtins/shopt.def
- globskipdots: new shell option, exposes glob_always_skip_dot_and_dotdot
doc/{bash.1,bashref.texi}
- globskipdots: document new shell option
execute_cmd.c
- fix_arrayref_words: call valid_array_reference with 0 for third arg
because the words have not undergone any word expansions yet and
the quotes are still present. This makes things like
A=[\[]=set
unset A[\[]
work
subst.c
- word_list_split: if a word undergoes word splitting but is not
changed, preserve any W_ARRAYREF flag into the new word. This makes
things like
rkey=']'
unset A[$rkey]
work because the unset builtin sees the W_ARRAYREF flag on its
argument
12/29
-----
builtins/common.h
- SET_VFLAGS: take a set of word flags, and set flags for use with
valid_array_reference (vflags) and assign_array_element/bind_int_variable
(bindflags) based on those flags and the setting of assoc_expand_once
(moved from read.def and generalized)
arrayfunc.c
- array_variable_name: now exclusively takes AV_xxx flags; understands
how to translate AV_NOEXPAND to the right flag for skipsubscript;
understands AV_ONEWORD and AV_NOEXPAND
- array_variable_part: just passes the FLAGS arg to array_variable_name
- assign_array_element: translates ASS_ flags to AV_ flags for
array_variable_name
- array_value_internal: now just passes flags straight through to
array_variable_part (which sends them to array_variable_name)
builtins/common.[ch]
- builtin_bind_var_to_int: now takes a new FLAGS third argument; passes
it to bind_var_to_int
builtins/printf.def
- printf_builtin: use SET_VFLAGS to set flags for builtin_bind_variable
(bindflags); makes things like
declare -A A; key=']' ; printf -v A[$key] "foo"
work without a subscript error as long as assoc_expand_once is defined
builtins/read.def
- read_builtin: use new common version of SET_VFLAGS instead of
private version; changed to use new calling sequence; makes things like
declare -A A; key=']' ; read A[$key] <<<"foo"
work without a subscript error as long as assoc_expand_once is defined
builtins/wait.def
- wait_builtin: use SET_VFLAGS for variable name with -p option
- wait_builtin: call builtin_bind_var_to_int with new bindflags third
argument
expr.c
- expr_streval: just pass TFLAG (AV_xxx flags) straight through to
array_variable_part
variables.c
- bind_int_variable: translate the assignment flags (ASS_xxx) to
VA_xxx flags for valid_array_reference calls (ASS_ONEWORD); translate
assignment flags to AV_xxx flags for array_variable_part
12/30
-----
subst.c
- parameter_brace_expand: when expanding an indirect variable, extend
the special case for array[@] and array[*] (set -u/no positional
parameters, obeying the baroque quoting rules) to the value of the
indirection. Report and fix from konsolebox <konsolebox@gmail.com>
12/31
-----
parse.y
- compound_list: when parsing a compound_list production, collect any
pending here-documents after reading a newline, not after reading
any command terminator. Fixes interactive-only prompting bug
reported back in 8/2021 by Hyunho Cho <mug896@gmail.com>
1/1/2022
--------
bashline.c
- set_filename_quote_chars: break code that modifies
rl_filename_quote_characters based on whether DIRNAME needs to be
expanded from bash_directory_completion_hook into its own function
- bash_check_expchar: break code that checks whether DIRNAME will be
word expanded from bash_directory_completion_hook into its own
function
- bashline_reset,attempt_shell_completion: make sure complete_fullquote
is set to 1 (as it is by default) in case a completion modifies it
- bash_quote_filename: if we are completing (but not expanding --
direxpand is unset) and backslash-quoting a filename with expansion
characters as determined by bash_check_expchar, make sure
filename_bstab is set not to include the expansion char (and any
following char and closer) and set complete_fullquote to 0 so
sh_backslash_quote uses filename_bstab. Fixes the longstanding issue
of quoting a `$', for instance, if the rest of the filename contains
any characters that need quoting in filenames. This assumes that the
filename is unquoted (*QCP == 0) so the word will be expanded and is
not part of the filename (if needed, we can use file_exists to check
whether the expansion characters are actually part of the filename)
1/7
---
examples/loadables/accept.c
- new -b bindaddr option to bind to a specific IP address
- move setsockopt calls before bind() to avoid TIME_WAIT issues. Fixes
from Dzogovic Vehbo <dzove855@gmail.com>
1/10
----
configure.ac
- bumped version to 5.2-alpha.
1/16
----
tests/{unicode1,glob2,intl2}.sub, tests/run-intl
- minor changes to add warnings for missing locales that cause test
failures
1/17
----
parse.y
- history_delimiting_chars: if we have a blank line by the time we
hit the end of the tests, return a semicolon for the first blank
line to avoid running lines of a multi-line command together.
Fixes bug reported by Joakim Lindblad <joakim@cb.uu.se>
subst.c
- expand_string_for_patsub: expand the replacement string for pattern
substitution assuming that it will eventually be passed to
strcreplace to replace `&' with the matched portion of the string.
This calls expand_string_for_pat(), which leaves the string quoted
and does not perform word splitting, then calls
quote_string_for_repl to post-process the expanded string.
- quote_string_for_repl: perform quote removal on passed string while
replacing CTLESC escaping a `&' or a backslash with a backslash. The
result must be passed to strcreplace
- parameter_brace_patsub: call expand_string_for_patsub if
patsub_replacement is set to quote
1/18
----
subst.c
- read_comsub: make istring_index a size_t to avoid overflow with very
large values of istring_size.
From https://savannah.gnu.org/support/index.php?110596
- expand_word_internal: make istring_index a size_t
1/20
----
buitins/cd.def
- add a description of `cd -' to the help text. Suggested by
Rob Landley <rob@landley.net>
1/21
----
lib/glob/glob.c
- glob_vector: if we allocate NEXTLINK using malloc, and free it due to
some allocation failure, reset FIRSTMALLOC to avoid duplicate frees
later on
subst.[ch]
- sub_append_string: the INDX parameter is now a size_t to avoid
overflow
parse.y
- decode_prompt_string: RESULT_INDEX is now a size_t to pass to
sub_append_string
jobs.[ch],nojobs.c
- wait_for_background_pids: now returns the number of jobs/processes
reaped
builtins/wait.def
- wait_builtin: if -p pid supplied without -n, make sure we do something
useful if no job/pid arguments are supplied and there are no jobs.
Reported by Oguz <oguzismailuysal@gmail.com>
builtins/read.def
- read_builtin: if we have a timeout, use SIGALRM instead of select
when in posix mode, since we use read instead of zread. Fixes bug
reported by Andreas Schwab <schwab@linux-m68k.org>
subst.c
- expand_string_dollar_quote: handle single-quoted and double-quoted
strings that might include $' and $" without attempting translation;
do more error checking for unterminated $' and $" that leaves those
characters unmodified. This is for use by readline's various line
expansion functions (shell_expand_line)
1/23
----
parse.y,make_cmd.c
- revert change that unconditionally processes $'...' and $"..." in
here-document bodies; there are only a couple of cases where they
should be processed in a double-quote environment
1/24
----
subst.c
- extract_dollar_brace_string: if we see another `${' on the rhs of
the operator, reset the dolbrace_state to DOLBRACE_PARAM while we
read this new ${...} string
- extract_heredoc_dolbrace_string: new function, variant of
extract_dollar_brace_string, to process the WORD in ${PARAM OP WORD}
while expanding lines of here-document data. It's complicated by the
requirement to add to the result string as we go along, since we
need to change the contents of the input string with ansi expansion
or locale translation.
- string_extract_single_quoted: take a new third argument: ALLOWESC.
This allows backslash to escape an embedded single quote, needed by
extract_heredoc_dolbrace_string to process $'...'; changed callers
1/25
----
parse.y
- parse_matched_pair: ansi-expand $'...' in WORD for ${PARAM OP WORD}
and single-quote the result if dolbrace_state == DOLBRACE_QUOTE
(posix pattern removal operators) even if extended_quote == 0
subst.c
- extract_heredoc_dolbrace_string: add logic to align with parse.y:
parse_matched_pair and its $'...' expansion, including handling
extended_quote
1/27
----
builtins/evalstring.c
- should_optimize_fork: broke conditions for optimizing away the fork
for a simple command out of optimize_fork into new function, call
from should_suppress_fork and optimize_subshell_command. Call from
optimize_fork if (subshell_environment & SUBSHELL_PAREN), relying
on fact that CMD_TRY_OPTIMIZING is only set in a couple of specific
conditions
- optimize_fork: call should_suppress_fork only if startup_state == 2;
it does the extra checks for that specific case
- optimize_fork: call should_optimize_fork if we're in a (list)
subshell (subshell_environment & SUBSHELL_PAREN)
- optimize_subshell_command: set CMD_TRY_OPTIMIZING on the right side
of a `&&', `||', or `;' list as long as it's a simple command so
we can check with optimize_fork() when it's time to execute it
execute_cmd.c
- execute_in_subshell: call optimize_subshell_command for (list)
subshells to either set CMD_NO_FORK for simple commands or set
CMD_TRY_OPTIMIZING for likely candidates for later optimization
builtins/common.h,builtins/evalstring.c
- optimize_fork: renamed to optimize_connection_fork; changed callers
1/31
----
include/shmbutil.h
- COPY_CHAR_I,SCOPY_CHAR_I: add check for locale_utf8locale and
(c & 0x80) as in other macros
lib/sh/shquote.c
- sh_backslash_quote_for_double_quotes: rewrote to use array indexing
and COPY_CHAR_I to make it easier to drop in future calls to
charvis() to make `unsafe' characters visible if FLAGS == 1
2/1
---
parse.y
- parse_comsub: if we are currently expanding aliases, temporarily
turn off alias expansion if we are not in posix mode so we defer
alias expansion until command_substitute(). Fixes double-expansion
bug reported by Martijn Dekker <martijn@inlv.org> and aligns with
https://www.austingroupbugs.net/view.php?id=1342
- xparse_dolparen: turn off alias expansion entirely while running the
parser: either we do it in parse_comsub (posix mode) or in
command_substitute (default mode)
- parse_string_to_command: ditto
subst.c
- command_substitute: if we are expanding aliases, temporarily turn
off alias expansion if we are in posix mode, since we already
performed it in parse_comsub() and are using the command string
reconstituted from the parse result
doc/bashref.texi
- bash posix mode: add description of alias expansion and command
substitution parsing and execution
2/4
---
lib/readline/rltty.c
- rl_deprep_terminal: set _rl_last_c_pos to 0 after outputting
BRACK_PASTE_FINI, since the last character in that is \r. Partially
address issue raised by Markus Schwarzenberg <markus.schwarzenberg@freenet.de>
in https://lists.gnu.org/archive/html/bug-bash/2022-02/msg00056.html
2/5
---
doc/{bash.1,bashref.texi}
- minor typo fixes from Helge Kreutzmann <debian@helgefjell.de>
2/7
---
{arrayfunc,variables}.c
- ARRAY_EXPORT: changes to encode array and assoc variables using a
scheme similar to shell functions so we can export arrays and
differentiate them from scalar variables and differentiate array
and assoc variables. Still not enabled by default.
variables.c
- mk_env_string: third argument is now the variable's attributes or 0,
with all the attributes we can export arrays
lib/readline/bind.c
- active-region-start-color,active-region-end-color: new bindable
string variables, one to set the active region color (instead of
standout mode) and one to turn it off (instead of the "se" terminal
capability). They set _rl_active_region_start_color and
_rl_active_region_end_color variables via functions
lib/readline/display.c
- putc_face: if setting standout mode, check for both the start color
and end color variables and output the start color string. If turning
off standout mode (normal face), output the end color string. Both
variables must be set
lib/readline/{readline.c,rlprivate.h}
- declarations for _rl_active_region_start_color and
_rl_active_region_end_color
2/8
---
bashline.c
- initialize_readline: add bindable name `vi-edit-and-execute-command'
shell.c
- subshell_exit: make sure to set last_command_exit_value before
calling the exit trap. Fixes bug reported by Greg Edwards
<gedwards@ddn.com>
2/9
---
lib/readline/{terminal.c,rlprivate.h}
- _rl_region_color_on,_rl_region_color_off: functions to output the
_rl_active_region_start_color and _rl_active_region_end_color
- _rl_reset_region_color: function to encapsulate setting the region
color to an arbitrary string, including doing memory management
lib/readline/display.c
- putc_face: call _rl_region_color_on and _rl_region_color_off instead
of _rl_standout_on and _rl_standout_off
lib/readline/terminal.c
- _rl_init_terminal_io: initialize _rl_active_region_start_color and
_rl_active_region_end_color from _rl_term_so and _rl_term_se,
respectively; reset every time the terminal is changed
- _rl_init_terminal_io: turn off the active region for a dumb terminal
lib/readline/bind.c
- sv_region_{start,end}_color: call _rl_reset_region_color with the
appropriate value for WHICH
2/10
----
lib/readline/doc/{rluser.texi,readline.3},doc/bash.1
- active-region-start-color,active-region-end-color: documented new
bindable readline variables
- enable-active-region: document using active-region-start-color to
highlight the text in the region
2/11
----
parse.y
- read_token,read_token_word: make sure characters read by shell_getc
are protected by appropriate calls to MBTEST when testing for shell
metacharacters and operators
2/14
----
builtins/shopt.def
- set_compatibility_level: if the current compatibility level is outside
the range of the compatNN options, just leave it alone when
unsetting one of the options (which by definition was already
unset). Fixes issue reported by Mihai Moldovan <ionic@ionic.de>
2/16
----
lib/readline/search.c
- rl_history_search_{pos,len,flags}: rename to have a leading `_'
- _rl_history_search_pos: no longer static so other parts of readline
can see it
lib/readline/rlprivate.h
- _rl_history_search_pos: extern declaration
lib/readline/readline.c
- readline_internal_teardown: don't run the undo list against the
current history entry if the non-incremental search functions have
set _rl_history_search_pos to it, since it doesn't reflect the
current contents of the line buffer. Fixes issue reported by
Andreas Schwab <schwab@linux-m68k.org>
lib/readline/misc.c
- _rl_start_using_history: initialize _rl_history_search_pos to
something invalid so it doesn't match where_history()
2/17
----
lib/readline/callback.c
- rl_callback_read_char: make sure _rl_eof_found is set to the value
of eof before calling the deprep terminal function, so it can do
different things based on whether the input code read EOF (or the
user entered the EOF character). From a gdb discussion started by
Andrew Burgess <aburgess@redhat.com> (still more to do, since this
is not part of the public API)
2/18
----
lib/readline/readline.h
- RL_STATE_EOF: new readline state value; set when readline reads an
EOF character on an empty line or a read returns an error
- rl_eof_found: new public variable
lib/readline/rprivate.h
- _rl_eof_found: renamed to rl_eof_found, so not declared here
lib/readline/{callback,readline}.c
- RL_STATE_EOF: set appropriately when readline gets an EOF. Suggested
by Andrew Burgess <aburgess@redhat.com>
- RL_STATE_EOF: make sure it's not set when readline starts
- rl_eof_found: set appropriately when readline gets an EOF
lib/readline/{callback,readline,rltty}.c
- rl_eof_found: new name for _rl_eof_found
lib/readline/doc/rltech.texi
- RL_STATE_EOF: document
2/19
----
parse.y
- parse_comsub: turn off parser state flags we don't want to inherit
into this call to the parser (PST_REGEXP, PST_EXTPAT, PST_CONDCMD,
PST_CONDEXPR for now). Fixes bug reported by konsolebox
<konsolebox@gmail.com>
2/23
----
findcmd.c,builtins/hash.def
- replace calls to is_directory with file_isdir, which only performs a
stat and doesn't do the eaccess call to check for an executable file
findcmd.c
- find_in_path_element: takes a new RFLAGSP argument, an int * where
the status flags for the returned pathname are returned; saves
additional calls to stat/eaccess
- search_for_command: get the returned flags from
find_user_command_in_path so we don't need any additional calls to
file_status after we find the command in $PATH
2/24
----
doc/{bash.1,bashref.texi}
- FUNCTIONS: some small changes to the description of local variables
and dynamic scoping, with emphasis on how that affects `unset'
behavior. Inspired by a discussion with
Christoph Anton Mitterer <calestyo@scientia.net>
2/25
----
examples/loadables/realpath.c
- renamed -s option to -q to align with other versions
- perform array assignment for `-a varname' even if -q option supplied
- renamed -S option to -s for Linux compatibility
2/28
----
lib/readline/misc.c
- _rl_free_saved_history_line: call rl_free_undo_list, saving and
setting rl_undo_list to the saved history line's data, so the right
call to _hs_replace_history_data happens and we don't end up with
a pointer aliasing problem. Fixes core dump reported by
Andreas Schwab <schwab@linux-m68k.org>, but does not make his
scenario equivalent to incremental search
3/1
---
lib/readline/search.c
- make_history_line_current: save the current line before replacing it
with the found history entry using rl_maybe_save_line
- noninc_dosearch: we don't want the saved history line, so free it
after calling make_history_line_current
- _rl_history_search_internal: call rl_maybe_replace_line after making
changes to the line buffer with make_history_line_current so we can
save the undo list we constructed before we set the history position
3/2
---
lib/readline/display.c
- expand_prompt: add missing piece to patch from 10/26/2021: if we are
recalculating the number of invisible characters on the first line
of the prompt, we need to update INVFL, even if we already set it
when we hit the number of physical characters. This ends up being
assigned to prompt_invis_chars_first_line, and is used in several
subsequent calculations. Reported by
Andreas Schwab <schwab@linux-m68k.org>
lib/readline/doc/{readline.3,rluser.texi},doc/bash.1
- enable-bracketed-paste: add some language making it clearer that
bracketed paste prevents the pasted text from being interpreted as
editing commands. Suggested by Karl O. Pinc <kop@karlpinc.com>
3/4
---
make_cmd.c
- make_here_document: perform quote removal on the here-doc delimiter
only if it's marked as quoted, which prevents quotes from inside a
command substitution from being removed (they're supposed to begin a
new quoting context) when the word itself isn't flagged as quoted
(which means the body of the here-document gets expanded). You can't
perform quote removal *and* expand the here-document lines. From an
austin-group discussion back in early February
lib/sh/strvis.c
- charvis -> sh_charvis; change caller
- sh_charvis: now take an additional SLEN argument to avoid having to
compute the string length every time; change callers
- sh_charvis: add a utf-8 locale-specific check before calling
COPY_CHAR_I (in practice, doesn't make any real difference)
3/10
----
arrayfunc.c
- convert_var_to_array: if we're being asked to create an associative
array (flags & 2), and we have an existing variable that is not an
assoc array (and not an existing indexed array), call
convert_var_to_assoc to make it one
3/11
----
jobs.c
- wait_for: don't call get_tty_state() if readline is dispatching
(RL_STATE_DISPATCHING) with the terminal settings changed
(RL_STATE_TERMPREPPED), the same way we don't if we are running a
command for programmable completion. Fixes bug with SIGINT reverting
to the saved readline terminal settings reported by
Markus Napierkowski <markus.napierkowski@cyberus-technology.de>
parse.y
- decode_prompt_string: make sure the expansion of \w, \W, and \s
are all run through sh_strvis before calling
sh_backslash_quote_for_double_quotes or just through sh_strvis if
we're not running the prompt string through word expansions.
Fixes issue reported by Josh Harcome <joshharc@gmail.com> back
in mid-January
3/16
----
bashline.c
- bash_quote_filename: if we have a word to complete that contains
characters that introduce a word expansion, make sure the passed
string does *not* exist as a filename before removing those
characters from the set that must be backslash-quoted. See change
from 1/1/2022
3/18
----
lib/readline/search.c
- make_history_line_current: don't free rl_undo_list or
_rl_saved_line_for_history; don't unconditionally save the history
line. This reverts some of the changes to support setting the
history position in history-search-backward
- rl_history_search_internal: only free the saved history line if we
were the ones who created it
3/21
----
lib/readline/nls.c
- xmalloc.h: include for systems without setlocale(), so xfree has a
prototype. Report and fix from András Kucsma <r0maikx02b@gmail.com>
lib/readline/search.c
- _rl_history_search_internal: use previous-history/next-history to
move to the found history line instead of directly calling
history_set_pos. This makes the behavior more similar to incremental
search
- rl_history_search_internal: make sure to set rl_undo_list to the
current history undo list around the calls to rl_get_previous_history
or rl_get_next_history, in order to fool the call to
maybe_replace_line they make
lib/readline/readline.c
- _rl_executing_func: the currently-executing readline command function
lib/readline/rlprivate.h
- _rl_executing_func: extern declaration
lib/readline/search.c
- _rl_history_search_internal: removed (commented out) code that sets
the current history entry to the found history entry, too much
assumes that the current undo list should be applied to the current
history entry (where_history())
3/23
----
subst.c
- parameter_brace_expand_word: if we have double-quoted ${*} or ${@},
make sure we are setting W_HASQUOTEDNULL in the flags we return to
the caller if we are returning QUOTED_NULL(word)
- parameter_brace_expand_word: if we have a double-quoted associative
array reference using `*' or `@', make sure we are setting
W_HASQUOTEDNULL in the flags we return to the caller if we are
returning QUOTED_NULL(word)
- parameter_brace_expand: if we're using the `[:]+' word expansion
operator, we need to note a quoted null string and pass the
W_QUOTEDNULL flag back to the caller
- expand_word_internal: make sure to return a QUOTED_NULL
(word[0] == CTLNUL) back to the caller if HAD_QUOTED_NULL is set,
regardless of whether or not we see a quoted dollar at. Fix for bug
reported by Andreas Luik <andreas.luik@innovative-navigation.de>
arrayfunc.c
- array_value_internal: fix typo and set estatep->type to ARRAY_INDEXED
for indexed arrays
3/31
----
lib/readline/{history.c,histlib.h}
- _hs_at_end_of_history: convenience function to tell whether or not
the current history position is at the end of the history list
4/1
---
lib/readline/search.c
- make_history_line_current: don't free rl_undo_list if it is equal to
_rl_saved_line_for_history->data, since we will need to restore it
later if we got it from a history entry. Fixes issue dating back to
7/2021 and changes to _rl_free_saved_line_for_history, current issue
reported by Andreas Schwab <schwab@linux-m68k.org>
4/5
---
lib/readline/{complete,histfile,histsearch,isearch,terminal}.c
- xfree: use instead of free
4/7
---
configure.ac
- bumped version to bash-5.2-beta
[bash-5.2-beta frozen]
4/8
---
lib/readline/input.c
- _rl_orig_sigset: need extern declaration if HAVE_SELECT is defined.
From https://savannah.gnu.org/support/?110634
examples/loadables/seq.c
- PRIdMAX: redefine if PRI_MACROS_BROKEN is defined.
From https://savannah.gnu.org/support/index.php?110635
4/11
----
configure.ac
- BASH_FUNC_STRTOIMAX: replace strtoimax if the system doesn't provide
a declaration in a standard header file. Uses new m4/strtoimax.m4.
From https://savannah.gnu.org/support/index.php?110633
builtins/printf.def
- getdouble: new function, parses string into `double' using strtod
- printf_builtin: check for the `L' length modifier and use long
doubles for the floating point conversion specifiers. If it's not
supplied, use `double' when in posix mode (as posix specifies) and
long double (if it's available, double if not) in default mode.
From a report from Paul Eggert <eggert@cs.ucla.edu>
4/12
----
lib/sh/oslib.c
- bzero: update function signature to modern BSD version
4/14
----
lib/sh/oslib.c
- bcopy, gethostname, mkfifo: update function signatures to modern
versions
4/15
----
jobs.c,nojobs.c
- wait_for_single_pid: if the pid or job argument is invalid -- isn't
a child of this shell -- return 257, which is out of the range of
valid 8-bit status values
execute_cmd.c
- execute_pipeline: if wait_for_single_pid returns > 256, set it to
127 (invalid process)
jobs.c
- wait_for_background_pids: if wait_for_single_pid returns > 256, set
the status we return in PS to 127 (what it was before)
builtins/wait.def
- wait_builtin: if wait_for_single_pid returns > 256, treat it as an
error and set pstat.pid to NO_PID
- wait_builtin: if -p supplied, and we get to the end of the argument
list with PSTAT.PID != NO_PID (which we assume means that the return
value is set from PSTAT.STATUS), set the variable name to PSTAT.PID.
From a report by Robert Elz <kre@munnari.OZ.AU>
- wait_builtin: for compatibility with the netbsd sh, leave the variable
name specified with `-p' unset if there are no PID arguments.
From a report by Robert Elz <kre@munnari.OZ.AU>
4/17
----
parse.y
- xparse_dolparen: if (flags & SX_NOLONGJMP), don't call
jump_to_top_level() on errors
bashline.c
- bash_quote_filename: don't call quote_word_break_chars() unless we
have word break chars initialized. Fixes bug reported by
Sam James <sam@gentoo.org>
4/18
----
pcomplete.c
- gen_globpat_matches: call glob_filename with the GX_GLOBSTAR flag if
the `globstar' shell option is enabled. From a report by
Steve <bash@lonetwin.net>
lib/malloc/malloc.c
- internal_free: remove the GLIBC21 code (!)
- internal_free: make the code that tests against memtop and calls
lesscore depend on USE_LESSCORE being defined, which it is by
default
lib/malloc/imalloc.h
- USE_LESSCORE: define
parse.y,shell.h
- token_buffer_size and its corresponding saved value in the shell's
parser state are now size_t instead of int
stringlib.c
- strsub,strcreplace: use size_t instead of int for local length and
indexing variables
lib/sh/zmapfd.c
- zmapfd: use size_t instead of int for local length and indexing
variables
lib/sh/zgetline.c
- zgetline: use size_t instead of int for local length and indexing
variables
4/20
----
pcomplete.c
- init_itemlist_from_varlist: free VLIST after assigning it from
*SVFUNC and after we get the variable names and values out of it.
Report from Robert E. Griffith <bobg@junga.com>
4/25
----
redir.c
- here_document_to_fd: if the shell compatibility level is bash-5.0 or
earlier, use tempfiles for all here-documents and here-strings. From
a bug-bash discussion started by Sam Liddicott <sam@liddicott.com>
4/26
----
parse.y
- parse_comsub: non-interactive shells exit on a syntax error while
parsing the command substitution
- parse_comsub: unset additional PARSER_STATE flags before calling
yyparse(). Inspired by https://bugs.gentoo.org/837203; unsetting
PST_COMPASSIGN is the fix for that bug
- parse_string_to_word_list: use save_parser_state/restore_parser_state
instead of saving pieces of the shell state in individual variables
- parse_compound_assignment: use save_parser_state/restore_parser_state
instead of saving pieces of the shell state in individual variables
- parse_compound_assignment: unset additional PARSER_STATE flags before
calling read_token(); set esacs_needed_count and expecting_in_token
to 0 like in parse_comsub() since read_token can use them
4/27
----
lib/sh/strvis.c
- sh_charvis: changes to handle being compiled without multibyte support
4/29
----
lib/readline/callback.c
- rl_callback_read_char: don't set rl_eof_found unless eof is > 0,
since it can be -3 if we need to read more input in a multi-key
sequence. Report from Andrew Burgess <aburgess@redhat.com>
examples/loadables/Makefile.sample.in
- new file, containing the rules to build the example shared object
- includes Makefile.inc from wherever it's installed. Suggested by
Robert E. Griffith <bobg@junga.com>
examples/loadables/Makefile.inc.in
- remove rules that create the example shared object
4/30
----
builtins/evalstring.c
- parse_and_execute: check for terminating signals before returning,
after any longjmp, to improve responsiveness and fix the -c code
path before running any exit trap. Report from
Emanuele Torre <torreemanuele6@gmail.com>
5/17
----
builtins/suspend.def
- suspend_builtin: the -f option now forces a suspend even if job
control is not enabled. Inspired by a discussion with
Robert Elz <kre@munnari.OZ.AU>
doc/{bash.1,bashref.texi}
- suspend: updated description to include expanded -f behavior
5/25
----
builtins/mkbuiltins.c
- -includefile: new argument, specifies extern filename to insert
into the #include statement in the structfile (builtins.c) and
the filename in the comment in the extern file (builtext.h).
From Alexander Kanavin <alex.kanavin@gmail.com> via
https://savannah.gnu.org/patch/?10210
builtins/Makefile.in
- builtins.c: change call to mkbuiltins to add -includefile option
- builtins.c: change recipe to run all the commands in the same shell
invocation
- builtins.c: change recipe to specify new filenames in the call to
mkbuiltins and move them onto builtins.c/builtext.h if the new ones
are different; make the new filenames use the current make recipe
shell pid in the filename ($$RECPID).
Inspired by Alexander Kanavin <alex.kanavin@gmail.com> via
https://savannah.gnu.org/patch/?10210
6/2
---
builtins/common.c
- builtin_find_indexed_array: new function, factored common code out
of mapfile and read builtins to find an in-scope indexed array or
create one
builtins/common.h
- builtin_find_indexed_array: extern declaration
builtins/{mapfile,read}.def
- change callers to use builtin_find_indexed_array
variables.c
- unbind_global_variable, unbind_global_variable_noref: new functions
that remove variables from the global_variables table
lib/sh/shmatch.c
- sh_regmatch: use unbind_global_variable_noref to make sure we act on
the copy of BASH_REMATCH in the global scope all the time, ignoring
any local variables that might exist. Tentative fix for memory leak
report from Emanuele Torre <torreemanuele6@gmail.com>
doc/{bash.1,bashref.texi}
- BASH_REMATCH: add caveat about making it a local variable
6/6
---
print_cmd.c
- print_redirection: if the redirectee for r_duplicating_output_word
(r_duplicating_input_word) is 1 (0), don't print it; only print a
non-default file descriptor number
- print_redirection_list: remove the code that tries to temporarily
translate a >&word redirection to >&word now that we won't print a
non-default file descriptor number. Fixes issue with `declare -f' and
function export reported by Namikaze Minato <lloydsensei@gmail.com>
6/13
----
configure.ac
- bumped version to bash-5.2-rc1
[bash-5.2-rc1 released]
6/15
----
parse.y
- parse_string_to_word_list: save the parser state before any state-
changing functions like bash_history_disable(). Reported by
Clark Wang <dearvoid@gmail.com>
6/16
----
doc/bash.1
- play tricks with the value of the zZ number register to refer to
`bash(1)' instead of `above' or `below' when creating the builtins
man page
6/17
----
doc/{bash.1,bashref.texi}
- wait: note that wait will return > 128 if interrupted by a signal.
Reported by AA <aathan_github@memeplex.com>
execute_cmd.c
- {execute_cond_node,execute_arith_command,eval_arith_for_expr}: make
sure to reset this_command_name after running any DEBUG trap so the
DEBUG trap doesn't overwrite it.
Reported by Emanuele Torre <torreemanuele6@gmail.com>.
- execute_select_command: set this_command_name to NULL after running
any DEBUG trap like execute_for_command does
6/23
----
test.c
- three_arguments: when given [ ! ! arg ], make sure to advance POS
after calling two_arguments to avoid a `too many arguments' error.
Report from Steffen Nurpmeso <steffen@sdaoden.eu>
6/27
----
subst.c
- expand_word_internal: when expanding backquoted command substitution,
call string_extract with the SX_REQMATCH flag (closing backquote
required) only if the word flags don't contain W_COMPLETE,
indicating that we're doing this for completion, probably to
determine whether or not to append something to the word. Fixes bug
reported by Emanuele Torre <torreemanuele6@gmail.com>.
7/5
---
execute_cmd.c
- execute_connection: treat a connector of '\n' the same as ';'
print_cmd.c
- print_comsub: new function, sets flag noting we are printing a
command substitution and calls make_command_string
- make_command_string_internal: add '\n' to the ';' case; print command
list with newline connector appropriately
parse.y
- parse_comsub: call print_comsub instead of make_command_string
- list1 production (part of compound_list): if a list is separated by
newlines, and the parser is parsing a command substitution, make
the connection command with a '\n' connector. Makes the text
output of parse_comsub closer to the original source text. From a
report from Martijn Dekker <martijn@inlv.org>
7/6
---
doc/bash.1,lib/readline/doc/rluser.texi
- complete: add note about arguments passed to command specified by
`complete -C'; suggested by Mark Chandler <mcp@synq.so>
builtins/setattr.def
- show_local_var_attributes: special-case `local -', since there is
no `declare -' equivalent.
Reported by Emanuele Torre <torreemanuele6@gmail.com>.
- show_all_var_attributes: use `local -' when printing a variable named
`-' at the current non-zero variable context
parse.y
- shell_getc: if we are at the end of an alias, returning a space,
make sure we mark the previous character as single-byte by modifying
shell_input_line_property so the space we return is properly
recognized. This would fail before if the last character of the
alias was a multi-byte character. Reported by
Vangelis Natsios <vnatsios@gmail.com>
7/12
----
lib/readline/isearch.c
- rl_display_search: don't call rl_redisplay_function before returning;
rl_message already calls it. Reported by
Frédéric Moulins <frederic@moulins.org>
configure.ac
- bumped version to bash-5.2-rc2
7/18
----
jobs.c
- set_job_control: don't bother calling tcgetpgrp if shell_tty < 0,
since it will just fail
variables.c
- reset_local_contexts: new function, delete all context tables
associated with shell functions and set variable_context to 0.
Called when we want to stop executing in a shell function without
going through the pop_context chain with its side effects
variables.h
- reset_local_contexts: extern declaration
builtins/evalstring.c
- parse_and_execute: call reset_local_contexts instead of setting
variable_context to 0
eval.c
- reader_loop: call reset_local_contexts in cases where the shell has
longjmped for a fatal error and errexit is enabled (ERREXIT), but
not for other cases, and especially not for the exit builtin,
instead of just setting variable_context to 0. Fixes issue originally
reported by Robert Stoll <robert.stoll@tegonal.com>
subst.c
- pat_subst: implement sed-like behavior when presented with a null
pattern that's anchored at the start or end of the string, or when
presented with a null string: process the replacement string for `&'
and `\&' and substitute in the result as before. Patch from
Koichi Murase <myoga.murase@gmail.com>
7/20
----
[bash-5.2-rc2 frozen]
7/27
----
parse.y
- reset_parser: set need_here_doc, esacs_needed_count, expecting_in_token
all to 0, since jumping back to a top-level parse needs that
- parse_comsub: make sure to reset expand_aliases and shell_eof_token
if we're not going to exit immediately out of this function
7/28
----
parse.y
- parse_comsub: if the compatibility level is <= 51, set extglob while
parsing the command substitution, so bad pattern errors can still be
caught but valid patterns are let through and can be evaluated at
runtime, when extglob may have been set. If it isn't set, it will
still be a parser error when the command substitution is executed.
Fixes report from Sam James <sam@gentoo.org> about gentoo scripts.
- reset_parser: set extended_glob from global_extglob if the parser
state includes PST_CMDSUBST
- xparse_dolparen: set global_extglob but don't modify extended_glob,
so parse errors can be caught before forking a child for command
substitution, as part of word expansion, but after extglob may have
been set by command execution (e.g., in a shell function)
8/5
---
[bump version to bash-5.2-rc3]
8/6
---
trap.c
- run_pending_traps: move code from evalstring() so we call
parse_and_execute() directly and handle any `return' invocations so
we can restore the value of running_trap. Otherwise, if we longjmp
past this function, we will think we're running a trap after we
finish. Prompted by post from Koichi Murase <myoga.murase@gmail.com>
8/9
---
lib/readline/nls.c
- _rl_current_locale: private variable, stores the value of the
LC_CTYPE locale category, as determined by _rl_init_locale; set
to allocated memory in _rl_init_locale()
- _rl_set_localevars: new function, code from _rl_init_eightbit that
checks the current locale (passed as an argument) and sets the
various locale-aware variables based on it. It accepts a second
argument: FORCE. If non-zero, it means to restore the default "C"
locale values if the locale is "C" or "POSIX", now that this
function can be called multiple times
- _rl_init_eightbit: now just calls _rl_init_locale and
_rl_set_localevars
- _rl_reset_locale: new function, checks whether our the locale has
changed since we last called _rl_init_locale to set our internal
idea of its value. If it has changed, call _rl_set_localevars with
the new locale and a FORCE argument of 1 to change the
locale-dependent variables.
lib/readline/rlprivate.h
- _rl_reset_locale: extern declaration
lib/readline/readline.c
- rl_initialize: call _rl_reset_locale instead of _rl_init_locale so
the internal readline variables get set when we move from a non-
multibyte locale ("C") to a multibyte one ("en_US.UTF-8"). Report
from Alan Coopersmith <alan.coopersmith@oracle.com>
8/16
----
lib/sh/setlinebuf.c
- sh_setlinebuf: allocate buffers for line-buffering stdout and stderr
only once, the first time it is requested. Only allocate memory if
we're using setvbuf (we usually are). Double the buffer size to 2016
if we're using the bash malloc. Otherwise, let stdio handle it.
8/17
----
builtins/exec.def
- exec_builtin: make sure to initialize orig_job_control in case the
command is not found by search_for_command. Report and fix from
Xiami <i@f2light.com>
[bash-5.2-rc3 frozen]
8/27
----
parse.y
- parse_comsub: restore extended_glob to a local copy (local_extglob)
only if we changed it; a safer way to do it. Fixes extglob change
issue reported by Kerin Millar <kfm@plushkava.net>
- cond_term: restore extended_glob to a local copy; safer than using
global_extglob, which we will reserve for error recovery
8/30
----
parse.y
- parse_comsub: don't clear the pushed string list; we might need it to
consume additional input to satisfy this command substitution. When
we restore the parser state, don't restore the pushed string list in
case we used it. From
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018727
- parse_comsub: don't modify extended_glob if parser_state includes
PST_EXTPAT, in which case we've already set extended_glob and
global_extglob appropriately. Only matters in compatibility mode.
8/31
----
subst.c
- parameter_brace_transform: make sure we return an error if *xform
is '\0'. Report from Ivan Kapranov <koltiradw@yandex.ru>
9/7
---
[bump version to bash-5.2-rc4]
9/8
---
[bash-5.2-rc4 frozen]
9/20
----
lib/readline/history.c
- replace_history_entry: check for a NULL timestamp before trying to
copy it. Report from nov.ondrej@gmail.com
9/23
----
[bash-5.2 frozen]
9/26
----
[bash-5.2 released]
9/27
----
mailcheck.c
- time_to_check_mail: don't bother if we're in the middle of readline
completion or command dispatching.
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019462
lib/readline/display.c
- rl_forced_update_display: use memset to clear out visible_line
instead of trying to use a loop; line_size is the size.
Report from <srobertson@peratonlabs.com>
print_cmd.c
- indirection_level_string: use MBRLEN and an initialized mbstate_t
object to avoid altering an internal mbstate_t.
From Koichi Murase <myoga.murase@gmail.com>
subst.c
- string_extract_verbatim: use an explicit mbstate_t object and pass
it to MBRLEN and mbrtowc to avoid altering the state that
ADVANCE_CHAR is using.
From Koichi Murase <myoga.murase@gmail.com>
- setifs: use an explicit mbstate_t object and pass it to MBRLEN so
to avoid altering an internal mbstate_t.
From Koichi Murase <myoga.murase@gmail.com>
builtins/printf.def
- asciicode: use an explicit mbstate_t object and pass it to mbrtowc
to avoid using an incorrect internal mbstate_t
From Koichi Murase <myoga.murase@gmail.com>
lib/sh/{mbscasecmp,mbscmp}.c
- mbscasecmp,mbscmp: use different mbstate_t objects for the different
strings so they don't affect each others' intermediate mbstate.
From Koichi Murase <myoga.murase@gmail.com>
9/28
----
execute_cmd.c
- execute_command_internal: if executing a (command) subshell, restore
the value of line_number from save_line_number before returning early
due to being a non-terminal pipeline element.
From https://savannah.gnu.org/support/index.php?110714
9/30
----
subst.c
- expand_array_subscript: make sure to pass a non-NULL first argument
to sh_backslash_quote. Report from Emanuele Torre <torreemanuele6@gmail.com>,
patch from Koichi Murase <myoga.murase@gmail.com>
9/30
----
jobs.c
- cleanup_dead_jobs: delete dead foreground jobs we won't notify the
user about (those not killed by a signal or killed by SIGINT/SIGPIPE).
From a report from Koichi Murase <myoga.murase@gmail.com>
- wait_for_any_job: never return a foreground job, even when requested
by pid, if it's in the jobs list
Report and fix from Koichi Murase <myoga.murase@gmail.com>
m4/strtoimax.m4
- BASH_FUNC_STRTOIMAX: fix logic inversion of result; we should be
replacing the function if the tests show we *don't* have a working
version. Report from Emanuel Haupt <ehaupt@FreeBSD.org>
10/4
----
lib/readline/nls.c
- _rl_init_locale: cope with setlocale returning NULL, make sure we
set up a default value for LC_CTYPE. Report from
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109
lib/readline/{input.c,rlprivate.h}
- fixes for compiling on w64-mingw32
10/5
----
parse.y
- xparse_dolparen: save and restore extended_glob using local_extglob
in the same way that parse_comsub does. Fixes compat issue reported in
https://bugs.gentoo.org/873931 and by Kerin Millar <kfm@plushkava.net>
10/6
----
subst.c
- extract_dollar_brace_string: keep a stack of dolbrace_state values
to handle nested expansions. Report from
Antoine <bug-bash@glitchimini.net>
10/7
----
builtins/{shopt.def,common.h}
- extglob_flag: new variable to hold the state of the `extglob' option;
initialized to EXTGLOB_DEFAULT like extended_glob
- shopt_set_extglob: new function to set extended_glob to the right
value for the rest of the shell
parse.y
- reset_parser: set extended_glob to extglob_flag, which is only
changed by shopt, remove global_extglob
- parse_comsub,parse_cond_command,xparse_dolparen: no longer use
global_extglob
execute_cmd.c
- execute_cond_node: reset extended_glob to the value of extglob_flag,
since we're executing a command here
10/8
----
parse.y
- save_dstart: when we set the value of function_dstart, save the old
value in save_dstart (read_token, read_token_word); restore it in
the grammar production after calling make_function_def. This gives
you correct line numbers for one level of function nesting.
Report from Daniel Castro <danicc097@gmail.com>
10/10
-----
execute_cmd.c
- shell_execve: rearrange code so that we check for a bad interpreter
before printing a generic ENOENT error message. Report from
Kirill Elagin <kirelagin@gmail.com>
10/12
-----
lib/readline/callback.c
- CALLBACK_READ_RETURN: add an inlined call to RL_CHECK_SIGNALS so we
can handle any signals that arrived before we restored the calling
application's signal handlers. From a gdb dicussion with
Simon Marchi <simon.marchi@polymtl.ca>
10/12
-----
variables.c
- pop_var_context: flag an internal error for shell_variables not
pointing to a function context only if we haven't already flushed
all the local contexts and reset variable_context. This can happen
if errexit is enabled and we're going to be exiting the shell, but
we're running unwind-protects on our way out. Report from
Xavier Delaruelle <xavier.delaruelle@gmail.com>
10/13
-----
sig.c
- kill_shell: broke the code that resets the signal disposition to the
default and sends a terminating signal to the shell into a separate
function
- termsig_handler: set handling_termsig to terminating_signal and make
it file-scope so other functions know we're handling a terminating
signal and are about to exit, and which signal it is (latter not used
yet)
- termsig_sighandler: if we get a fatal signal while we're handling a
fatal signal, kill ourselves with the second fatal signal immediately.
Fixes issue reported by Andreas Schwab <schwab@suse.de>
execute_cmd.c
- execute_case_command: call CHECK_TERMSIG after the call to strmatch,
since gmatch will return FNM_NOMATCH if there's a pending terminating
signal and we don't want incorrect results
subst.c
- pat_subst: make sure REP is non-NULL before calling savestring on it.
Report from Justin Wood (Callek) <callek@gmail.com>
10/14
-----
builtins/{shopt.def,common.h}
- expand_aliases: split into a variable that holds the current state
of alias expansion (expand_aliases) and a variable that reflects the
global option value (expalias_flag), make sure expand_aliases is set
appropriately by shopt
shell.c,execute_cmd.c,general.c
- expand_aliases: make sure expand_aliases and expalias_flag always
agree
parser.h
- PST_STRING: new parser flag, set when parsing a string to a command
or word list
parse.y
- reset_parser: if we're parsing a command substitution or a string,
and need to restore expand_aliases, make sure it's set to the value
of expalias_flag.
Fixes SIGINT during interactive command substitution parsing bug
reported by feng xiangjun <fengxj325@gmail.com>
- parse_string_to_word_list,parse_string_to_command: make sure to set
PST_STRING in parser_flags since we're resetting expand_aliases
10/17
-----
print_cmd.c
- print_function_def, named_function_string: if the function doesn't
have any here-documents, unset was_heredoc after printing the
closing brace so we can add a separator if there is another command
following the function definition. Fixes bug with multiple function
definitions and here-documents reported by D630 <d630@posteo.net>
- make_command_string_internal: if we're printing a command
substitution, make sure to preserve newlines in the comsub so we
avoid problems with re-parsing function defs or command substitutions
containing multiple compound commands that need to be separated
by newlines, but don't double them up
parse.y
- P_ARITH: new parse_matched_pair flags value; used to jump to
parse_comsub if we see a $( inside a $(( )), $[ ], or (( ))
- parse_matched_pair,parse_comsub,parse_arith_command,read_token_word:
make sure to call parse_matched_pair with P_ARITH if we're parsing
an arithmetic command or expansion
- parse_matched_pair: if we see $( inside a call with P_ARITH in the
flags argument, jump to parse_dollar_word and call parse_comsub to
parse it. The rest of the steps assume that parse_comsub has
expanded aliases (or not) appropriately. Fixes bug 2 from
https://bugzilla.redhat.com/show_bug.cgi?id=2134307
10/18
-----
builtins/evalstring.c
- parse_and_execute: we play tricks in the parser and in command_substitute
to turn expand_aliases on and off depending on the comsub parser
pass and whether or not we're in posix mode. Since this should only
matter for parsing, when we're processing a command substitution, we
set expand_aliases to the global flag value after parsing the
command and before executing it, and restore it if the global flag
value isn't changed during execution. Fixes bug 1 from
https://bugzilla.redhat.com/show_bug.cgi?id=2134307
command.h
- PF_BACKQUOTE: new flag value, only used by command_substitute to
differentiate between `` and $() forms. The former does not have
aliases expanded by parse_comsub in posix mode, so needs to expand
them in parse_and_execute like default mode
subst.c
- command_substitute: don't modify expand_aliases if PF_BACKQUOTE is
included in flags, since aliases haven't been expanded in the
command string (it was run through parse.y:parse_matched_pair())
- expand_word_internal: pass PF_BACKQUOTE to command_substitute() if
expanding a `` command substitution
10/20
-----
parse.y
- yylex: return YYUNDEF as current_token if read_token returns < 0.
Fixes parser reset issue reported by Todd Stein <toddbstein@gmail.com>
in https://savannah.gnu.org/support/index.php?110745
subst.c
- ARITH_EXP_CHARS: chars that are special and trigger expansion in
arithmetic expressions, EXP_CHARS without `<' and `>'. Fixes bug
reported by Glenn Jackman <glenn.jackman@gmail.com>
execute_cmd.c
- retain_fifos: replace executing_list (which is still present) as the
indicator of whether or not to save and restore the FIFO list around
a call to execute_command_internal/execute_command; it's more
descriptive and can be used elsewhere
- execute_for_command: set retain_fifos so we don't unlink the fifo
list until the for command completes. Fixes issue reported in
https://savannah.gnu.org/support/index.php?110743
lib/readline/xmalloc.c
- memory_error_and_abort: add `const' qualifiers to the argument. Fix
from Markus Elfring <Markus.Elfring@web.de>
10/24
-----
general.c
- check_binary_file: check the first two lines for NULs if the first
line begins with a `#!'; otherwise check the first. From a discussion
and patch in https://savannah.gnu.org/support/?110744
(larsh@apache.org)
parse.y
- parse_matched_pair: set PST_NOERROR if we read to EOF without finding
a closing match and call parser_error; avoids redundant error
message
lib/sh/uconvert.c
- uconvert: RETURN: if ipart (integer part) is 0, but upart (fractional
part) is non-zero, multiply upart by mult so we don't lose the sign
for values in the range (-1, 0]. From a report by
izabera <izaberina@gmail.com>
execute_cmd.c
- execute_in_subshell: check for terminating signals before we return
to our caller, which will immediately exit, and before running any
exit trap (since termsig_handler will run any exit trap). Fixes bug
reported by Andrew Neff <andrew.neff@visionsystemsinc.com>
10/26
-----
lib/readline/complete.c
- rl_filename_completion_function: if the application doesn't supply
any directory hook functions, we need to handle the case where we
dequoted users_dirname and also tilde-expanded dirname. We choose
to tilde expand users_dirname rather than call the application
dequoting function again. Report and patch from
Stefan H. Holek <stefan@epy.co.at>
10/27
-----
execute_cmd.c
- execute_in_subshell: call procsub_clear in addition to clear_fifo_list,
since none of these process substitutions are children of this new
subshell
jobs.c
- wait_for_background_pids: call procsub_waitpid on the last procsub
created as long as it's the same as $!, then call reap_procsubs to
clean up the procsub list. Don't call procsub_waitall. Report from
Oguz İsmail Uysal <oguzismailuysal@gmail.com>
10/31
-----
expr.c
- expr_streval: explicitly permit `@' and `*' as associative array
subscripts if the shell compatibility level is greater than 51.
Prompted by report from Corey Hickey <bugfood-ml@fatooh.org>
subst.c
- string_list_pos_params, param_expand: make sure that $* is treated
the same as "$*" in here-document bodies that are being expanded.
From https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00002.html
11/1
----
lib/readline/readline.c
- readline_internal_char: save and restore the value of _rl_top_level
around our use of setjmp, even though it doesn't matter in most
cases. Report from sparrowhawk996@gmail.com that it causes crashes
in some obscure callback-mode cases
lib/readline/isearch.c
- _rl_isearch_dispatch: if we end the search and stuff characters back
to be read again, decrement the current key sequence index by 2 so
we don't have duplicate characters in the sequence
lib/readline/misc.c
- rl_digit_argument: call _rl_del_executing_keyseq after rl_execute_next
11/3
----
builtins/setattr.def
- show_localname_attributes: special-case "-" local variable, since
there is no `declare -' equivalent.
Reported by Emanuele Torre <torreemanuele6@gmail.com>.
11/4
----
lib/sh/tmpfile.c
- sh_mktmpname,sh_mktmpfd: use get_urandom32() instead of random() if
we're not using mktemp or mkstemp and the system provides the
appropriate support
trap.c
- trap_variable_context: new variable, set to variable_context every
time a trap string runs (that is, every time running_trap is set to
a value > 0) in _run_trap_internal, run_exit_trap, run_pending_traps
trap.h
- trap_variable_context: extern declaration
builtins/common.c
- get_exitstat: if the `return' builtin is running, we are running a
trap (but not the DEBUG trap), and the return would cause the trap
string to complete (variable_context == trap_variable_context, so
we haven't executed another shell function), use the last command
exit value as the return status. POSIX interp 1602, from
https://www.austingroupbugs.net/view.php?id=1602
11/4
----
lib/readline/display.c
- local_prompt_invis_chars: new array variable, similar to
local_prompt_newlines, that keeps track of the number of invisible
characters on each line of the prompt string. Use in WRAP_OFFSET
macro with eye to using in W_OFFSET as well. Used for the case where
the last line of the prompt is not the last line with invisible
characters. Can use this in more calculations replacing wrap_offset
and prompt_invis_chars_first_line going forward. Inspired by report
from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018851
- update_line: use local_prompt_invis_chars to set _rl_last_c_pos
correctly when on a non-terminal prompt line that contains
invisible characters
11/7
----
subst.c
- get_var_and_type: allocate new memory for *valp and return it if the
type is VT_ARRAYMEMBER. The callers -- all of which treat this case
the same as VT_VARIABLE -- will free appropriately. Fixes problems
with using parameter operations like ## on dynamic array variables,
reported by Ivan Kapranov <koltiradw@yandex.ru> back on 8/31/2022
expr.c
- change some error messages to make it clearer these are arithmetic
syntax errors. These will require new translations.
test.c
- integer_expected_error: change the message to remove `expression',
since this is only called for the `test' builtin, where TEST_ARITHEXP
is not in FLAGS. This will require a new translation.
Reported by Emanuele Torre <torreemanuele6@gmail.com> back on
6/15/2022
11/10
-----
builtins/read.def
- reset_timeout: when a timer expires, make sure to cancel any
readline timeout as well with rl_clear_timeout().
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023776
11/11
-----
builtins/reserved.def
- !: add short help text
lib/readline/complete.c
- make_quoted_replacement: if readline found quote characters anywhere
in the filename, but is not completing on an unclosed quoted string,
and there is an application filename quoting function, let that
function quote the filename if necessary
bashline.c
- COMPLETE_DQUOTE2: new completion quoting style define
- bash_expand_filename: new function, runs a filename passed to it
through word expansion, suppressing command and process substitution
and returns the result (in new memory if it's different than the
filename argument)
- bash_quote_filename: if the return value from bash_check_expchar is
`$' or ``', expand the filename and if it contains characters that
should be quoted, set the quoting style to COMPLETE_DQUOTE2
- bash_quote_filename: if the completion quoting style is COMPLETE_DQUOTE2,
use sh_mkdoublequoted to put double quotes around the entire
unexpanded filename instead of using sh_double_quote, which will
backslash-quote any `$'. This is a start at preserving user-supplied
quotes if the (expanded) completed filename requires them. From
reports by Peng Yu <pengyu.ut@gmail.com> in 5/2020 and
Pedro Gimeno <pgba-da0a@personal.formauri.es> in 6/2021
11/14
-----
parse.y
- report_syntax_error: if word_top is set and we reach EOF, report the
starting line number in the error message. From a patch from
L A Walsh <bash@tlinx.org> and Manuel Reiter <manuel.reiter@dwd.de>
back in 9/2018
- MAX_CASE_NEST: doubled to 256, renamed to MAX_COMPOUND_NEST
- read_token_word: add `if', `while', and `until' to the set of
compound commands that use WORD_TOP and WORD_LINENO (with
corresponding changes to grammar productions)
- [grammar]: changed check to decrement WORD_TOP to >= 0 since we
start at -1 and we want to decrement back to -1 when all loops are
closed
builtins/jobs.def
- jobs_builtin: call notify_and_cleanup after displaying the status of
jobs to implement POSIX requirement that `jobs' remove terminated
jobs from the jobs list
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/jobs.html#tag_20_62
11/15
-----
lib/sh/input_avail.c
- include signal.h unconditionally, we need it for HAVE_SELECT and
HAVE_PSELECT
- nchars_avail: make sure we declare and use readfds and exceptfds if
we have pselect or select available
lib/readline/input.c
- rl_gather_tyi,rl_getc: need to declare and use readfds and exceptfds
if HAVE_PSELECT or HAVE_SELECT is set. Report from
Henry Bent <henry.r.bent@gmail.com>, fixes from
Koichi Murase <myoga.murase@gmail.com>
11/16
-----
lib/sh/ufuncs.c
- quit.h: include unconditionally for declaration of sigemptyset even
if HAVE_SELECT is not defined
lib/sh/timers.c
- USEC_PER_SEC: make sure it's defined even if HAVE_SELECT is not
lib/glob/sm_loop.c
- BRACKMATCH: if an equivalence class does not match, and the next
character following the class is a `]', treat that as the end of
the bracket expression.
Report and fix from Koichi Murase <myoga.murase@gmail.com>
- GMATCH: if the current character in the string is a `/' and the
current element in the pattern is a bracket expresion, and the FLAGS
include FNM_PATHNAME, return FNM_NOMATCH immediately. A bracket
expression can never match a slash.
Report and fix from Koichi Murase <myoga.murase@gmail.com>
- BRACKMATCH: if we encounter a <slash> in a bracket expression, either
individually or as part of an equivalence class, nullify the bracket
expression and force the `[' to be matched as an ordinary
character
11/17
-----
lib/glob/sm_loop.c
- BRACKMATCH: if a slash character appears as the first character
after a non-matching character class or equivalence class, treat
the bracket as an ordinary character that must be matched literally
- BRACKMATCH: if a slash character appears as the second character
of a range expression, treat the bracket as an ordinary character
- BRACKMATCH: if a slash character appears in the portion of a
bracket expression that already matched, treat the bracket as an
ordinary character
Updates from Koichi Murase <myoga.murase@gmail.com>
- BRACKMATCH: if a range expression is incomplete (no end char),
treat the bracket as an ordinary character
11/18
-----
doc/bashref.texi
- Reporting Bugs: add mention of the Savannah project page. Suggested
by Loïc Yhuel <loic.yhuel@gmail.com>
11/20
-----
builtins/common.h
- SEVAL_NOOPTIMIZE: new flag for parse_and_execute: means don't try to
optimize forks out of any simple or conditional commands
builtins/evalstring.c
- parse_and_execute: if FLAGS includes SEVAL_NOOPTIMIZE, don't try to
call can_optimize_connection to optimize away forks from AND_AND or
OR_OR commands
builtins/eval.def,trap.c,parse.y,jobs.c
- parse_and_execute: include SEVAL_NOOPTIMIZE in any calls to
parse_and_execute. Fixes bug reported by
Frode Nordahl <frode.nordahl@canonical.com>
11/21
-----
lib/readline/readline.c
- readline_initialize_everything: use xmalloc to initialize
rl_executing_keyseq, since we use xrealloc to reallocate it and
don't check it for NULL anywhere
subst.c
- parameter_brace_expand_word: make sure to update *ESTATEP and pass
ES back to the caller even if array_value returns NULL. Fixes
memory leak referencing unset associative array elements reported
by Ralf Oehler <Ralf@Oehler-Privat.de>; fix from
Koichi Murase <myoga.murase@gmail.com>
11/22
-----
lib/glob/sm_loop.c
- BRACKMATCH: if a backslash appears before a slash in a bracket
expression, treat the whole thing as literal and try to match the
open bracket
- BRACKMATCH: if a bracket expression ends in an unquoted backslash,
try to match the left bracket literally and go on. More discussion with
Koichi Murase <myoga.murase@gmail.com>
execute_cmd.c
- execute_in_subshell: don't try to optimize away forks in the command
if the subshell command is being timed or its return value is being
inverted. Report from Dabrien 'Dabe' Murphy <dabe@dabe.com>
11/23
-----
lib/readline/complete.c
- __WIN32__: remove uses of this preprocessor symbol, use _WIN32
lib/readline/rldefs.h
- Don't define NEW_TTY_DRIVER on _WIN32. Fix from
sparrowhawk996@gmail.com
include/posixselect.h
- include "posixtime.h" instead of <sys/time.h> so the right guards
are present
builtins/read.def
- read_builtin_timeout: make sure we don't try to call shtimer_select
if HAVE_SELECT isn't define; it won't be compiled in
include/stdc.h
- restrict: make sure we have a definition if __STDC__ is not defined
include/posixtime.h,lib/sh/gettimeofday.c
- gettimeofday: make sure the function signature matches POSIX by
adding `restrict'
11/25
-----
include/posixselect.h
- don't try to define HAVE_SELECT at all if _WIN32 is defined
lib/readline/kill.c
- define WIN32_LEAN_AND_MEAN for the windows-specific paste function
lib/readline/rlprivate.h
- _rl_timeout_select: only include declaration if HAVE_SELECT or
HAVE_PSELECT are defined
11/28
-----
lib/readline/input.c
- rl_gather_tyi: call rl_input_available_hook after FIONREAD test,
let the application hook into whether or not there are characters
to read
execute_cmd.c
- execute_function: if the maximum function nesting level is exceeded,
run the unwind-protects before jumping back to top level. Report
from felix <felix@f-hauri.ch>
variables.c
- find_variable_nameref_for_create,find_variable_nameref_for_assignment:
handle find_variable_nameref returning &nameref_maxloop_value, return
NULL and print a warning message in that case
- find_variable_nameref: return &namref_maxloop_value instead of NULL
if the number of resolution cycles exceeds NAMEREF_MAX; change
callers to print a new error message in this case; no other change
in behavior. From a 4/2020 suggestion from Andrej Podzimek
<andrej@podzimek.org>
- find_variable_nameref_context, find_nameref_at_context,
find_variable_last_nameref_context: make sure to return
&nameref_maxloop_value consistently and handle getting it as a
return value from other functions
11/29
-----
lib/readline/display.c
- _rl_update_final: if there is only one line (_rl_vis_botlin == 0)
and that line is empty (botline_length == 0), assume there is no
prompt and the line has no contents, so output the CR/LF to indicate
that the newline has been read. From a report from
Kevin Pulo <kev@pulo.com.au>
11/30
-----
builtins/evalstring.c
- parse_and_execute: if we are executing the eval builtin, and the
return status from the command is suppressed (builtin_ignoring_errexit),
set CMD_IGNORE_RETURN in the parsed command's flags. From a report
from Tycho Kirchner <tychokirchner@mail.de>
12/1
----
lib/glob/sm_loop.c
- PARSE_SUBBRACKET: a reworked PARSE_COLLSYM, generalized to handle
[:, [=, and [. special bracket expressions
- BRACKMATCH: change to use PARSE_SUBBRACKET consistently to parse
[:, [=, and [. special bracket expressions
- PATSCAN: takes new FLAGS arg, changed all callers to just pass the
flags they get through to PATSCAN
- PATSCAN: call PARSE_SUBBRACKET for [:, [=, and [. to treat them
consistently (uses FLAGS argument here)
- PATSCAN: handle FNM_NOESCAPE appearing in FLAGS argument
This set of fixes contributed by Koichi Murase <myoga.murase@gmail.com>
lib/glob/{glob,gmisc}.c
- PATSCAN: change all callers to add extra flags arg of 0
doc/{bash.1,bashref.texi}
- trap description: replace ARG with ACTION
- clarify the language describing what trap without arguments and
trap -p without arguments display
- clarify that trap in non-interactive shells does not allow signals
that were ignored at shell start to be trapped; interactive shells
allow this
- trap: add missing command types to the description of when the
DEBUG trap is executed
builtins/trap.def
- LONG_DOC: replace ARG with ACTION
- make it clear that trap and trap -p without arguments display a
information about specified signals, but in a form that may be
reused as shell input
12/5
----
pcomplete.c
- compgen_compspec: new flag saying whether or not we're running via
the compgen builtin or via programmable completion: set to 0
every time gen_progcomp_completions runs, set to 1 in
gen_compspec_completions if this_shell_builtin == compgen_builtin
- gen_shell_function_completions: call rl_clear_signals and
rl_set_signals so the shell's signal handlers are active when
running shell functions to generate completions. We try to do it
only when programmable completion, not the compgen builtin, is active.
Idea from Koichi Murase <myoga.murase@gmail.com>, fixes bug
reported in 9/22
sig.c
- sigint_sighandler, termsig_sighandler: since these can now be called
during programmable completion, we need to set the readline signal
event hook if the readline state includes RL_STATE_DISPATCHING or
RL_STATE_COMPLETING, since we can't rely on RL_STATE_SIGHANDLER
being set and we want to call throw_to_top_level here
- throw_to_top_level: if the shell is interactive, before calling
bashline_reset (which zeroes rl_signal_event_hook), call
rl_cleanup_after_signal if we think readline hasn't called it
already
12/9
----
configure.ac
- add "LOCAL_LDFLAGS = -rdynamic" for freebsd/openbsd/netbsd. Reported
by Christian Weisgerber <naddy@mips.inka.de>
12/12
-----
subst.c
- parameter_brace_expand_length: handle namerefs with values that are
valid length expansion expressions but invalid identifiers. From
ed7-aspire4925@hotmail.com via https://savannah.gnu.org/support/?110799
12/13
-----
subst.c
- extract_heredoc_dolbrace_string: fix off-by-one error after calling
extract_command_subst and extract_process_subst that caused it to
copy one too many parsed characters. Fix for bug reported by
Norbert Lange <nolange79@gmail.com>
12/14
-----
execute_cmd.c
- execute_cond_node: if a regular expression fails to compile, print
an error message. Report from Emanuele Torre <torreemanuele6@gmail.com>
back on 6/15/2022
trap.c
- trap_variable_context -> trap_return_context, initialize from
funcnest + sourcenest instead of variable_context so we handle
shell function execution and `./source', both of which can use
`return'. Idea from Koichi Murase <myoga.murase@gmail.com>
builtins/common.c
- get_exitstat: compare trap_return_context against funcnest+sourcenest,
since that's how it's initialized now
lib/readline/readline.c
- readline_internal_charloop: if we're not using the callback interface,
don't restore _rl_top_level from olevel, since we will just be going
around the loop again and will potentially need to use it multiple
times. Report from Emanuele Torre <torreemanuele6@gmail.com>
12/15
-----
shell.h
- EX_UTILERROR: new generic special builtin return status to indicate a
POSIX utility error that should cause a non-interactive shell to abort
execute_cmd.c
- builtin_status: translate EX_UTILERROR to EXECUTION_FAILURE
builtins/set.def
- unset_builtin: return EX_UTILERROR if posix_utility_error is set;
set it when trying to unset a non-identifier (variable) or a
non-unsettable or readonly variable
12/16
-----
subst.c
- de_backslash: now takes a second argument with the current quoting
flags
- de_backslash: if the quoting flags include Q_HERE_DOCUMENT and the
shell is in posix mode, remove backslashes quoting double quotes
subst.h
- de_backslash: update extern declaration
lib/readline/histexpand.c
- history_expand_internal,get_history_word_specifier,get_subst_pattern,
hist_error,history_find_word,hist_string_extract_single_quoted:
now take const char * string arguments
lib/readline/mbutil.c
- _rl_get_char_len,_rl_adjust_point,_rl_find_next_mbchar_internal,
_rl_find_next_mbchar,_rl_find_prev_mbchar,_rl_find_prev_mbchar_internal,
_rl_test_nonzero,_rl_find_prev_utf8char,_rl_is_mbchar_matched,
_rl_compare_chars,_rl_char_value: take const char * string arguments
12/17
-----
builtins/umask.def
- parse_symbolic_umask: add missing POSIX pieces:
o `action' of ugo, meaning to copy portions of initial mask
o multiple `op' specs as part of the action string (`u=r-w')
(resets perm)
o missing perm characters Xst in action string
o default `who' equivalent to `a' instead of fixing up later
12/19
-----
builtins/type.def
- if -a and -P are both supplied, look in the command hash table but
continue and perform a $PATH search even if the NAME is hashed.
From a report by Adam Vodopjan <adam.vodopjan@gmail.com>
doc/{bash.1,bashref.texi}
- type: update description to fix it to what the code actually does
builtins/set.def
- set_edit_mode: don't run with_input_from_stdin or with_input_from_stream
unless command_execution_string is NULL. Report from
Harald van Dijk <harald@gigawatt.nl>
12/20
-----
braces.c
- array_concat: add a check for interrupts and terminating signals
into the inner loop
jobs.c
- without_job_control: set original_pgrp == NO_PID since we don't
want to be messing with the terminal pgrp if we call end_job_control.
From a report from ks1322 ks1322 <ks1322@gmail.com>
12/21
-----
include/{posixtime.h,systimes.h,shmbutil.h,shtty.h}
- PARAMS: remove
12/22
-----
builtins/evalfile.c
- _evalfile: add SEVAL_NOOPTIMIZE to the parse_and_execute flags
(maybe overkill, but safer). From a report by
Dan Church <h3xx@gmx.com> and Oguz <oguzismailuysal@gmail.com>
lib/sh/gettimeofday.c
- gettimeofday: added code for _WIN32 version
12/27
-----
doc/{bash.1,bashref.texi},builtins/printf.def
- specify the valid format characters as a subset of what printf(3)
specifies, note that the %n format specifier takes a variable name
as an argument. Suggestion from Emanuele Torre <torreemanuele6@gmail.com>
12/28
-----
{xmalloc,variables,unwind_prot,trap,test,subst,sig,siglist,shell,redir,
pcomplete,pathexp,make_cmd,mailcheck,jobs,input,hashcmd,hashlib,general,
flags,findcmd,externs,execute_cmd,error,dispose_cmd,command,bashline,
bashhist,assoc,arrayfunc,array,alias}.h
{version,version2}.c
- PARAMS: remove for ANSI C-ification
builtins/{getopt,common,bashgetopt}.h
builtins/{mkbuiltins,gen-helpfiles,psize,psize-posix}.c
builtins/{evalstring,bashgetopt,common,evalfile,getopt}.c
builtins{alias,bind,break,cd,command,complete,declare,enable,exit,fc,
fg_bg,getopts,hash,help,history,jobs,kill,mapfile,printf,pushd,read,set,
shopt,source,suspend,trap,type,ulimit,umask,wait}.def
- PARAMS: remove for ANSI C-ification
lib/malloc/{watch,table,shmalloc,mstats,imalloc}.h
lib/malloc/{malloc,stats,table,trace}.c
- PARAMS: remove for ANSI C-ification
lib/glob/{glob,strmatch}.h
lib/glob/{glob,glob_loop,gmisc,sm_loop,smatch,strmatch,xmbsrtowcs}.c
- PARAMS: remove for ANSI C-ification
lib/intl/{eval-plural,plural-exp,loadinfo,hash-string,gettextP}.h,
lib/intl{plural.y,plural.c},
lib/intl/{finddomain,bindtextdom,dcigettext,l10nflist,loadmsgcat,localealias,plural-exp}.c
- PARAMS: remove for ANSI C-ification
- STATIC -> static
- internal_function -> inline
lib/sh/{casemod,clock,eaccess,fnxform,fpurge,makepath,mktime,netopen,pathphys,random,shquote,snprintf,spell,strtod,strtoimax,strtoumax,times,timeval,tmpfile,unicode,winsize,zcatfd,zgetline,zmapfd}.c
- PARAMS: remove for ANSI C-ification
support/{bashversion.c,mkversion.sh,mksignames.c}
- PARAMS: remove for ANSI C-ification
lib/sh/{clock,strchrnul,getcwd,times,rename,inet_aton,strdup,strerror,strnlen
strpbrk,strtod,strtoimax,strtol,strtoumax,wcsdup,wcsnwidth,wcswidth,strcasecmp,
strcasestr}.c
- C89-style function declarations
lib/malloc/{alloca,malloc,stats,table,trace,xmalloc}.c
- C89-style function declarations
12/29
-----
lib/glob/{glob,glob_loop,gmisc,sm_loop,smatch,strmatch,xmbsrtowcs}.c
- C89-style function declarations
lib/sh/{zcatfd,zgetline,zmapfd,zread,zwrite,winsize,vprint,uconvert,ufuncs,
unicode,utf8}.c
lib/sh/{stringlist,stringvec,strtrans,strvis,timeval,tmpfile}.c
lib/sh/{setlinebuf,shmatch,shmbchar,shquote,shtty,snprintf,spell}.c
lib/sh/{random,pathcanon,pathphys,oslib,netconn,netopen}.c
lib/sh/{mailstat,makepath,mbscasecmp,mbschr,mbscmp,mktime}.c
lib/sh/{input_avail,itos,getenv,fmtulong,fnxform,eaccess,dprintf,casemod,clktck}.c
- C89-style function declarations
examples/loadables/{accept,asort,basename,bcat,cat,csv,cut,dirname,dsv}.c
examples/loadables/{fdflags,finfo,head,hello,id,lcut,ln}.c
examples/loadables/{mkdir,mkfifo,mktemp,mypid,necho,pathchk}.c
examples/loadables/{print,printenv,push,realpath,rm,rmdir,seq}.c
examples/loadables/{setpgid,stat,strftime,sync,tee,template,truefalse,tty}.c
examples/loadables/{uname,unlink,whoami}.c
- C89-style function declarations
xmalloc.c, array2.c, list.c, dispose_cmd.c, copy_cmd.c, bracecomp.c, mksyntax.c
- PARAMS: remove for ANSI C-ification
- C89-style function declarations
12/30
-----
hashlib.c,assoc.c,input.c,hashcmd.c,alias.c,alias.h,array.c,flags.c,pcomplib.c,
pcomplib.h,locale.c
variables.c,arrayfunc.c,bashhist.c,bashline.c,error.c,pathexp.c,nojobs.c,
stringlib.c,eval.c,findcmd.c,mailcheck.c,make_cmd.c,shell.c,print_cmd.c,
general.c,expr.c
- PARAMS: remove for ANSI C-ification
- C89-style function declarations
- add `const' and `inline' where it makes sense
12/31
-----
test.c,execute_cmd.c,parse.y,pcomplete.c,trap.c,subst.c,braces.c,jobs.c,sig.c
builtins/{evalstring.c,gen-helpfiles.c,mkbuiltins.c}
builtins/{alias.def,bind.def,break.def,builtin.def,caller.def,cd.def,colon.def}
builtins/{command.def,complete.def,declare.def,echo.def,enable.def,eval.def}
builtins/{exec.def,exit.def,fc.def,fg_bg.def,hash.def,help.def,history.def}
builtins/{jobs.def,kill.def,let.def,mapfile.def,printf.def,pushd.def,read.def}
builtins/{return.def,set.def,setattr.def,shift.def,shopt.def,source.def}
builtins/{suspend.def,test.def,times.def,trap.def,type.def,ulimit.def}
builtins/{umask.def,wait.def}
- PARAMS: remove for ANSI C-ification
- C89-style function declarations
- add `const' and `inline' where it makes sense
1/2/2023
--------
lib/sh/{stringvec.c,inet_aton.c,strnlen.c,spell.c,netopen.c,stringlist.c}
lib/sh/{strtrans.c,tmpfile.c,uconvert.c,zcatfd.c}
builtins/{common.c,common.h}
mailcheck.c,bashline.c,pathexp.c,stringlib.c,locale.c,pcomplete.c,redir.c
test.c,trap.c,variables.c,bashhist.c,expr.c,arrayfunc.c,assoc.c,variables.c
subst.c,findcmd.c
arrayfunc.h,variables.h,findcmd.h,bashline.h,trap.h,pathexp.h,externs.h,
pcomplete.h,bashhist.h,assoc.h,general.h,subst.h
- more `const' changes, remove `register'
1/3
---
parse.y
- more `const' changes, remove `register'
variables.h
- VARLIST: list_len and list_size now size_t
variables.c
- vlist_alloc: take size_t parameter, changed callers
- vlist_realloc: take size_t parameter, changed callers
lib/sh/stringvec.c,externs.h
- functions that take int size params now take size_t
- strvec_len: returns size_t
lib/sh/stringlist.c,externs.h
- STRINGLIST: list_size and list_len now size_t
- functions that take int size params now take size_t
variables.c,bashline.c,builtins/bind.def
- change strvec_ int parameters to size_t where it makes sense
- change strlist_ int parameters to size_t where it makes sense
builtins/shopt.def
- reset_shopt_options: set glob_always_skip_dot_and_dotdot to 1,
since that's the current default in lib/glob/glob.c
1/4
---
execute_cmd.c,parse.y,general.c,make_cmd.c,print_cmd.c,variables.c,expr.c
jobs.c,subst.c,input.c,unwind_prot.c,pathexp.c,pathexp.h,alias.c,bashline.c
bashhist.c,lib/sh/shquote.c,externs.h,stringlib.c,locale.c,findcmd.c
builtins/common.c,builtins/declare.def,builtins/enable.def,builtins/fc.def
lib/sh/zmapfd.c,builtins/help.def,builtins/mapfile.def,builtins/read.def
builtins/shopt.def,lib/glob/glob.c,lib/glob/smatch.c,lib/glob/sm_loop.c
lib/glob/xmbsrtowcs.c,lib/glob/gmisc.c,lib/glob/gm_loop.c
lib/sh/getenv.c,lib/sh/makepath.c,lib/sh/pathphys.c,lib/sh/tmpfile.c
lib/sh/stringlib.c,lib/sh/spell.c,lib/sh/strtrans.c,lib/sh/zgetline.c
lib/sh/mbscasecmp.c,lib/sh/utf8.c
lib/readline/readline.c,lib/readline/rlprivate.h,lib/readline/vi_mode.c
lib/readline/complete.c,lib/readline/bind.c,lib/readline/isearch.c
lib/readline/util.c,lib/readline/kill.c,lib/readline/macro.c
lib/readline/text.c,lib/readline/histexpand.c,lib/readline/histfile.c
lib/readline/mbutil.c,lib/tilde/tilde.c
- size_t changes
- remove some unused variables
- remove `register'
1/5
---
builtins/getopt.c
- sh_getopt_restore_state: make sure argv[sh_curopt] is non-null before
using it
parse.y
- CHECK_FOR_RESERVED_WORD: make sure to set word_top appropriately if
the last token was IF, WHILE, or UNTIL, since these tokens can follow
those reserved words
Makefile.in
- ubsan: new target, to build with gcc/clang UBSan undefined behavior
sanitizer
1/6
---
execute_cmd.[ch],locale.c,parse.y,expr.c,bracecomp.c,bashline.c,externs.h
stringlib.c,general.[ch]
builtins/{subst.c,array.c,echo.def,printf.def,enable.def,help.def,set.def}
lib/sh/{strtrans.c,stringvec.c,shquote.c}
lib/glob/sm_loop.c
lib/readline/{vi_mode.c,histfile.c,funmap.c,complete.c,display.c,bind.c,isearch.c}
lib/tilde/tilde.c
- final code cleanups for ANSI C and lint/ubsan/asan runs
1/7
---
lib/readline/complete.c
- rl_complete_internal: when computing nontrivial_lcd and the length
of the text from the line buffer, dequote the text from the line
buffer before comparing it against the common prefix of the matches
(matches[0]), so we don't get spurious mismatches if the quoted text
from the line is longer than the unquoted match. Report from
Martin Castillo <castilma@uni-bremen.de>
input.[ch]
- get_buffered_stream(fd): new function, return the BUFFERED_STREAM *
corresponding to file descriptor FD, if it exists
1/8
---
parse.y
- shell_getc: if yy_getc returns EOF but the buffered stream input
indicates an error state, set shell_input_line_terminator to
READERR. Currently treated the same as EOF.
1/10
----
lib/sh/random.c
- intrand32: use % operator instead of (mathematically equivalent)
subtraction and multiplication, which can cause signed 32-bit
overflow. Report from Sam James <sam@gentoo.org>
lib/readline/input.c
- rl_getc: if the application hasn't defined a signal event handler,
and readline is in callback mode, make sure SIGINT breaks out of
operations like incremental and non-incremental searches and digit
arguments by calling _rl_abort_internal, since the callback code
expects the various contexts that rl_callback_sigcleanup() resets
to be valid
- rl_getc: if there is a pending signal when we enter the while loop
in callback mode, handle it in the same way we would if a signal
arrived while we were waiting in select/pselect. That forces
callback mode to call _rl_abort_internal in the right place.
From a report from Andrew Burgess <aburgess@redhat.com>
1/13
----
trap.c
- SIG_ASYNCSIG: new value for sigmodes; means that the signal is
ignored because an async command is being executed
- set_signal: if the original signal disposition is SIG_IGN only
return if SIG_ASYNCSIG isn't set. This implements POSIX interp 751
for setting a trap
- ignore_signal: if we're ignoring a signal that already has SIG_IGNORED
set, make sure we set SIG_TRAPPED in case of SIG_ASYNCSIG (POSIX
interp 751)
- reset_signal,restore_signal: if we want to reset or restore a signal
that has SIG_ASYNCSIG set, make sure we reset to SIG_DFL if the
signal is trapped to maintain POSIX semantics
- set_signal_async_ignored: new function to set original_signals to
SIG_IGN and set the SIG_IGNORED and SIG_ASYNCSIG sigmode flags; used
by setup_async_signals
- signal_is_async_ignored: return true if the SIG argument is being
ignored because it's part of an async list
trap.h
- set_signal_async_ignored,signal_is_async_ignored: extern declarations
sig.c
- initialize_terminating_signals: if a signal is ignored because it's
part of an async list, don't bother trying to initialize or set the
hard ignored flag
execute_cmd.c
- execute_simple_command: if we're executing a builtin or function
asynchronously, call reset_terminating_signals like we do in
execute_in_subshell()
- execute_subshell_builtin_or_function: only call set_sigint_handler
if async is 0, so we don't undo the work done by setup_async_signals.
If the old handler is SIG_IGN and the signal has SIG_ASYNCSIG set
and isn't trapped, restore the old handler
- setup_async_signals: call set_signal_async_ignored to set the right
flags
1/16
----
parse.y
- read_token_word: if we're in posix mode, and we find a reserved word
before checking a token for aliases, turn off the `check next word
for aliases' flag (PST_ALEXPNEXT). This is for compatibility with
other shells. From a report by <anonymous4feedback@outlook.com>
- shell_getc: make sure the shell is reading a buffered stream before
checking the default buffered stream for errors if yy_getc returns 0
1/17
----
subst.c
- split_at_delims: if the cursor is at whitespace just preceding a
word, and we're doing this for completion (e.g., to build COMP_WORDS),
force the creation of an empty word and set the current word to it.
This is a change from previous behavior, but a useful one: it makes
COMP_WORDS[COMP_CWORD] and $2 to a completion function consistent
and the same as the word readline wants to complete. From a report
from Naim Favier <n@monade.li> back in 6/2022
parse.y
- read_token: turn off PST_ALEXPNEXT if we read a shell metacharacter:
we will expand aliases anyway if the token puts the shell in a
command word position and we took pains to turn it off for
redirection tokens; remove special cases that turned it off
- pop_string: don't turn off PST_ALEXPNEXT if it's on; this is what
prevents it from being enabled if an alias expansion of more than
two aliases ends with a space. Fixes issue reported by
<anonymous4feedback@outlook.com>
1/18
----
jobs.c
- wait_for: if we are reaping a background job, don't bother trying to
give the terminal back to shell_pgrp -- we never set the terminal's
pgrp to that job in the first place. Fixes issue reported by
Steffen Nurpmeso <steffen@sdaoden.eu>
1/19
----
lib/readline/{histexpand.c,history.h}
- history_expand: first argument is now `const char *'. Request from
Simon Marchi <simon.marchi@polymtl.ca>
lib/readline/doc/{history.3,hstech.texi}
- history_expansion: change description to note new const first arg
1/21
----
lib/readline/input.c
- rl_gather_tyi: move call to rl_input_available_hook to the top,
giving it first shot. There's still no way for it to set chars_avail.
Conditionalize the rest of the input methods based on whether the
result == -1.
lib/readline/rl_private.h
- move the decision making about RL_TIMEOUT_USE_SELECT/RL_TIMEOUT_USE_SIGALRM
here from input.c
1/23
----
trap.c
- restore_default_signal: if we have a signal that's not trapped, but
is a signal that is set to SIG_ASYNCSIG, POSIX interp 751 requires
the shell to allow it to be reset to the default, even though it
wasn't already trapped
subst.c
- do_assignment_internal: don't allocate new memory for NAME, just
modify and restore it in place
1/25
----
lib/readline/histfile.c
- history_write_slow: a fallback function that uses stdio to write the
history list to a supplied file descriptor
- history_do_write: call history_write_slow if ftruncate/mmap/malloc
fail; hope the simpler approach works
1/27
----
general.[ch]
- valid_function_name: new function, returns non-zero if the name
can be used as a function name without the `function' prefix
print_cmd.c
- named_function_string,print_function_def: use valid_function_name so
the rules about when to use the `function' reserved word are
consistent
builtins/trap.def
- new option -P, which prints only the action associated with each
signal spec argument
doc/{bash.1,bashref.texi}
- trap: document new -P option, add note that trap -p or trap -P in a
subshell can print the parent's traps
1/28
----
parse.y
- shell_getc: make sure references to shell_input_line_property are
protected by #ifdef HANDLE_MULTIBYTE. From
https://savannah.gnu.org/patch/?10309
print_cmd.c
- named_function_string,print_function_def: don't copy the function
COMMAND * before printing it as text; unwind-protect any redirects
attached to the function body
parse.y
- PST_CMDBLTIN: new parser state, means the previous token word was
`command' in a command position
- read_token_word: in posix mode, "command" followed by a declaration
utility preserves the declaration utility status of the following
word, so we mark that state and then check a word for being an
assignment builtin if in that state on the next call. This makes
compound assignments to builtins that accept them (e.g., `declare')
work as if `command' were not present. This is a POSIX issue 8
requirement
- read_token: turn off PST_CMDBLTIN state as appropriate
subst.c
- use locale_mb_cur_max instead of MB_CUR_MAX consistently
2/1
---
builtins/printf.def
- printf_builtin: %q and %Q use the `alternate form' flag to force
single quoting instead of backslash quoting. $'...' is still
preferred if there are characters that require it
- getwidestr, getwidechar: functions to take a possibly multibyte
character string and convert to a wide character string or a wide
character, respectively
- convwidestr, convwidechar: functions to take a wide character string
or single character, apply any precision, convert back to a multibyte
character string, and return the result for printing
- printf_builtin: consistently print an error message if printstr()
returns < 0, since it will only do that if ferror(stdout) is true;
let the PRETURN macro do that if appropriate, so we don't duplicate
code
2/2
---
builtins/printf.def
- printwidestr: wide-character version of printstr; understands
fieldwidth and precision as characters instead of bytes
- printf_builtin: interpret %ls and %lc as referring to wide strings
and characters, respectively; use printwidestr to print the wide-
character string obtained from the (presumably multibyte) argument.
Fieldwidth and precision are characters, not bytes
2/3
---
builtins/set.def
- unset_builtin: since tokenize_array_reference modifies its NAME
argument, we need to restore the original word if there is no
array variable found with that name, so we can go ahead and try to
unset a function with that wonky name. Inspired by a report from
Emanuele Torre <torreemanuele6@gmail.com>
parse.y
- read_token_word: don't set the W_HASDOLLAR flag in the returned WORD
for <(command) and >(command). That way they can be used in function
names.
execute_cmd.c
- execute_simple_command: if in posix mode, don't perform function
lookup for command names that contain a slash
builtins/enable.def
- dyn_load_builtins: don't allow dynamically loaded builtins to have
slashes in their name
2/4
---
general.c
- valid_function_word: new function, used to check whether a word can
be used as a function name. Replaces call to check_identifier();
incorporates POSIX interp 383 check for special builtin so we can
move it out of execute_intern_function().
- valid_function_name: use the FLAGS argument instead of POSIXLY_CORRECT;
only reject reserved words if FLAGS&1
execute_cmd.c
- execute_intern_function: call valid_function_word() instead of
check_identifier(); remove check for special builtin that
valid_function_word performs
print_cmd.c
- print_function_def,named_function_string: pass POSIXLY_CORRECT to
valid_function_name as the FLAGS argument
2/6
---
subst.c
- expand_subscript_string: don't set W_NOTILDE in td.flags so we
perform `normal' tilde expansion (expansion at the start of the
word) on the array subscript
- expand_oneword,expand_compound_assignment_word: change second arg to
ATYPE, which better reflects its use
arrayfunc.c
- assign_assoc_from_kvlist,assign_compound_array_list,expand_and_quote_assoc_word:
use expand_assignment_string_to_string instead of expand_subscript_string
for the rhs of the assignment or the second word in the kvpair to
be more consistent with how assignment statements behave (e.g.,
tilde expansion). Fixes issue reported by maroloccio@gmail.com
2/7
---
parse.y
- discard_until: now returns the last character read. If we get an
EOF while processing a comment, return EOF (rarely happens;
shell_getc returns EOF only under certain circumstances)
- read_token: if discard_until returns EOF, return yacc_EOF
input.h
- bclearerror: new macro, clears the B_ERROR flag in the buffered
stream BP
input.c
- b_fill_buffer: try making errors `sticky': if the B_ERROR flag is
set for the buffered stream, return EOF immediately. This is similar
to what stdio does
builtins/fc.def
- fc_builtin: in posix mode, if there are extra arguments supplied to
-s (e.g. pat=rep first last), throw an error
doc/{bash.1,bashref.texi}
- printf: document new altform for %q/%Q and %ls/%lc
2/8
---
bashline.c
- set_up_new_line: if the new line doesn't change rl_line_buffer,
just return right away without changing rl_point. Affects
alias-expand-line, history-expand-line, and history-and-alias-expand-line.
Inspired by a report from
Addison Brendtro <addison.brendtro@gmail.com>
builtins/declare.def
- declare_internal: make multiple calls to `local -' at the same
context have no effect after the first one. That way we don't keep
overwriting the saved option set. Report and fix from
Emanuele Torre <torreemanuele6@gmail.com>
2/10
----
execute_cmd.[ch]
- bind_lastarg: now a public function
parse.y
- execute_variable_command: call bind_lastarg instead of bind_variable
to avoid exporting $_ if allexport is set. Fix from
Emanuele Torre <torreemanuele6@gmail.com>
- history_delimiting_chars: if we're parsing some kind of delimited
construct that's *not* a quoted string, don't bother adding an extra
newline to the history if the current history entry already ends in
a newline. From https://savannah.gnu.org/support/?110838 via
Ganapathi Kamath <hgkamath@hotmail.com>
2/13
----
bashline.c
- set_up_new_line: add some more heuristics to try and usefully
position rl_point
2/16
----
lib/readline/complete.c
- complete_fncmp: fix for case mapping `-' and `_' if the bytes do not
form a valid multibyte character
lib/readline/util.c
- new functions: _rl_strcaseeqn, like strcasencmp but with a flag to
handle character mapping (-_) like completion-map-case wants, and
_rl_charcasecmp, to do the same thing for two characters.
Inspired by a patch from Brennan Vincent <brennan@umanwizard.com>
lib/readline/mbutil.c
- new functions: _rl_mb_strcaseeqn and _rl_mb_charcasecmp, multibyte
versions of the above
Inspired by a patch from Brennan Vincent <brennan@umanwizard.com>
lib/readline/{rlprivate.h,rlmbutil.h}
- extern declarations for the above functions
lib/readline/complete.c
- complete_fncmp: use _rl_mb_strcaseeqn and _rl_strcaseeqn as
appropriate, remove duplicated inline code
Inspired by a patch from Brennan Vincent <brennan@umanwizard.com>
lib/readline/{isearch.c,rlprivate.h}
- _rl_search_case_fold: new variable, will be used to indicate case-
insensitive incremental and non-incremental searches
lib/readline/bind.c
- search-ignore-case: new bindable variable, tied to _rl_search_case_fold
Inspired by a patch from Brennan Vincent <brennan@umanwizard.com>
lib/sh/mbsncmp.c
- mbsncmp(3) replacement
lib/readline/isearch.c
- _rl_isearch_dispatch: honor `search-ignore-case' variable and perform
case-insensitive incremental searches if it's set
Inspired by a patch from Brennan Vincent <brennan@umanwizard.com>
lib/readline/histlib.h
- CASEFOLD_SEARCH: new flag for history searching, means to search
strings case-insensitively
lib/readline/histsearch.c
- history_search_internal: anchored searches honor CASEFOLD_SEARCH
lib/readline/histsearch.c
- history_search_internal: searches now honor CASEFOLD_SEARCH
- _hs_history_search: new function, just external interface to
history_search_internal, allows the rest of the library to specify
search flags
lib/readline/histlib.h
- _hs_history_search: extern declaration
lib/readline/search.c
- noninc_search_from_pos: use _hs_history_search, add CASEFOLD_SEARCH
to flags if _rl_search_case_fold is non-zero
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- search-ignore-case: document new bindable variable
2/17
----
config-top.h
- PATSUB_REPLACE_DEFAULT: macro set to 1 or 0 to set the default value
of `patsub_replacement'. Can be overridden by -DPATSUB_REPLACE_DEFAULT=0
in the `make' command
builtins/shopt.def
- reset_shopt_options: reset patsub_replacement to PATSUB_REPLACE_DEFAULT
subst.c
- patsub_replacement: initialize to PATSUB_REPLACE_DEFAULT
parse.y
- shell_getc: only call clearerr(stdin) when yy_stream_get returns EOF
if the shell is currently interactive (interactive != 0)
- shell_getc: if the shell is not interactive (interactive_shell == 0)
and using stdio to read the script (bash_input.type == st_stream),
set shell_input_line_terminator to READERR if ferror(stdin) is true
after yy_stream_get returns EOF
2/20
----
doc/{bash.1,bashref.texi}
- update aliases description based on a bug-bash discussion
- update description of word splitting behavior when IFS is unset
builtins/evalfile.c
- _evalfile: if reading the entire file doesn't return the same
number of bytes as requested (the file size), treat this as a read
error
2/21
----
parse.y
- yylex: if read_token returns < 0, return YYEOF if EOF_Reached = 1.
Don't return yacc_EOF because that allows commands to be executed.
- grammar: add a production to handle YYEOF, treating it the same as
yacc_EOF. Based on a report from
Eduardo A. Bustamante López <dualbus@gmail.com>
jobs.c
- wait_for: if we're checking for window size changes, allow checks
during trap commands while readline is active or `bind -x' command
execution. Fix from Koichi Murase <myoga.murase@gmail.com>
2/22
----
jobs.c
- wait_for: check for window size changes during programmable completion
2/23
----
execute_cmd.c,input.c,jobs.c,nojobs.c,parse.y,redir.c,shell.c
builtins/{exec.def,read.def}
input.h
- BUFFERED_INPUT: preprocessor #define is gone, this code is now
unconditional
2/24
----
builtins/declare.def
- declare_internal: set the att_propagate flag on a variable that is
marked as att_tempvar only if it's *not* marked att_local. The
effect is that local variables with the same name as variables in
the temporary environment are not propagated to the previous scope.
From a report by Voldemar Lazarev <voldemar.lazarev@alludo.com>
that prompted a bug-bash discussion
builtins/setattr.def
- set_var_attribute: don't set local variables for which we are setting
export or readonly to propagate back to the previous context, but
make sure we preserve posix semantics
parse.y
- read_token_word: if we're parsing the words of a compound assignment
(parser_state & PST_COMPASSIGN), and we have a valid assignment
statement as a word ([sub]=value), set W_NOBRACE in the word so we
don't try and perform brace expansion on it. This makes ( [sub]=word )
closer to name[sub]=word.
From a report by Ilkka Virta <itvirta@iki.fi> back in July, 2020:
https://lists.gnu.org/archive/html/bug-bash/2020-07/msg00133.html
2/27
----
lib/readline/display.c
- rl_redisplay: if HANDLE_MULTIBYTE is defined, do the special META_CHAR
handling if wc_bytes == wc_width == 1
execute_cmd.c
- eval_arith_for_expr: make sure we don't call make_word with a NULL
string if expand_arith_string returns NULL. Report from
F G <frank.graziano@gmail.com>
arrayfunc.c
- assign_assoc_from_kvlist: added code, currently disabled, to perform
all expansions, including word splitting, on the kv-pair word list
2/28
----
lib/readline/search.c
- rl_history_search_reinit: change check against history_string_size
to account for history_string_size now being a size_t. Report and
fix from Grisha Levit <grishalevit@gmail.com>
3/2
---
lib/readline/history.c
- _hs_search_history_data: search the history list for an entry with
`data' matching the argument; return the index
- _hs_replace_history_data: search backwards through the history list
from the end
lib/readline/histlib.h
- _hs_search_history_data: extern declaration
lib/readline/search.c
- make_history_line_current: make sure rl_undo_list doesn't appear in
any history entries (it should be a private search string undo list)
before freeing it
lib/readline/misc.c
- _rl_free_saved_history_line: make sure the undo list in
_rl_saved_line_for_history isn't rl_undo_list and doesn't appear in
any history list entries as `data' before freeing it. Fixes core
dump after SIGINT reported by Grisha Levit <grishalevit@gmail.com>
parse.y,print_cmd.c
- changes for size_t when computing new amount for xrealloc
3/3
---
parse.y
- set_word_top: new inline function to check and set word_top; called
from the appropriate places
- parse_dparen: call set_word_top before parsing an arith command or
nested subshell. Fixes underflow issue reported by
Grisha Levit <grishalevit@gmail.com>
examples/loadables/kv.c
- kv: new loadable builtin, reads key-value pairs from stdin and assigns
them to an associative array
3/7
---
builtins/trap.def
- trap_builtin: if trying to restore SIGQUIT to its default disposition,
and the shell is in posix mode, set to SIG_DFL if the shell is
running as an async command and signal_is_async_ignored (SIGQUIT) is
true. Posix conformance issue 751
3/8
---
builtins/alias.def
- print_alias: now returns int. Check for write errors using sh_chkwrite
and return EXECUTION_FAILURE if it fails
- alias_builtin: if print_alias returns EXECUTION_FAILURE, return
EXECUTION_FAILURE immediately (write error). POSIX test conformance
3/9
---
builtins/cd.def
- change_to_directory: if we're not in physical mode and are in posix
mode, add step 9 of the posix cd algorithm, which essentially tries
the pathname the user supplied if it's shorter than PATH_MAX and the
length of the canonicalized pathname is longer than PATH_MAX. This
is basically what default bash mode does without the length checks.
POSIX test conformance.
subst.c
- strip_trailing_ifs_whitespace: use ifs_whitespace(*s) instead of
spctabnl(*s) like word splitting and get_word_from_string. POSIX
test conformance
jobs.c
- wait_for: tweak change from 1/18 to make sure a J_ASYNC job isn't in
the foreground (J_FOREGROUND) as it would be if it had been continued
in the foreground with `fg'; if it is, we want to give the terminal
back to shell_pgrp
3/10
----
input.c
- fd_berror: returns true if the file descriptor passed as an arg
corresponds to a buffered stream with an error condition
parse.y
- shell_getc: use fd_berror instead of inline code
- shell_getc: if yy_getc returns EOF, immediately set line[0] to NULL
and set shell_input_line_terminator to READERR. Then exit immediately
with status 128 if index == 0, line[index] == NULL, and READERR.
Posix interp 1629
config-top.h
- FATAL_READERROR: now defined to 1 by default
lib/readline/display.c
- rl_expand_prompt: allocate an empty string for local_prompt if prompt
is the NULL or empty string. Fixes seg fault with rl_message and
empty prompt reported by Grisha Levit <grishalevit@gmail.com>
lib/readline/histexpand.c
- history_expand: if hist_extract_single_quoted returns an index at or
past the end of the string, correct the index and break the loop,
which will cause a return. Report and fix from
Grisha Levit <grishalevit@gmail.com>
3/13
----
lib/readline/vi_mode.c
- rl_domove_motion_callback: set the MOVE_FAILED flag in the context M
if rl_dispatch returns non-zero and other movement-command-specific
conditions are met. Right now, an unsuccessful `f' or `F' command
is failure.
- _rl_vi_domove_motion_cleanup: if the command is `c' or `C', we don't
enter insert mode if the MOVE_FAILED flag is set in the context M.
This is how standalone vi works.
lib/readline/kill.c
- rl_unix_filename_rubout: add some checks for rl_point > 0 before
looking at rl_line_buffer[rl_point - 1]. Report and fix from
Grisha Levit <grishalevit@gmail.com>
lib/readline/isearch.c
- _rl_isearch_dispatch: reset cxt->sline_index to 0 if it's past the
end of the history string (sline_len). Fixes asan bug reported by
Grisha Levit <grishalevit@gmail.com>
lib/readline/histexpand.c
- history_tokenize_word: don't increment the string index past the
NULL if the line ends in a backslash.Fixes asan bug reported by
Grisha Levit <grishalevit@gmail.com>
lib/readline/vi_mode.c
- rl_vi_yank_to,rl_vi_change_to,rl_vi_delete_to: if these are called
with an existing valid vimvcxt, save it and allocate a new one for
the current function call to use, then restore it before returning.
This prevents referencing vimvcxt after freeing it in the case that
these functions call each other recursively (e.g., y1y1, c1d1, etc.).
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
3/14
----
bashhist.c
- bash_add_history: make sure curlen is large enough before checking
curlen - 1 and curlen - 2, otherwise you can get buffer underflow.
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
bashline.c
- bash_spell_correct_shellword: don't bother trying to correct empty
words. Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
lib/sh/shquote.c
- sh_mkdoublequoted: make sure to allocate enough memory for the
pathological case: where every character in the string needs to be
backslash-escaped because it's special within double quotes.
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
doc/{bash.1,bashref.texi}
- here documents: make sure the summary specifies the here-document is
terminated by `delimiter'; specify what the delimiter is if the word
is not quoted. Prompted by a help-bash post from
goncholden <goncholden@protonmail.com>
3/15
----
doc/bash.1,lib/readline/doc/rluser.texi
- shell-expand-line: enumerate the specific expansions performed.
From a request by Alex Bochannek <alex@bochannek.com>
findcmd.c
- path_value: new function, returns normalized version of $PATH. Takes
a single argument saying whether or not to look in the temporary
environment first. Normalizes null $PATH (PATH=) into ".". From a
bug-bash discussion started by Moshe Looks <moshe.looks@gmail.com>
- _find_user_command_in_path: use path_value()
- user_command_matches: use path_value()
- search_for_command: if PATH[0] == 0, set PATH = "." like path_value().
This has the side effect of calling command_not_found_handle when
PATH is the empty string and the command isn't in the current
directory
- search_for_command: if path == 0, but we found an executable in the
current directory, make sure to set dot_found_in_search before adding
it to the command hash table
findcmd.h
- path_value: extern declaration
bashline.c
- command_word_completion_function: use path_value()
builtins/enable.def
- dyn_load_builtin: use path_value for BASH_LOADABLES_PATH; it's cleaner
though it doesn't change the behavior
3/17
----
bashline.c
- bashline_reset: reset rl_filename_quoting_function, since there is a
SIGINT code path where it could remain reset by glob completion.
Reported by Grisha Levit <grishalevit@gmail.com>
- command_word_completion_function,command_subst_completion_function,
glob_complete_word: set some static variables to NULL
after freeing them so they don't potentially get freed twice after
a SIGINT during completion
Reported by Grisha Levit <grishalevit@gmail.com>
parse.y
- read_token_word: when deciding how to quote translated strings, don't
free ttok before comparing it to ttrans
Reported by Grisha Levit <grishalevit@gmail.com>
- parse_matched_pair: same thing for freeing nestret
- read_token: if we return a newline, make sure we call set_word_top()
if necessary.
Fixes underflow reported by Grisha Levit <grishalevit@gmail.com>
lib/glob/sm_loop.c
- EXTMATCH: don't bother with FNM_PATHNAME checks; this function isn't
called with a pathname.
Fixes underflow reported by Grisha Levit <grishalevit@gmail.com>
lib/readline/misc.c
- rl_maybe_replace_line: if we replace a history entry's data with
rl_undo_list, we need to set rl_undo_list to 0, since we should not
have rl_undo_list pointing to something from a history entry
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
3/20
----
lib/readline/histexpand.c
- postproc_subst_rhs: fix off-by-one error when reallocating new string
for case where we're *not* substituting for `&'
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
jobs.c
- terminate_current_pipeline: add a SIGKILL call in there in case the
SIGTERM doesn't work
- terminate_current_pipeline: add a version that works when job control
isn't enabled (pipeline_pgrp == shell_pgrp)
subst.c
- skip_to_delim: pass completeflag (SX_COMPLETE) to extract_dollar_brace_string
in case it includes a command substitution, since we want to inhibit
error messages in this case
parse.y
- no_semi_successors: add DOLPAREN to list since something like $(\n
shouldn't have a semicolon added there.
From a report by Grisha Levit <grishalevit@gmail.com>
3/21
----
pcomplete.c
- gen_globpat_matches: set noglob_dot_filenames here since we're not
calling shell_glob_filename to do it
From a report by Grisha Levit <grishalevit@gmail.com>
3/22
----
lib/readline/misc.c
- rl_maybe_replace_line: if we're replacing a history entry with the
current line buffer and undo list, then zero out any undo list in
_rl_saved_line_for_history, since we're not going to use it any more
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
lib/readline/undo.c
- rl_free_undo_list: if we're freeing rl_undo_list, it can't be a
valid value for data in _rl_saved_line_for_history
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
lib/readline/complete.c
- display_matches: don't call rl_display_match_list if we received a
signal during get_y_or_n and didn't jump out for some reason
From a report by Grisha Levit <grishalevit@gmail.com>
- rl_display_match_list: return if we received a signal during
_rl_internal_pager (via get_y_or_n) and didn't jump out
From a report by Grisha Levit <grishalevit@gmail.com>
3/23
----
lib/readline/history.c
- history_truncate_file: don't bother trying to read the existing
history file if we're just truncating it to 0 lines
3/24
----
lib/readline/histfile.c
- history_truncate_file: fix off-by-one error that resulted in the
timestamp associated with the first history entry not being written
to the truncated history file
From a report by Grisha Levit <grishalevit@gmail.com>
parse.y
- decode_prompt_string: do something rational if localtime() returns
NULL (extraordinarily rare)
From a report by Paul Eggert <eggert@cs.ucla.edu>
examples/loadables/stat.c
- stattime: ditto
examples/loadables/strftime.c
- strftime_builtin: ditto
lib/readline/examples/histexamp.c
- main: ditto
include/posixtime.h
- getnow(): new inline function, calls gettimeofday and returns tv_sec;
replacement for time(0). From Paul Eggert <eggert@cs.ucla.edu>
general.h
- NOW: use a call to getnow() to standardize on gettimeofday for time
information
lib/readline/history.c
- include #posixtime.h for getnow()
- hist_inittime: use getnow() instead of calling time(0)
parse.y
- posixtime.h: include instead of <time.h>
- decode_prompt_string: use getnow() instead of calling time(0)
3/27
----
parse.y
- count_all_jobs: add extern definition if JOB_CONTROL is not defined.
From Emanuele Torre <torreemanuele6@gmail.com>
bashhist.c
- bash_add_history: make sure the current history line is not empty
before checking what ended it.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/histexpand.c
- history_tokenize_word: break out of loop for incomplete command and
process substitution or extended globbing patterns
From a report by Grisha Levit <grishalevit@gmail.com>
bashline.c
- hostnames_matching: fix size_t issue when checking whether to realloc
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/random.c
- genseed: use uintptr_t instead of u_bits32_t to silence compiler
warnings. From Paul Eggert <eggert@cs.ucla.edu>
aclocal.m4
array2.c
builtins/mkbuiltins.c,builtins/psize-posix.c,version.c
builtins/getopts.def
lib/readline/text.c,lib/readline/bind.c
support/recho.c,support/mksignames.c,support/zecho.c,support/xcase.c
support/printenv.c,support/signames.c,support/bashversion.c
support/memtest.c,support/endian.c
lib/glob/gm_loop.c
- some cleanups for function prototypes and other stdc requirements
From Paul Eggert <eggert@cs.ucla.edu>
lib/readline/doc/{rltech.texi,hstech.texi}
- add prototypes and stdc requirements to the examples
builtins/complete.def
- compgen_builtin: save and restore readline variables affecting how
filename completions are treated in case someone uses compgen in
the foreground.
From a report by Grisha Levit <grishalevit@gmail.com>
3/28
----
aclocal.m4
builtins/enable.def,builtins/gen-helpfiles.c,builtins/help.def,builtins/printf.def
general.h,hashlib.h
include/ansi_stdlib.h,include/ocache.h
lib/glob/collsyms.h,lib/glob/glob.c
lib/readline/history.h,lib/readline/xmalloc.h
xmalloc.c,xmalloc.h
lib/sh/strtrans.c
lib/tilde/tilde.c
mksyntax.c
support/endian.c
- don't bother with __STDC__ if we are just using C89 features like
const, function prototypes, etc.
From Paul Eggert <eggert@cs.ucla.edu>
externs.h
- prototype the list functions that take GENERIC_LIST *
From Paul Eggert <eggert@cs.ucla.edu>
builtins/common.c,examples/loadables/getconf.c
execute_cmd.c,pcomplete.c,subst.c
lib/sh/stringlist.c,lib/sh/stringvec.c
- changes and casts now that the generic list functions are prototyped
From Paul Eggert <eggert@cs.ucla.edu>
3/29
----
aclocal.m4,configure.ac
builtins/common.c,builtins/mkbuiltins.c,builtins/printf.def
include/memalloc.h,include/stdc.h
general.h,jobs.h
pcomplete.c,print_cmd.c
m4/iconv.m4
lib/readline/bind.c,lib/readline/complete.c,lib/readline/display.c
lib/readline/funmap.c,lib/readline/util.c,lib/readline/parens.c
lib/readline/histlib.h
lib/readline/readline.h,lib/readline/rldefs.h,lib/readline/rlstdc.h,lib/readline/rlprivate.h
lib/sh/dprintf.c,lib/sh/snprintf.c,lib/sh/vprintf.c
lib/malloc/shmalloc.h,lib/malloc/imalloc.h,lib/malloc/xmalloc.c
lib/termcap/termcap.h
- stdarg: since we now assume C89 for prototypes at least, always
prefer stdarg to old-style varargs
- SH_VA_START: now use plain old va_start
- don't bother with extern declarations for standard C89 functions
From Paul Eggert <eggert@cs.ucla.edu>
config-bot.h
- PREFER_STDARG: remove
builtins/mkbuiltins.c
execute_cmd.c,unwind_prot.c
unwind_prot.h
- start on ANSI/ISO C changes for the unwind-protect framework
- introduce new unwind-protect function pointer type to replace
Function
From Paul Eggert <eggert@cs.ucla.edu>
3/30
----
builtins/command.def,builtins/fc.def,builtins/read.def,builtins/source.def
builtins/evalfile.c,builtins/evalstring.c
dispose_cmd.c,execute_cmd.c,pcomplete.c,print_cmd.c,subst.c,jobs.c,variables.c
dispose_cmd.h,general.h,trap.h
unwind_prot.c,unwind_prot.h
- rest of work to convert unwind-protect framework to ANSI/ISO C.
Convert unwind-protects to use new shim functions that obey the new
unwind-protect function type
From Paul Eggert <eggert@cs.ucla.edu>
general.h
- STREQ, STREQN: now static inline functions to take advantage of arg
type conversion
pcomplete.c,subst.c
lib/readline/histexpand.c,lib/readline/mbutil.c
- fix size_t subtractions in comparisons to avoid unsigned underflow
externs.h
execute_cmd.c
builtins/times.h
- add prototypes for functions taking clock_t and timeval, make their
declaration in externs.h conditional on NEED_CLOCK_FUNCS_DECL and
NEED_TIMEVAL_FUNCS_DECL, respectively
3/31
----
subst.c
- expand_string_dollar_quote: check for zero-length return from
string_extract_{single,double}_quoted and avoid size_t underflow
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
4/3
---
builtins/evalstring.c
- open_redir_file: treat the case of failing to open the file as a
non-fatal expansion error instead of a (fatal) redirection error.
Report from Zev Weiss <zev@bewilderbeest.net>
4/4
---
lib/readline/vi_mode.c
- _rl_domove_motion_cleanup: d/D require the same special case as c/C
so that a motion command that doesn't move the cursor consumes/deletes
at least one character.
From Emanuele Torre <torreemanuele6@gmail.com>
- _rl_domove_motion_cleanup: ditto for y/Y
- rl_domove_motion_callback: if t/T/;/, fail (return non-zero without
moving point), flag the motion command as having failed (MOVE_FAILED)
4/6
---
subst.c
- command_substitute: save the return status of the child process in
last_command_subst_status; don't assign to last_command_exit_value
in posix mode (posix interp 1150)
execute_cmd.c
- execute_null_command: a simple command without a command word but
with command substitutions now returns last_command_subst_status.
It may or may not have already modified $? depending on posix mode
redir.c
- redir_varvalue: legal_number validity check should be == 0, not < 0
From a report by Grisha Levit <grishalevit@gmail.com>
4/10
----
subst.c
- parameter_brace_expand_rhs: check for namerefs in the variable name
part of the ${name=word} expansion so we can go back and implement
the POSIX semantics of returning "the final value of parameter."
From a report by Grisha Levit <grishalevit@gmail.com>
sig.c,sig.h
- sigpipe_handler: clean up, set $?, and throw to top level on receipt
of a SIGPIPE
- termsig_handler: if the variable builtin_catch_sigpipe is set (it's
not set anywhere yet), call sigpipe_handler instead of terminating
the shell. Still need to make sure a sighandler is installed for
SIGPIPE even if initialize_terminating_signals isn't called
4/14
----
lib/sh/tmpfile.c
- sh_mktmpfd: add support for MT_UNLINK flag, unlinks created filename
before returning fd, fails if the unlink fails for some reason
4/15
----
pathexp.c,pathexp.h
- globsort: support for various glob sorting criteria as defined by
the GLOBSORT variable: name, size, blocks, mtime, atime, ctime.
Default is ascending sort by name, as is traditional. Based on an
idea from Evan Gates <evan.gates@gmail.com>
- setup_globsort: parse the value of the GLOBSORT variable, find
sorting type and whether or not it's ascending or descending
- noquote_glob_filename: glob_filename for programmable completion,
doesn't call quote_string_for_globbing and honors GLOBSORT, dotglob,
and globstar
pcomplete.c
- gen_globpat_matches: call noquote_glob_filename, let that handle
all the variables and GLOB_FAILED
variables.c
- GLOBSORT: support for special variable, call setup_globsort on
set or unset
doc/bash.1,doc/bashref.texi
- GLOBSORT: document variable and its effects on pathname expansion
4/17
----
builtins/complete.def
- build_actions: take an additional char ** arg VNAMEP; if it is non-
null, accept a -V VARNAME option that names an indexed array
variable in which to store the completions.
- compgen_builtin: if the -V option is supplied, store the possible
completions into VARNAME instead of printing them on stdout. From a
patch from Grisha Levit <grishalevit@gmail.com>, idea originally
from konsolebox <konsolebox@gmail.com> back in 2/2022
doc/bash.1,lib/readline/doc/rluser.texi
- compgen: document new -V option
4/18
----
lib/readline/vi_mode.c
- rl_domove_read_callback: call _rl_arg_init before reading digit
argument so prompt gets saved, both callback and non-callback modes
From a report by Grisha Levit <grishalevit@gmail.com>
- rl_vi_arg_dispatch: if we return 0 to end the digit argument and
turn off NUMERICARG, call rl_restore_prompt
lib/readline/histexpand.c
- history_expand_internal: make sure subst_lhs is not null before we
call postproc_subst_rhs.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/display.c
- rl_redisplay: remove redundant code that ends up incrementing lpos
too much for meta characters displayed as octal escape sequences.
From a report by Grisha Levit <grishalevit@gmail.com>
4/19
----
bashline.c
- attempt_shell_completion: handle case where s > e after calls to
find_cmd_start and find_cmd_end, respectively.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/display.c
- update_line: fix setting of `wsatend' when computing ols and nls in
the multibyte case; this caused redisplay to print more characters
than it needed
- update_line: fix calculation of visible_wrap_offset when moving up
to line 0, trying to figure whether or not the visible prompt has
any invisible characters. Fixes C locale issue reported by
Grisha Levit <grishalevit@gmail.com>
4/20
----
lib/readline/text.c
- _rl_rubout_char: update erase-at-end-of-line hack to deal with the
unlikely event that a character in a non-multibyte locale is
displayed using an octal representation.
From a report by Grisha Levit <grishalevit@gmail.com>
execute_cmd.c,execute_cmd.h,builtins/evalstring.c
- interrupt_execution: replaces `executing_list'
- interrupt_execution: set while executing while, for, until, select,
and arithmetic for loops
jobs.c
- wait_for: if a process dies due to a SIGINT while the shell is
executing a loop or a list, act as if the shell got SIGINT. This
is no longer dependent on the compatibility level
From a report by Grisha Levit <grishalevit@gmail.com>
bashline.c
- name_is_acceptable: allow FIGNORE suffixes to match the entire
pathname like tcsh does instead of requiring a non-empty prefix.
From Emanuele Torre <torreemanuele6@gmail.com>
4/23
----
lib/readline/misc.c
- _rl_unsave_line: new function, takes a HIST_ENTRY * as an argument,
generalized rl_maybe_unsave_line
- _rl_alloc_saved_line: allocate a new HIST_ENTRY *, populate it like
rl_saved_line_for_history
- _rl_free_saved_line: free a saved HIST_ENTRY *
- _rl_free_saved_history_line: call _rl_free_saved_line
- _rl_previous_history_internal: new function, internals of
rl_get_previous_history; change rl_get_previous_history to call it
lib/readline/history.h
- HIST_ENTRY_DEFINED: define sentinel if HIST_ENTRY struct defined
lib/readline/rlprivate.h
- _rl_alloc_saved_line,_rl_free_saved_line,_rl_unsave_line: new extern
function definitions
- _rl_free_saved_search_line: new extern definition
lib/readline/search.c
- _rl_saved_line_for_search: use private storage to save current line,
avoid clashes with rl_saved_line_for_history
- _rl_free_saved_search_line,_rl_unsave_saved_search_line: new functions
to manage _rl_saved_line_for_search
- noninc_dosearch,_rl_nsearch_abort: clean up _rl_saved_line_for_search
instead of rl_saved_line_for_history
- rl_history_search_internal: allocate private _rl_saved_line_for_search;
unsave or free it as appropriate
- _rl_history_search_reinit: free up any _rl_saved_line_for_search just
in case
lib/readline/vi_mode.c
- rl_vi_search: free _rl_saved_line_for_search, since that's what the
non-incremental search functions use now
- rl_domove_read_callback: if we read a numeric argument, then a motion
character, make sure the motion character is valid before returning
it and going on
From a report by minipython <599192367@qq.com>
4/27
----
lib/readline/display.c
- _rl_move_cursor_relative: when checking to see whether data is within
the invisible line, make sure to stay within the invisible line
line break boundaries
From a report by minipython <599192367@qq.com>
lib/readline/search.c
- dispose_saved_search_line: new function, either unsave the saved
search line (if we're not at the end of the history) or free it
(if we are). Needs to be immediately followed by call to
make_history_line_current, which resets rl_undo_list
- make_history_line_current: change strategy: rely on callers to
manage _rl_saved_line_for_search and rl_undo_list; just copy the
data from the passed history entry into the line buffer and reset
rl_undo_list
- noninc_dosearch,rl_history_search_internal: call dispose_saved_search_line
before calling make_history_line_current
lib/readline/misc.c
- _rl_start_using_history: free the undo list associated with
_rl_saved_line_for_history, if one exists. Have to watch out for
this causing pointer aliasing problems, maybe add a call to
_hs_search_history_data()
4/28
----
pathexp.c
- sh_globsort: a sort specifier of `nosort' disables sorting completely
doc/bash.1,doc/bashref.texi
- GLOBSORT: document `nosort' sort specifier
bashline.c
- attempt_shell_completion: attempt completion with the empty command
for a null command word on a line with only whitespace following any
optional assignment statements
- attempt_shell_completion: make sure that the start of the command
word is not after rl_point before calling the programmable completion
for the initial word.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/histexpand.c
- history_expand: don't read past the end of the string if it ends with
an incomplete multibyte character
From a report by Grisha Levit <grishalevit@gmail.com>
5/1
---
lib/readline/text.c
- _rl_insert_char: make sure to return 1 in all cases where there are
pending bytes accumulating for a multibyte character
- _rl_insert_char: if the COUNT argument is 0, insert any pending
bytes read so far. The idea is that these bytes were accumulating
to compose a possible multibyte character, and the count of 0
indicates that the current character doesn't contribute to that
because it's bound to an editing command.
- rl_insert, rl_quoted_insert: make sure to call _rl_insert_char
with a 0 count as appropriate to insert any accumulating bytes
From a patch by Grisha Levit <grishalevit@gmail.com>
sig.c
- top_level_cleanup,throw_to_top_level: set variable_context to 0, just
to make sure
execute_cmd.c
- function_misc_cleanup: new function, runs make_funcname_visible and
unlink_fifo_list at the end of execute_function, replaces inline
code
- uw_function_misc_cleanup: unwind-protect function, just calls
function_misc_cleanup. Installed by execute_function.
Partial fix for FUNCNAME bug reported by Grisha Levit <grishalevit@gmail.com>
- execute_builtin: run unwind-protects if evalnest exeeds max
- execute_builtin: run unwind-protects if sourcenest exeeds max
parse.y
- parse_string_to_word_list: set current_token = '\n' on error
- parse_string_to_word_list: if we're executing and not running in
parse_and_execute, call top_level_cleanup before we jump to the
top level. Rest of fix for FUNCNAME bug
- parse_compound_assignment: set last_read_token and current_token to
'\n' on parse error. Fix for alias expansion bug reported by
Grisha Levit <grishalevit@gmail.com>
- parse_compound_assignment: if we're executing and not running in
parse_and_execute, call top_level_cleanup before we jump to the
top level
5/2
---
jobs.c
- run_sigchld_trap: don't freeze and unfreeze the jobs list; move it
to the callers who are running this on SIGCHLD receipt and cannot
deal with jobs disappearing from the list while they're running
- waitchld: if we are running the wait builtin, continue to run the
SIGCHLD trap immediately upon signal receipt, but freeze and
unfreeze the jobs list around the call to run_sigchld_trap().
Fixes issue with `jobs' in a SIGCHLD trap not removing jobs from
the jobs list reported by Guldrelokk <me@rarity.fan>
5/4
---
input.c
- fd_to_buffered_stream: make sure buffers[fd2] is non-null before
turning on SHAREDBUF.
From Emanuele Torre <torreemanuele6@gmail.com>
eval.c
- reader_loop: save and restore EOF_Reached around expanding $PS0,
setting it to 0 for the expansion so it doesn't affect things like
command substitution.
From a report by Grisha Levit <grishalevit@gmail.com>
parse.y
- parse_comsub: handle ${Ccommand; }, where C == space, tab, newline,
or '|'
- read_token_word: understand ${Ccommand; } and call parse_comsub to
parse the contents
- parse_matched_pair: understand ${Ccommand; } inside another paired
construct
- new `funsub' production, like comsub but for ${Ccommand;} nofork
command substitution
execute_cmd.c
- execute_simple_command: if we fork because of pipes in or out, clear
the fifo list, since subshell aren't supposed to inherit fifos
5/8
---
parser.h
- PST_FUNSUBST: new parser state, parsing the command in ${Ccommand;}.
Primarily used to have read_token_word return `}' as a separate
token even if it's not delimited like a reserved word
subst.h
- SX_FUNSUB: new flag, tell xparse_dolparen we are parsing the command
in a ${Ccommand;} nofork command substitution
parse.y
- xparse_dolparen: handle parsing ${Ccommand;} nofork command
substitution like parse_comsub
- read_token: if we're parsing a foreground command substitution,
treat a word that begins with an unquoted `}' as a `}' token to
terminate the ${Ccommand;} construct without requiring that the
close brace be delimited like a reserved word
- no_semi_successors: add DOLBRACE
- reserved_word_acceptable: add DOLBRACE
subst.c
- extract_function_subst: like extract_command_subst, but for nofork
command substitutions; calls xparse_dolparen with the SX_FUNSUB
flag to differentiate
- string_extract_double_quoted,extract_delimited_string,
extract_heredoc_dolbrace_string,extract_dollar_brace_string,
param_expand: call extract_function_subst as appropriate
- function_substitute: like command_substitute, but for nofork command
substitutions. Just a stub for now
5/11
----
jobs.[ch]
- pipeline_saver: already_making_children now saved and restored as
part of the struct; no longer need a separate variable
- save_pipeline,restore_pipeline: save already_making_children to struct
parse.y
- parse_comsub,xparse_dolparen: handle `(' as the first char of a
funsub (ksh93 supports that)
subst.c
- function_substitute: complete implementation; handle both funsubs
and valsubs (need different terminology); dummy up a fake shell
function so local variables and `return' work; do the right thing
with process groups
- executing_funsub: flag for the rest of the shell to know we're
expanding a funsub; used by parse_and_execute
builtins/evalstring.c
- parse_and_execute: check executing_funsub to do the right thing with
alias expansion and posix mode
5/12
----
doc/bash.1,doc/bashref.texi
- function substitution (or lambda substitution, or nofork command
substitution): document
5/15
----
subst.c
- function_substitute: make sure to decrement variable_context in the
unwind-protects since we don't unwind_protect it individually.
Report from Oguz <oguzismailuysal@gmail.com>
5/17
----
configure.ac
- i370 machines cannot use the bash malloc
Patch from Igor Todorovski <itodorov@ca.ibm.com>
support/signames.c
- initialize_signames: add support for z/OS signals.
Patch from Igor Todorovski <itodorov@ca.ibm.com>
lib/glob/smatch.c
- collseqcmp: new name for collequiv[_wc], that function apparently
exists in libc on z/OS
Patch from Igor Todorovski <itodorov@ca.ibm.com>
jobs.c
- mark_all_jobs_as_dead: make sure to reset js.j_ndead to the right
number of jobs in the array
execute_cmd.c
- execute_while_or_until: move call to REAP() after the action
executes, like other loop functions
shell.c,parse.y,lib/intl/gettextP.h
- add some __MVS__ checks for z/OS systems
5/18
----
jobs.c
- wait_for_any_job: catch jobs that can terminate and be reaped
when we call UNBLOCK_CHILD between the loop where we check the
jobs list for dead jobs and the loop where we check for running
jobs and poll for them with wait_for().
Fixes bug reported by Aleksey Covacevice <aleksey.covacevice@gmail.com>
5/20
----
subst.c
- read_comsub: quote CTLNUL if it's in $IFS and we're parsing the
RHS of an assignment statement
- comsub_quote_string: ditto
- comsub_shouldquote: break code that decides whether to CTLESC escape
a character read from a command substitution or $REPLY into its own
inline function; change read_comsub/comsub_quote_string callers
5/21
----
subst.c
- quote_escapes_internal: use ifs_cmap instead of iterating through
ifs_value to set skip_ctlesc and skip_ctlnul
5/23
----
parser.h
- remove `(' from FUNSUB_CHARS
parse.y
- parse_comsub: don't bother with `(' as one of the FUNSUB_CHARS
doc/bash.1,doc/bashref.texi
- command substitution: remove mention of `(' as a valid character
following the open brace in nofork command substitution
5/24
----
parse.y
- parse_comsub: avoid adding `;' to an empty ${ command substitution
- parse_comsub: if open == '{', push back a newline we read into
peekc to get PS2 prompting right.
From a report by Grisha Levit <grishalevit@gmail.com>
subst.c
- skip_double_quoted: pass the SX_COMPLETE flag down to
extract_dollar_brace_string in case it contains an unclosed command
substitution.
From a report by Grisha Levit <grishalevit@gmail.com>
5/25
----
shell.c
- make sure shell_initialized is set to 1 before running -c command
make_cmd.c
- make_function_def: initialize source_file to something other than
`main' or `environment' if the shell is not interactive.
From a report from Emanuele Torre <torreemanuele6@gmail.com>
parse.y
- save_token_state,restore_token_state: save and restore token_to_read
- read_token_word: if we read EOF in an interactive shell, set
token_to_read to yacc_EOF and EOF_Reached to 1 so the token will
be delimited but the next call to read_token returns yacc_EOF
- handle_ignoreeof: broke the code that checks eof_encountered and
possibly exceeds the ignoreeof limit out into a separate public
function, called from handle_eof_input_unit
eval.c
- reader_loop: if EOF_Reached is set in an interactive shell after
parse_command and execute_command, and ignoreeof has been enabled,
check for ignoreeof with handle_ignoreeof and reset EOF_Reached
back to 0 if we should not exit. This can occur when EOF delimits
a simple command (simple_command_terminator)
From a report by Grisha Levit <grishalevit@gmail.com>
5/27
----
lib/readline/mbutil.c
- _rl_get_char_len: if SRC is "", make sure to return 0
lib/readline/isearch.c
- _rl_isearch_callback: if _rl_search_getchar returns EOF, return 1
to abort search; if it returns with RL_STATE_ISEARCH unset, return
1 (handling a signal can turn it off via _rl_isearch_cleanup)
5/29
----
lib/readline/text.c
- _rl_insert_char, rl_quoted_insert: minor fixes from Grisha Levit
builtins/printf.def
- bexpand: use the same calculation for the size of the return buffer
as ansicstr().
From a report by Grisha Levit <grishalevit@gmail.com>
locale.c
- locale_setblanks: work around problem with macOS where isblank(x)
incorrectly returns true for characters 0x80-0xff in a UTF-8 locale
From a report by Grisha Levit <grishalevit@gmail.com>
- set_default_locale_vars,set_locale_vars,reset_locale_vars: make sure
we call locale_setblanks after setting/resetting locale_utf8locale,
since we use that in locale_setblanks
lib/sh/smatch.c
- charseqcmp,is_cclass,FOLD: make sure we don't treat chars >= 0x80
as valid in a UTF-8 locale, since they are multibyte characters.
From a report by Grisha Levit <grishalevit@gmail.com> with a full
explanation in http://www.openradar.me/FB9973780
5/30
----
builtins/enable.def
- enable_builtin: don't call dlopen with a null pathname, it will
succeed. Report from Wiley Young <wyeth2485@gmail.com>
lib/readline/readline.c
- _rl_dispatch_subseq: if a user binds do-lowercase-version to something
that isn't an uppercase character, flag an error rather than recurse.
From a report by Grisha Levit <grishalevit@gmail.com>
5/31
----
builtins/enable.def
- enable_builtin: don't try to load a builtin that's not found if
the -n flag is supplied.
From a report from Emanuele Torre <torreemanuele6@gmail.com>
parse.y
- parse_comsub: use was_word code again to make sure we add a closing
`;' if the last token parsed before the closing ';' or '\n' was a
word, no matter what character ends it.
From a report by Grisha Levit <grishalevit@gmail.com>
aclocal.m4,configure.ac,findcmd.c
- IBM z/OS changes from Igor Todorovski <itodorov@ca.ibm.com>
6/1
---
parse.y
- shell_getc: if the shell is not interactive and reading from a
buffered stream or stdin, and not expanding an alias, add a
backslash to a line ending with <backslash><EOF> like we do when
reading from a string. This prevents a backslash-newline from
being discarded when we are removing backslash-newlines from the
input, since we will add a newline to shell_input_line in this case.
From a report by Rob Landley <rob@landley.net>
parse.y
- parse_compound_assignment: check and compensate for an alias being
popped out from underneath this function by read_token() (e.g.,
alias L='m=("x")'. Since we don't push a new input source, we should
never restore pushed_string_list from the saved parser state, but
we check and only do this if we were expanding an alias when this
function was called.
From a report by Wiley Young <wyeth2485@gmail.com>
6/2
---
print_cmd.c
- print_if_command: make sure to print any pending here-documents after
printing the test.
From https://bugzilla.redhat.com/show_bug.cgi?id=2211214
builtins/enable.def
- if -n is supplied with -f, attempt to load the builtin but mark it
as disabled after loading.
Suggested by Robert Elz <kre@munnari.OZ.AU>
builtins/evalfile.c
- _evalfile: increment retain_fifos, so we don't delete any FIFOs or
pipes we inherited before sourcing this file; restore original value
before we return.
From https://savannah.gnu.org/support/index.php?110883
6/3
---
subst.c
- expand_string_dollar_quote: if singlequote_translations is set, there
is a chance for a use-after-free of `t'.
From a report by Grisha Levit <grishalevit@gmail.com>
6/7
---
jobs.c,nojobs.c,jobs.h
- job_control_active_p: new function, returns 1 if job control is
currently enabled and we have given away the terminal
builtins/evalstring.c
- should_suppress_fork: don't optimize away the fork if job control is
active because we need to call end_job_control and give the terminal
back to the original process group when this command finishes. Call
job_control_active_p() to check this.
Report from Andrew Hamon <and.ham95@gmail.com>
6/8
---
shell.c
- ssh_run_startup_files: new variable, set by run_startup_files if
the shell decides it's being run by ssh and runs bashrc (only if
SSH_SOURCE_BASHRC is defined). Non-zero while the startup files
are being run. Not used by any other part of the shell yet.
6/12
----
arrayfunc.h
- new inline functions to convert between assignment flags (ASS_*),
array value flags (AV_*), and valid array flags (VA_*)
shell.h
- include arrayfunc.h after subst.h and variables.h so all the values
for the new inline functions are available
variables.c
- bind_int_variable: use convert_assign_flags_to_validarray_flags and
convert_assign_flags_to_arrayval flags instead of inline assignments
builtins/common.c
- builtin_bind_variable: use convert_assign_flags_to_validarray_flags
instead of inline assignments
arrayfunc.c
- assign_array_element: use convert_assign_flags_to_arrayval_flags
instead of inline code
- assign_array_element_internal: use convert_assign_flags_to_arrayval_flags
to pass the right values to array_expand_index
- assign_array_var_from_string: since expand_compound_array_assignment
performs one round of expansion on the subscripts, make sure to add
ASS_NOEXPAND (if assoc_expand_once is set) and ASS_ALLOWALLSUB to the
flags we pass to assign_compound_array_list
- unbind_array_index: use convert_validarray_flags_to_array_value_flags
to pass the right values to array_expand_index
- array_expand_index: uncomment code tagged for bash-5.3 that checks
AV_NOEXPAND and suppresses call to expand_arith_string if it's set.
This set of changes extends assoc_expand_once to indexed arrays
arrayfunc.[ch],execute_cmd.c,expr.c,test.c,builtins/common.c,builtins/mkbuiltins.c
builtins/declare.def,builtins/set.def,builtins/shopt.def
- array_expand_once: new name for internal assoc_expand_once variable
6/13
----
builtins/shopt.def
- array_expand_once: new option, replaces assoc_expand_once
doc/bash.1,doc/bashref.texi
- array_expand_once: document new shopt option
6/15
----
lib/readline/complete.c
- rl_full_quoting_desired: new application-settable variable, if set
to non-zero by an application completion function, all completions
will be quoted as if they were filenames, subject to the value of
rl_filename_quote_characters. Initialized to 0 and reset to 0
by set_completion_defaults.
From a contribution by Grisha Levit <grishalevit@gmail.com>
- QUOTING_DESIRED: new macro to check whether we should quote completions
lib/readline/readline.h
- rl_full_quoting_desired: extern declaration
lib/readline/doc/rltech.texi
- rl_full_quoting_desired: document
configure.ac
- bumped version to 5.3-devel
pcomplete.h
- COPT_FULLQUOTE: new compspec option, for rl_full_quoting_desired
pcomplete.c
- pcomp_set_readline_variables: set rl_full_quoting_desired according
to COPT_FULLQUOTE
builtins/complete.def
- fullquote: add new complete/compopt option value
doc/bash.1,lib/readline/doc/rluser.texi
- fullquote: document new complete/compopt option
lib/sh/timeval.c
- timeval_to_secs: sfp argument is now a long *; there is a new
maxval argument (always 10^6 for now) that determines how to
round; returns tv_usec in *sfp if maxval == 10^6; otherwise
return value is basically tv_usec/maxval with rounding
- print_timeval: change argument type in call to timeval_to_secs
lib/sh/clock.c
- clock_t_to_secs: sfp argument is now a long *
- print_clock_t: change argument type in call to clock_t_to_secs
externs.h
- timeval_to_seconds, clock_t_to_seconds: change prototypes
execute_cmd.c
- mkfmt,print_formatted_time: fractional seconds arguments are now
longs
- mkfmt: accept precisions up to 6; since sec_fraction is in usecs,
perform any necessary rounding for precisions < 6
- print_formatted_time: allow precision specifiers up to 6; default
is still 3
- time_command: fractional seconds variables are now long; add new
argument to timeval_to_secs (always 1000000)
- time_command: if we call clock_t_to_secs, multiply the return
fractional seconds value by 1000 to convert it from msec to usec
doc/bash.1,doc/bashref.texi
- TIMEFORMAT: document that the max precision is now 6
From https://savannah.gnu.org/support/?110343
6/16
----
variables.c
- get_monoseconds: use clock_gettime to return the value of the
system's monotonic clock, if available
- BASH_MONOSECONDS: a new dynamic variable that returns the value of
get_monoseconds
From a suggestion by William Kennington <wak@google.com>
doc/bash.1,doc/bashref.texi
- BASH_MONOSECONDS: document
trap.c
- save_bash_trapsig,set_bash_trapsig,restore_bash_trapsig: functions
to manage value of BASH_TRAPSIG
- run_pending_traps: save and restore the value of BASH_TRAPSIG; set
it to the numeric signal number of the trap being run while it's
executing
From a feature request by Eric Marceau <ericmarceau@rogers.com>
- _run_trap_internal,run_exit_trap: save and restore BASH_TRAPSIG;
make sure it's set appropriately
doc/bash.1,doc/bashref.texi
- BASH_TRAPSIG: document
builtins/declare.def
- declare_internal: if declare is supplied -f and an argument that
looks like an assignment statement, fail only if there is not a
function with that name already defined.
From a report from Emanuele Torre <torreemanuele6@gmail.com>
back in 12/22
jobs.c
- wait_for: make checkwinsize work in subshell commands started from
interactive shells
New feature request by Kerin Millar <kfm@plushkava.net>
print_cmd.c
- semicolon: don't return immediately unless a preceding `&' is
itself preceded by a space, as the rest of the printing code prints
asynchronous commands.
Report and patch by Grisha Levit <grishalevit@gmail.com>
6/17
----
arrayfunc.c
- arrayvar_copyval: copy an array or hash table from shell variable
V1 to V2
arrayfunc.h
- arrayvar_copyval: extern declaration
subst.h
- ASS_NOTEMPENV: new flag for bind_variable and assignments
variables.c
- bind_variable: if ASS_NOTEMPENV is in FLAGS, don't bother calling
bind_tempenv_variable
builtins/declare.def
- declare_internal: if we find the variable in the temporary
environment, call bind_variable with the ASS_NOTEMPENV flag since
we are already dealing with a variable from the temporary environment
- declare_internal: if we bind a new global variable because we're
modifying a variable from the temporary environment, make sure to
call arrayvar_copyval to copy array variables from the temporary
environment to the global scope
variables.c
- push_temp_var: if we are pushing an array variable, make sure to
call arrayvar_copyval on the new variable
Final fix for bug reported by Wiley Young <wyeth2485@gmail.com>
- push_posix_tempvar_internal: call arrayar_copyval instead of using
inline code
6/19
----
lib/sh/shmatch.c
- sh_regmatch: use builtin_find_indexed_array to allow a local copy
of BASH_REMATCH.
From https://lists.gnu.org/archive/html/bug-bash/2022-05/msg00052.html
execute_cmd.c
- execute_in_subshell: tentative change to clear procsub list after
performing redirections, so nothing in a redirection can affect
what's in the subshell.
From https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00114.html
test.c
- binary_operator: in posix mode, the < and > operators compare strings
using the current locale (strcoll).
From https://www.austingroupbugs.net/view.php?id=375
bashline.c
- bash_default_completion: make sure that command completion adds the
trailing `/' suffix for directories even if the directory name is
the same as the common prefix of matches.
From https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00034.html
lib/readline/kill.c
- rl_vi_yank_pop: make repeated invocations of vi-yank-pop cycle
through the kill ring just like in emacs mode, even when point
is at the end of the line.
From https://lists.gnu.org/archive/html/bug-bash/2022-08/msg00105.html
parse.y
- parse_comsub: set variables if the last token (last_read_token) is
`;', `\n', or `&', in addition to was_word
- parse_comsub: if the last read token was a newline (was_newline),
terminate the comsub with a newline instead of a semicolon; keeps
the line numbers more consistent.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/anonfile.c
- anonopen: use memfd_create if it is available, fall through to
traditional Unix/POSIX implementation if it fails
6/20
----
parse.y
- yy_string_unget: don't push EOF back to a string, like the other
unget functions
6/21
----
parse.y
- read_a_line: don't push an EOF back into the string or line if the
line ends in a backslash.
From a report by Rob Landley <rob@landley.net>
6/22
----
lib/readline/input.c
- rl_gather_tyi: make sure result is initialized
lib/readline/kill.c
- _rl_read_bracketed_paste_prefix: make sure key is initialized
builtins/read.def
- read_builtin: make sure pass_next and saw_escape are initialized
before a possible goto
- read_builtin: make sure to initialize prevset for very short
timeouts
subst.c
- function_substitute: make sure tflag is initialized even when we
don't call read_comsub, since we return it in ret->flags
All from a report by Grisha Levit <grishalevit@gmail.com>
builtins/complete.def
- compgen_builtin: use array_from_argv to assign elements of the
stringlist to the array variable.
Update from Grisha Levit <grishalevit@gmail.com>
builtins/cd.def
- bindpwd: fix seg fault from an unlikely set of circumstances
From a report by Grisha Levit <grishalevit@gmail.com>
arrayfunc.h
- convert_validarray_flags_to_arrayval_flags: initialize avflags
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/anonfile.c
- anonopen: set *fn if memfd_create is used
From a report by Grisha Levit <grishalevit@gmail.com>
6/23
----
arrayfunc.c
- bind_assoc_var_internal: free key to fix small leak if assign_func
used
- quote_compound_array_word: free value to fix small leak
builtins/evalstring.c
- parse_and_execute: free parsed command on failed function definition
import
- open_redir_file: free FN if we're not passing it back to the caller
subst.c
- param_expand: free TEMP1 in code paths that don't do it now
bashline.c
- bash_command_name_stat_hook: if we modify *NAME, free the old value
examples/loadables/{kv,stat}.c
- bind_assoc_variable is caller-free VALUE, so free when needed and
don't allocate a new copy if not
All from a report by Grisha Levit <grishalevit@gmail.com>
6/24
----
lib/readline/complete.c
- rl_menu_complete: use _rl_free_match_list instead of just freeing
MATCHES if we have too many possible completions to display.
From a report by Grisha Levit <grishalevit@gmail.com>
6/25
----
eval.c
- reader_loop: make sure to allow exit builtin (code == EXITBLTIN) to
exit the shell when ignoreeof is set
From a report by Grisha Levit <grishalevit@gmail.com>
6/26
----
lib/readline/complete.c
- complete_sigcleanarg_t: new struct to hold match list and saved line
buffer for cleanup on receipt of SIGINT
- _rl_complete_sigcleanup: use new sigcleanarg_t struct and free both
members
- rl_complete_internal: whenever we display the match list, set up to
clean the matches and saved line buffer in the event of a SIGINT
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/signals.c
- _rl_handle_signal: if readline is compiled to include callbacks, only
call rl_echo_signal_char if we're not in callback mode or the
application has set rl_persistent_signal_handlers, leaving any
application signal handler to call it (or not) otherwise.
From a discussion with Andrew Burgess <aburgess@redhat.com>
lib/glob/glob.c
- glob_filename: if ARRAY == TEMP_RESULTS, make sure to free TEMP_RESULTS
after copying the filenames out of ARRAY, since we either assigned it
directly or glob_dir_to_array returned it because the dirname was
the empty string.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/rltypedefs.h
- Function: only compile in these obsolete typedefs if
WANT_OBSOLETE_TYPEDEFS is defined
print_cmd.c
- xtrace_print_assignment,xtrace_print_word_list: prioritize checking
for characters that need $'...' printing over shell metacharacters
so that strings containing both get the $'...' treatment
From a report by Grisha Levit <grishalevit@gmail.com>
6/27
----
subst.c
- skip_double_quoted: make sure to call extract_function_subst with
the SX_NOALLOC flag
From a report by Grisha Levit <grishalevit@gmail.com>
trap.c
- _run_trap_internal: if we're running a trap but shell_eof_token is
set, this means we're somehow running a trap while parsing a
command substitution (weird set of circumstances). Call
reset_parser and unset shell_eof_token if shell_eof_token is set
From a report by Wiley Young <wyeth2485@gmail.com>
builtins/setattr.def
- set_var_attribute: don't set the att_propagate attribute unless the
variable whose attribute is being modified is in the temporary
environment for this builtin, not any previous temporary environments
(like the temp env for a function call, or a special builtin like
`.')
variables.c
- push_posix_temp_var: if we have an array variable we're trying to
push up here, use arrayvar_copyval to copy the value correctly
arrayfunc.c
- arrayvar_copyval: make sure that V2 ends up being the same type of
array as V1 (att_array or att_assoc), since we're copying the value.
Fixes issue reported by Grisha Levit <grishalevit@gmail.com>, but
with the previous fix to set_var_attribute, it's not needed
- assign_compound_array_list: check for integer overflow if the max
index of the array is already INT_MAX.
From a report from Emanuele Torre <torreemanuele6@gmail.com>
- assign_array_var_from_word_list: ditto
6/28
----
pcomplete.c,bashline.c
- uw_restore_parser_state,uw_rl_set_signals: move to bashline.c so the
general readline support can use them
bashline.h
- uw_restore_parser_state,uw_rl_set_signals: extern declarations
bashline.c
- unset_readline_variables,uw_unset_readline_variables: function to
unset READLINE_{LINE,POINT,MARK,ARGUMENT} and its unwind-protect
counterpart
- bash_execute_unix_command: add unwind-protect to free up allocated
memory
Report and patch by Grisha Levit <grishalevit@gmail.com>
doc/bash.1,doc/bashref.texi
- BASH_ARGC,BASH_ARGV,BASH_SOURCE,BASH_LINENO: note that these variables
may not be assigned to or unset
6/29
----
builtins/declare.def
- declare_internal: attempting to assign to a noassign variable is no
longer an assignment error; the attempt is just ignored
arrayfunc.c
- find_or_make_array_variable: take a new flag value, 4: means to
return noassign variables as themselves instead of NULL without
performing the assignment so the caller can handle them differently.
- assign_array_from_string: pass flags & 4 to find_or_make_array_variable
so we can simply ignore attempted assignments to noassign array
variables instead of treating them as assignment errors
From a report by Kerin Millar <kfm@plushkava.net>
expr.c
- exppower: only report negative exponent error if noeval == 0.
Fixes issue reported by Steffen Nurpmeso <steffen@sdaoden.eu>
6/30
----
lib/sh/anonfile.c
- anonopen: add support for using shm_open or shm_mkstemp to create
an anonymous file using POSIX shared memory
configure.ac
- if --enable-static-link is supplied, add -static to LDFLAGS on
Linux if opt_profiling isn't enabled
From a report from Emanuele Torre <torreemanuele6@gmail.com>
print_cmd.c
- make_command_string_internal: if we're recursively printing a list
(connection) with more than two elements, don't print any deferred
here-documents after the make_command_string_internal on the right
side of the connection unless we're at the end of the list
(printing_connection == 1). This way the caller gets to add the
appropriate connector before printing the deferred here-documents.
From a report by Grisha Levit <grishalevit@gmail.com>
- make_command_string_internal,print_group_command: after we call
PRINT_DEFERRED_HEREDOCS and follow it with a closing `)' (subshell)
or `}' (group command), we can set was_heredoc to 0 because we are
no longer printing a here-document
From a report by Grisha Levit <grishalevit@gmail.com>
7/3
---
lib/readline/complete.c
- rl_username_completion_function: simplify things by just skipping the
function body if HAVE_GETPWENT is not defined.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/ufuncs.c
- fsleep: broke into three functions: nsleep, which uses nanosleep,
ssleep, which uses select/pselect, and ancientsleep, which uses
sleep. Prefer nanosleep, use the others depending on what's
defined.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
arrayfunc.c
- assign_compound_array_list: now behaves more like a series of
assignment statements (a=(one two) is more like a[0]=one a[1]=two)
in terms of error handling -- break after the first invalid
assignment -- and return value -- now return int, 0 on failure and
1 on success so the callers can throw assignment errors
- assign_compound_array_list: if we have an explicit [subscript]=value
assignment, use the negative-indices-count-back-from-the-end strategy;
otherwise use last_ind and throw an error on overflow. This is like
standalone assignment statements
- assign_array_var_from_string: catch new return value from
assign_compound_array_list; return NULL if assign_compound_array_list
returns failure
subst.c
- do_compound_assignment: if assign_compound_array_list or
assign_array_var_from_string return error (0 or NULL, respectively),
treat as an assignment error similar to assigning to a readonly
variable
Inspired by a report from Emanuele Torre <torreemanuele6@gmail.com>
arrayfunc.h
- assign_compound_array_list: new return type
7/5
---
builtins/enable.def
- enable_builtin: make sure dynamic builtin loading and unloading
updates the `enabled' and `disabled' programmable completion lists.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
doc/bash.1,doc/bashref.texi
- hash: add note that assigment to PATH clears the hash table.
Report by Sebastian Carlos <sebaaa1754@gmail.com>
lib/readline/complete.c
- rl_filename_completion_function: make sure the results of
*rl_filename_rewrite_hook are freed consistently if the function
returns newly-allocated memory
From a report and patch by Grisha Levit <grishalevit@gmail.com>
back in May
7/6
---
builtins/cd.def
- cd_builtin: if $OLDPWD is set by the user or script to something
that's not a full pathname, allow it to use $CDPATH.
From a report by Dustin Boyd <chronokitsune3233@gmail.com>
7/7
---
shell.h
- user_info: add members for saved uid and saved gid
shell.c
- uidget: if we have setresuid/setresgid, get the saved uid and saved
gid so we can set them if we disable privileged mode
- disable_priv_mode: only call setuid/setresuid and setgid/setresgid
if the euid (egid) != uid (gid). If we have setresuid/setresgid,
add a check whether the saved uid (gid) isn't the same as the real
uid (gid). Potentially saves a couple of system calls.
Fixes Android issue, patch by Grisha Levit <grishalevit@gmail.com>
test.c
- unary_operator: only support historical handling of -t and its
optional argument when not in posix mode
- unary_test: print an error if the argument to -t is not a number
- unary_operator: only make the argument to -t optional if the
next argument is -a or -o and we are using the historical algorithm
(argc >= 5), otherwise force it to be a number and print an error
message if it's not
From a report by Stephane Chazelas <stephane@chazelas.org>
doc/bash.1,doc/bashref.texi
- added note about test/[ sorting using the current locale with the
`<' and `>' operators when in posix mode
- added note about the integer argument to test -t being required
when in posix mode
- added note recommending against the use of test with 5 or more
arguments in favor of combining multiple instances of test with
&& or ||
From a report by Stephane Chazelas <stephane@chazelas.org>
7/10
----
jobs.c
- start_job: turn off (on) the J_ASYNC flag depending on whether the
job is being started in the foreground (background). It matters now
that we use IS_ASYNC to determine whether to give the terminal
back to the shell's process group.
From a report by Grisha Levit <grishalevit@gmail.com>
bashline.c
- command_word_completion_function: if we have a glob pattern that
expands to multiple words, dispose of the list before returning NULL.
From a report by Grisha Levit <grishalevit@gmail.com>
variables.c
- makunbound: if we're unsetting a local variable, preserve the export
attribute even if the variable's not in the temporary environment
Tentative fix, compatible with other POSIX shells (except the BSD
variants of ash)
7/12
----
lib/sh/unicode.c
- include <langinfo.h> if HAVE_LANGINFO_CODESET is defined, use
nl_langinfo (CODESET) if HAVE_LANGINFO_CODESET is define, since
we no longer check for nl_langinfo. This is what locale.c does.
7/15
----
lib/readline/display.c
- rl_redisplay: rudimentary code to handle some cases where the line
buffer consumes more than the physical number of screen lines. It's
not a screen editor, but it handles some of the common cases.
From https://bugs.launchpad.net/ubuntu/+source/bash/+bug/2024628
7/17
----
builtins/printf.def
- getwidestr: make sure to force mbsrtowcs to convert the closing NULL
so the wide-character string is NULL-terminated.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/sh/shmatch.c
- strregerror: new function to return regerror(3) error message text
in allocated memory
- sh_regmatch: add an additional argument to hold the error message
from regerror(3), in newly-allocated memory; generated by call to
strregerror() on regcomp(3) failure
From a patch by Grisha Levit <grishalevit@gmail.com>
externs.h
- sh_regmatch: update extern declaration
execute_cmd.c
- execute_cond_node: pass pointer to buffer to return any error
message; if sh_regmatch returns 2, use a non-NULL error buffer in
the error message.
lib/readline/bind.c
- _rl_get_string_variable_value: return the values for
active-region-start-color (_rl_active_region_start_color) and
active-region-end-color (_rl_active_region_end_color) if they
are set.
Fixes bind -v issue reported by Sebastian Carlos <sebaaa1754@gmail.com>
- _rl_get_string_variable_value: if the history is stifled, make
sure we report the history size as < 0 so the output of bind -v
can be reused as input.
Fixes bind -v issue reported by Sebastian Carlos <sebaaa1754@gmail.com>
7/20
----
pathexp.c
- quote_string_for_globbing: don't bother backslash-quoting multibyte
characters. It matters for macOS and doesn't make a difference for
other systems, and those aren't going to be special globbing chars.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/glob/glob.c
- glob_vector: normalize the pattern with fnx_fromfs so we make sure
it's also in NFC on macOS (other systems don't care). This is a
POSIX violation, but part of correcting the longtime HFS+ (and Finder)
misfeature
lib/readline/complete.c
- rl_filename_completion_function: if the application sets a filename
rewrite hook, use it to rewrite the filename we're matching as well
as filenames read with readdir().
[SUPERSEDED BY CHANGE OF 10/4/2023]
From a report by Grisha Levit <grishalevit@gmail.com>
7/21
----
pathexp.c
- quote_string_for_globbing: see if we can get away without backslash-
quoting single-byte characters that aren't CTLESC or characters
that are special to EREs or BREs, even if they're quoted
bashline.c
- bashline_set_filename_hooks: convenience function to set the
directory hook and the filename rewrite and stat hooks; call from
other places in the file so these are set consistently
bashline.h
- bashline_set_filename_hooks: extern declaration
builtins/complete.def
- compgen_builtin: make sure to set the directory and filename hooks
so compgen called from a script works more like compgen called
from a word completion context.
Inspired by a report by Grisha Levit <grishalevit@gmail.com>
doc/Makefile.in
- bash.pdf: use groff -T pdf to create, instead of creating postscript
and then using ghostscript
7/24
----
jobs.c
- start_job: unconditionally send SIGCONT to the job we just started,
even if we think it was already running, to reduce the window for a
potential race condition, and only change the state to RUNNING if
the SIGCONT succeeds or if the process has terminated so we can
clean it up later.
Report from Earl Chew <earl_chew@yahoo.com>
make_cmd.c
- make_simple_command,make_bare_simple_command: now take line number as
an argument; used instead of line_number to set the line associated
with the simple command
make_cmd.h
- make_simple_command,make_bare_simple_command: change prototype
parse.y,builtins/command.def,builtins.jobs.def
- make_simple_command,make_bare_simple_command: change callers
7/25
----
parse.y
- read_token_word: try to keep track of whether we are parsing the
first word of a simple command and set simplecmd_lineno if we
are. We start a simple command when we return ASSIGNMENT_WORD
or WORD in a command token position. This gives better values for
$LINENO in multi-line simple commands
- redirection: set simplecmd_lineno if it's -1, meaning this is a
simple command with a leading redirection or a null command with
only a redirection
- pass simplecmd_lineno to make_simple_command if we are starting a
simple command (the first ELEMENT)
- parse_comsub,xparse_dolparen: save and restore simplecmd_lineno
- simple_command,function_def production: reset simplecmd_lineno to -1
after parsing a simple command or a function declared as WORD()
7/26
----
doc/bash.1,doc/bashref.texi
- xpg_echo: add description of how this can be used to suppress echo
option interpretation
Inspired by report from Zachary Santer <zsanter@gmail.com>
7/27
----
builtins/printf.def
- printf_erange: make out-of-range errors conversion errors even if
the conversion function fully consumes the argument.
From a report by thomas@habets.se
7/31
----
lib/readline/rltypedefs.h
- rl_macro_print_func_t: typedef for a function to print macro key
bindings
lib/readline/bind.c
- rl_macro_display_hook: hook function to call if the application
wants to display a key sequence bound to a macro
- rl_macro_dumper: if rl_macro_display_hook is non-NULL, call it to
display the macro value (after `untranslating' it to add back any
required backslashes)
lib/readline/doc/rltech.texi
- rl_macro_display_hook: add description
pathexp.c
- glob_char_p: add the characters that are special within BRE bracket
expressions.
Inspired by a report by Grisha Levit <grishalevit@gmail.com>
bashline.c
- bind_keyseq_to_unix_command: allow whitespace to separate the keyseq
and the command string, but require the command string to be
surrounded by double quotes if it is. If we get a whitespace
separator, call rl_macro_bind so we get the string `translated'
according to how readline does it (backslash-escape sequences
processed, etc.)
- print_unix_command: function to print a key sequence and a unix
command bound to it from cmd_xmap, using a space separator
- print_unix_command_map: make sure to set rl_macro_display_hook to
print_unix_command before calling rl_macro_dumper to print the
bound command strings
8/1
---
builtins/read.def
- read_builtin: saw_escape is now a count of CTLESCs we added to the
input
- read_builtin: since we increment saw_escape when we add a CTLESC,
decrement it when we remove one from the input (\\\n, \\\0)
- read_builtin: remove the CTLESC we added if we have a backslash-
escaped NULL character ('\0')
- read_builtin: if the input ends with an unescaped newline, remove
the CTLESC we added
From a report by Grisha Levit <grishalevit@gmail.com>
8/2
---
builtins/history.def
- history_builtin: if history -[anrw] is used without a filename
argument, and HISTFILE is unset or null, return success immediately
From a report by Grisha Levit <grishalevit@gmail.com>
doc/{bash.1,bashref.texi},lib/readline/doc/hsuser.texi
- history: document that if filename is not supplied, and HISTFILE is
unset or null, the [-anrw] options have no effect
8/3
---
pcomplete.c
- gen_progcomp_completions: if the actual compspec that's run is
something different from what's typed (full pathname, alias, etc.),
set pcomp_curcmd to the word corresponding to the actual compspec,
instead of what was typed. This is what eventually gets used by
the compopt builtin's output.
From a report by Grisha Levit <grishalevit@gmail.com>
execute_cmd.c
- execute_coproc: in parent, close /dev/fd FIFOs only if we're not
executing a shell function, like other calls to unlink_fifo_list().
Report from Hal Blackburn in
https://savannah.gnu.org/support/index.php?110910
subst.c
- do_compound_assignment: don't attempt to convert a global associative
array to an indexed array with declare -g.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
8/7
---
lib/readline/bind.c
- rl_print_keybinding: new function, prints a the key bindings for a
single function specified by name
- rl_function_dumper: call rl_print_keybinding for every function name
lib/readline/readline.h
- rl_print_keybinding: extern declaration
lib/readline/bind.c
- _rl_untranslate_macro_value: make sure characters betweeen 128 and
159 (metafied control characters) are printed using the \M-\C-
notation instead of directly writing the control character.
From a report and patch by Grisha Levit <grishalevit@gmail.com>
- rl_get_keyname: if a key binding shadows a function or macro, print
the ANYOTHERKEY binding as a null string
From a report and patch by Grisha Levit <grishalevit@gmail.com>
- rl_untranslate_keyseq: make changes analogous to
_rl_untranslate_macro_value so that we don't print control characters
directly
- rl_invoking_keyseqs_in_map: if the key corresponds to a keymap, use
_rl_get_keyname to get its text representation, so this function
returns consistent results
- rl_translate_keyseq: if convert-meta is on, don't convert meta chars
that are, e.g., \M-\C-@ (128) into \e followed by a NUL, resulting
in truncated key sequences. Just don't honor convert-meta in this
case
8/8
---
bashhist.c
- bash_history_no_expand_chars: add the rest of the shell
metacharacters so we don't get empty history events; tcsh does more
or less the same thing
Inspired by a report from Emanuele Torre <torreemanuele6@gmail.com>
8/9
---
parse.y
- grammar: change bare `time' and `!' productions to use nullcmd_terminator,
which is a list_terminator or a `&' to allow things like `time &'
and `! &' which the original version of POSIX interp 267 (the one
I implemented) says we should support
8/11
----
m4/bison.m4,m4/flexmember.m4,m4/locale_h.m4
- new m4 files from gettext-0.21.1
m4/gettext.m4,m4/intl.m4
m4/{codeset,extern-inline,fcntl-o,glibc2,glibc21,host-cpu-c-abi,iconv,intdiv0}.$
m4/{intl-thread-locale,intlmacosx,intmax,inttypes-pri,inttypes,inttypes_h}.m4
m4/{lcmessage,lib-ld,lib-link,lib-prefix,locale_h,lock,nls,po,printf-posix}.m4
m4/{progtest,pthread_rwlock_rdlock,size_max,stdint_h,strtoimax,threadlib}.m4
m4/{uintmax_t,ulonglong,visibility,wchar_t,wint_t,xsize}.m4
- updated m4 files from gettext-0.21.1
configure.ac,config.h.in
- updated autoconf files with changes for gettext-0.21.1
MANIFEST
- updated distribution manifest with new files from gettext-0.21.1
lib/sh/unicode.c
- u32cconv: prefer nl_langinfo to locale_charset like locale.c:
locale_isutf8()
execute_cmd.c
- uw_restore_lineno: an unwind-protect fuction to restore a saved
line_number
- execute_command: add an unwind-protect to restore line_number in
case execute_simple_command longjmps back to top_level or a
return context.
Side effect of https://savannah.gnu.org/support/index.php?110919
- execute_for_command, execute_select_command, execute_case_command:
add unwind-protect to restore line_number (could also do it for
if, while, until but those don't modify line_number)
- execute_command_internal: add_unwind_protect to restore line number
for arith, cond, function def commands
8/14
----
execute_cmd.c
- execute_simple_command: don't call savestring on the_printed_command_except_trap
if it's NULL.
From a report by Grisha Levit <grishalevit@gmail.com>
8/15
----
lib/readline/rltty.c
- prepare_terminal_settings: replace USE_XON_XOFF macro with private
variable _rl_use_tty_xon_xoff (initially set to 1); if it's set to
0 disable the tty start and stop characters. Prep for making it a
bindable variable setting
builtins/read.def
- edit_line: now takes a third argument saying whether or not to
set rl_attempted_completion_function to NULL to use readline's
default filename completion (the default)
- read_builtin: new option -E to use readline and use the bash
default completion (that is, leave rl_attempted_completion_function
unchanged)
From a suggestion by konsolebox <konsolebox@gmail.com> back in 5/2021
doc/bash.1,doc/bashref.texi
- read: document new -E option
8/17
----
aclocal.m4
- BASH_CHECK_LIB_TERMCAP: add a check for bash_cv_termcap_lib ==
"libcurses"; set TERMCAP_LIB=-lcurses in this case
8/18
----
subst.c
- bash_variable_assignment_error: new function, implements default mode
behavior for variable assignment errors
- posix_variable_assignment_error: new function, implements posix mode
behavior for variable assignment errors
- parameter_brace_expand_rhs,expand_declaration_argument,
do_assignment_statements: call posix_variable_assignment_error or
bash_variable_assignment_error as appropriate
8/21
----
lib/readline/misc.c
- _rl_arg_dispatch: add the digits or other characters to
rl_executing_keyseq if we're not calling _rl_dispatch.
From a report by Grisha Levit <grishalevit@gmail.com>
print_cmd.c
- print_simple_command: make sure that the_printed_command[0] == '\0'
if we're printing a null simple command with no words
Patch by Grisha Levit <grishalevit@gmail.com>
8/22
----
builtins/read.def
- read_builtin: make `delim' variable local, pass to edit_line to
set the last character of the returned line; change edit_line
prototype.
From a suggestion by Grisha Levit <grishalevit@gmail.com>
8/23
----
parse.y
- comsub and funsub productions: don't reset eof_encountered to 0 in
the action
subst.c
- function_substitute: unwind-protect eof_encountered so ignoreeof
doesn't keep getting reset to 0 if PS1 includes a ${ ...;} command.
From a report by Grisha Levit <grishalevit@gmail.com>
8/25
----
doc/{bash.1,bashref.texi}
- clarify the cases where arrayname[@] doesn't refer to all the
elements of an associative array (the unset builtin and test/[/[[ -v
for now)
Inspired by https://savannah.gnu.org/support/index.php?110924
8/28
----
execute_cmd.c
- execute_for_command,execute_select_command,execute_arith_command,
execute_case_command: fix up order in which BASH_COMMAND is set,
the DEBUG trap is run, and PS4 is printed.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/colors.c
- RL_COLOR_PREFIX_EXTENSION: make sure the custom suffix has a leading
`.'
Report and fix from Stefan Klinger <readline-gnu.org@stefan-klinger.de>
lib/readline/parse-colors.c
- free_color_ext_list: new function, called on parse error, frees the
list of extensions
- rl_reparse_colors: new public function, frees old extension list and
reparses (presumably new) value of LS_COLORS; some minimal checking
to make sure the value has really changed
9/1
---
parse.y
- time_command_acceptable: make sure `time' is recognized as a
reserved word after DOLPAREN and DOLBRACE.
Report from Dima Korobskiy <dkroot2@gmail.com>
builtins/printf.def
- printf_builtin: make 'C' equivalent to 'lc'; 'S' equivalent to 'ls'
as POSIX specifies
9/6
---
eval.c
- parse_command: don't run pending traps if we're parsing a command
substitution
From a report from Emanuele Torre <torreemanuele6@gmail.com>
9/8
---
jobs.c
- stop_pipeline: don't have the parent set the terminal pgrp; rely on
child processes to do it to avoid potential race conditions.
From a discussion beginning at
https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00087.html
builtins/printf.def
- bexpand: when parsing the string to be expanded, consume entire
multibyte characters at a time, in case their encoding includes a
'\\'
- printf_builtin: when parsing the format string, consume entire
multibyte characters at a time unless they begin with '\\' or '%',
to avoid characters whose encoding contains those characters
9/11
----
builtins/hash.def
- hash_builtin: if the -p option is supplied without a name to hash,
it's an error
hashcmd.c
- phash_remove: if the hash table is empty, return 1 like unalias does
when the alias isn't in the hash table.
Report from from Mike Jonkmans <bashbug@jonkmans.nl>
9/13
----
test.c
- binary_test,unary_test: now static
- cond_test: new function, calls binary_test or unary_test as appropriate
and handles longjmps from test_syntax_error
test.h
- cond_test: extern declaration
execute_cmd.c
- execute_cond_node: call cond_test instead of binary_test or unary_test.
From a report and patch from Grisha Levit <grishalevit@gmail.com>
doc/bash.1,doc/bashref.texi
- hash: add some text about the mutual exclusivity of the -t, -p, and
-d options
9/14
----
subst.c,subst.h,externs.h
- string_extract,string_extract_verbatim,string_extract_double_quoted,
string_extract_single_quoted,skip_single_quoted,skip_double_quoted,
extract_delimited_string,extract_heredoc_dolbrace_string,
extract_dollar_brace_string,parameter_brace_expand,param_expand,
extract_command_subst,extract_function_subst,extract_arithmetic_subst,
extract_process_subst,extract_array_assignment_list,
expand_array_subscript
change function signatures to take size_t * instead of int * for
arguments that are string indices or lengths, change callers
- unquoted_substring,unquoted_member,string_extract,
string_extract_double_quoted,skip_double_quoted,
string_extract_single_quoted,skip_single_quoted,
string_extract_verbatim,extract_delimited_string,
extract_heredoc_dolbrace_string,extract_dollar_brace_string,
parameter_brace_expand,param_expand,skip_matched_pair,skip_to_delim,
skip_to_histexp,list_string,expand_string_dollar_quote,
parameter_brace_expand_rhs,expand_array_subscript,shouldexp_replacement,
expand_array_subscript,string_quote_removal: change variables used
for string indexes to size_t
[merge from size_t branch]
arrayfunc.c
- expand_compound_array_assignment: use size_t for string indices
braces.c
- brace_gobbler: use size_t for string indices
parse.y
- xparse_dolparen: change function signature to use size_t *
instead of int * for string index, use size_t for string indices
general.c, general.h
- bash_tilde_find_word: change function signature to use size_t *
instead of int * for string index
lib/readline/readline.h
- rl_reparse_colors: extern declaration
lib/readline/doc/rltech.texi
- rl_reparse_colors: document as public function
9/21
----
pcomplete.c
- it_init_aliases: move the free (alias_list) inside #ifdef ALIAS.
Report and fix from Mike Jonkmans <bashbug@jonkmans.nl>
redir.c
- redirection_error: set W_NOPROCSUB in the word redirection_error
creates to call redirection_expand
builtins/bind.def
- bind_builtin: use CASE_HELPOPT so the long doc gets printed when
--help is supplied
builtins/getopts.def
- getopts_builtin: change to use no_options()
9/22
----
execute_cmd.c
- execute_select_command: in posix mode, an invalid selection variable
name is a fatal error, just like with `for'. This is compatible with
ksh93 and mksh
9/25
----
subst.c
- parameter_brace_expand_length: rearrange the code slightly to reduce
the number of find_variable calls. This matters if the variable is
dynamic and produces a new value each time (e.g., RANDOM).
9/26
----
builtins/shift.def
- shift_builtin: if get_numeric_arg returns a number out of range and
we're going to print an error message, make sure to skip over an
argument of `--' so we can print the right argument
builtins/break.def
- break_builtin,continue_builtin: ditto with get_numeric_arg and `--'
9/28
----
builtins/history.def
- history_builtin: changed error message if the numeric argument to -d
is invalid
9/29
----
subst.c
- array_length_reference: include the open bracket in the error message
passed to err_badarraysub; it looks cleaner
10/2
----
jobs.c
- delete_all_jobs: if we are clearing the jobs list, reset the stats
about running and dead jobs and child processes
Report from Koichi Murase <myoga.murase@gmail.com>
10/4
----
lib/readline/complete.c
- rl_completion_rewrite_hook: rewrite hook applied to the completion
word before comparing against the possible completions from the
file system (modified by rl_filename_rewrite_hook)
- rl_filename_completion_function: call rl_completion_rewrite_hook,
if set by the calling application, on the filename portion of the
word to be completed
lib/readline/readline.h
- rl_completion_rewrite_hook: extern declaration
bashline.c
- bash_set_filename_hooks: set rl_completion_rewrite_hook to
bash_filename_rewrite_hook now that we've separated them
From a report and patch from Grisha Levit <grishalevit@gmail.com>;
original report from Stefan H. Holek <stefan@epy.co.at>
lib/readline/doc/rltech.texi
- rl_completion_rewrite_hook: document
10/5
----
lib/readline/complete.c
- rl_complete_internal: use `%' as an op character to indicate that
we should just display the completions, like '?' in previous versions
(nothing uses this yet)
- rl_possible_completions: set last_completion_failed to 0 before we
pass '?' to rl_complete_internal so we don't worry about trying to
insert a single completion
10/6
----
subst.c
- string_transform: use ansicstr directly for the `E' transformation
so we don't accidentally remove too many escapes.
From a report and patch from Grisha Levit <grishalevit@gmail.com>
execute_cmd.c
- execute_arith_for_command: make sure a failed init expression resets
loop_level so break and continue work correctly
From a report and patch from Grisha Levit <grishalevit@gmail.com>
- execute_for_command: set line_number for invalid identifier error
messages; restore before returning error
From a report and patch from Grisha Levit <grishalevit@gmail.com>
lib/readline/misc.c
- _rl_set_insert_mode: manage RL_STATE_OVERWRITE when modifiying
insert mode
doc/bash.1,doc/bashref.texi
- some style and formatting changes from Bjarni Ingi Gislason
<bjarniig@simnet.is>
subst.c
- getifs: now returns allocated memory to insulate it from changes to
$IFS
builtins/read.def
- read_builtin: since getifs now returns allocated memory, note when
we need to free ifs_chars and free it before returning.
Reported by Robert Elz <kre@munnari.OZ.AU> in
https://www.austingroupbugs.net/view.php?id=1778#c6513
10/7
----
pathexp.c
- glob_char_p: add more of the extglob pattern characters; it doesn't
hurt to quote them
Report and patch from Grisha Levit <grishalevit@gmail.com>
- unquoted_glob_pattern_p: don't treat a `(' immediately following a
`/' as a potential globbing character
- unquoted_glob_pattern_p: only treat the extended glob characters
followed by a `(' as a glob pattern if extended_glob is enabled
- unquoted_glob_pattern_p: an unquoted backslash isn't treated
specially any more, but if it's followed by a CTLESC, you still
don't treat the next character as an unquoted globbing char
Report and patch from Grisha Levit <grishalevit@gmail.com>
10/9
----
builtins/common.c
- get_numeric_arg: if fatal > 0, set the exit status to EX_USAGE
and call jump_to_top_level with EXITPROG or DISCARD. We don't
need to do everything that throw_to_top_level() does here (it's
really meant for signals and other exceptional failure conditions).
builtins/cd.def
- cd_builtin: exit with EX_USAGE on too many arguments
builtins/shift.def
- shift_builtin: return EX_USAGE if get_numeric_arg returns 0,
indicating that the argument wasn't a valid number
builtins/history.def
- shift_builtin: return EX_USAGE if get_numeric_arg returns 0
builtins/exit.def
- exit_or_logout: if get_exitstat (which calls get_numeric_arg) returns
a value > EX_SHERRBASE, indicating an error, just return that to
the caller and let the caller deal with it. This means that
`exit xyz' is no longer a fatal error, but can potentially cause a
non-interactive posix-mode shell to exit because exit is a special
builtin
builtins/return.def
- return_builtin: if a non-interactive shell in posix mode gets an
invalid numeric arg from get_exitstat, return immediately and let
the caller deal with exiting
All prompted by a report by Martin Schulte <gnu@schrader-schulte.de>
10/13
-----
pathexp.c
- unquoted_glob_pattern_p: restore some of the special treatment of
backslash followed by CTLESC removed on 10/7
Report and patch from Grisha Levit <grishalevit@gmail.com>
parse.y
- parse_matched_pair: don't add an extra CTLESC after reading \CTLESC,
like in other parts of the parser
subst.c
- dequote_string: don't drop trailing CTLESC in a string with more
than a single character
Report and patch from Grisha Levit <grishalevit@gmail.com>
lib/sh/strtrans.c
- ansicstr: handle $'\c^A' and $'\c^?' correctly when being expanded
by the parser (flags&2). The parser passes these as \c^A^A and
\c^A^?, respectively, so we should strip the quoting CTLESC.
Report from Grisha Levit <grishalevit@gmail.com>
subst.[ch]
- extract_dollar_brace_string: now global so brace expansion can use it
braces.c
- brace_gobbler: use extract_dollar_brace_string if we see ${ with
the appropriate value of QUOTING, so we don't have to teach brace
expansion more shell syntax.
Report from Emanuele Torre <torreemanuele6@gmail.com>
- brace_gobbler: call the word extraction functions with SX_NOALLOC
so we don't have to allocate memory we're just going to free
10/16
-----
builtins/read.def
- read_builtin: return EX_MISCERROR (2) if there is an error trying
to assign to one of the variables. This is what the newest POSIX
draft specifies.
variables.c
- dispose_variable_value: do the right thing for att_nofree vars
- makunbound: call dispose_variable_value instead of using inline code
braces.c
- brace_gobbler: make sure to set no_longjmp_on_fatal_error around
calls to extract_dollar_brace_string
10/17
-----
braces.c
- brace_gobbler: set SX_NOLONGJMP|SX_NOERROR in the flags passed
to extract_command_subst; make sure no_longjmp_on_fatal_error
is set before that call
- brace_gobbler: revert 10/13 change to use extract_dollar_brace_string
10/20
-----
parse.y
- xparse_dolparen,parse_string_to_command: if SX_NOERROR is set in
FLAGS, add PST_NOERROR to parser_state. Not much effect yet.
- parse_matched_pair: if PST_NOERROR is set in parser_state, don't
print an error message if we hit EOF, just return an error. A start
at using PST_NOERROR to suppress error messages, not just duplicate
ones. We'll see how this goes before adding more
builtins/printf.def
- decodeprec: decode the precision into an intmax_t; clamp the return
value at INT_MAX
- printf_builtin: update to posix interp 1647 (even though it's about
fprintf(3)) and output a NUL byte if %lc is supplied a null argument.
- printf_builtin: fix case where %Q is supplied with a precision in
the format string
- printf_builtin: fix case where %Q is supplied with a precision
greater than INT_MAX
- getwidestr,getwidechar: handle case where there is no argument
supplied; return NULL or NUL
- convwidestr: allow a precedence of 0 for %ls
- getint: don't call getintmax any more, just use the same code style
inline; getintmax will consume an extra argument on an error
Report and patches from Grisha Levit <grishalevit@gmail.com>
- printf_builtin: handle field width and precision overflow from
getint() by ignoring the argument (fieldwidth = 0, precision = -1)
10/26
-----
jobs.c
- wait_for: rearrange code that sets the SIGINT handler to
wait_sigint_handler and saves the old handler to old_sigint_handler
to avoid delay before assigning the handler
Report from Wenlin Kang <wenlin.kang@windriver.com>
- wait_sigint_handler: if cur_sigint_handler (what restore_sigint_handler)
just restored or ignored) is INVALID_SIGNAL_HANDLER, set the
appropriate SIGINT handler with set_sigint_handler before sending
ourselves SIGINT
10/30
-----
general.c
- legal_number: use the same test (isspace(3)) to skip trailing
whitespace that strtoimax uses to skip leading whitespace.
Report and patch from Paul Eggert <eggert@cs.ucla.edu>
general.c,general.h
- legal_number: renamed to valid_number, changed all callers
- legal_identifier: renamed to valid_identifier, changed all callers
- legal_alias_name: renamed to valid_alias_name, changed all callers
lib/sh/compat.c
- legal_number: definition of legal_number here for backwards compat
with old loadable builtins
- legal_identifier: definition of legal_identifier here for backwards
compat with old loadable builtins
- legal_alias_name: same
subst.c
- brace_expand_word_list: if brace_expand returns NULL, dummy up a
single-element vector with a copy of the original word so we can
add it to the result list unchanged.
Inspired by https://savannah.gnu.org/support/?110948
11/3
----
lib/readline/text.c
- readstr: set of functions to read a string from the keyboard, using
rl_line_buffer for temporary storage, with minimal editing and an
optional caller-supplied completion function. Doesn't use the
callback framework yet since none of the functions are public
- rl_execute_named_command: new bindable function to read a bindable
command name (from the funmap_names array) and execute it, with
command name completion on SPACE and TAB
lib/readline/readline.h
- rl_execute_named_command: new extern declaration
lib/readline/rlprivate.h
- new extern declarations for the readstr function framework
lib/readline/funmap.c
- execute-named-command: new bindable function name
lib/readline/emacs_keymap.c
- rl_execute_named_function: bound to M-x by default
lib/readline/doc/rluser.texi
- execute-named-command: document as bindable function name with its
default binding to M-x in emacs mode
11/6
----
lib/readline/search.c
- _rl_nsearch_dispatch: use ^V/^Q for rl_quoted_insert into the
search string
lib/readline/isearch.c
- _rl_isearch_dispatch: use ^V or anything bound to rl_quoted_insert
for rl_quoted_insert into the search string
lib/readline/terminal.c
- add support for new BE/BD and PS/PE bracketed-paste capabilities.
Nothing uses them yet.
11/10
-----
builtins/enable.def
- dyn_load_builtin: if we don't find a pathname argument without a
slash in BASH_LOADABLES_PATH, convert it to a pathname with a slash
before calling dlopen, to force the loader to look in the current
directory (Linux, for example, will not).
11/14
-----
examples/loadables/fdflags.c
- fdflags_builtin: only parse the setspec once, since parsing uses
strtok.
Report and patch from Emanuele Torre <torreemanuele6@gmail.com>
11/15
-----
builtins/enable.def
- dyn_load_builtin: if BASH_LOADABLES_PATH is set, use only it: don't
fall back to looking in the current directory. This changes the
historical behavior and brings the path behavior more in line with
PATH, but not CDPATH.
11/20
-----
lib/readline/complete.c
- rl_complete_internal: add `|' as a character for rl_complete_internal
that also just displays the completions, since `%' is overloaded by
rl_menu_complete
11/23
-----
examples/loadables/strptime.c
- strptime: new loadable builtin, interface to strptime(3). Takes a
date-time string as its arguments and tries to parse it according
to a number of built-in formats. If successful, it outputs the
result as a number of seconds since the epoch. Understands some
handy shorthands like "now" and "tomorrow".
11/24
-----
tests/unicode1.sub
- update the driver function using namerefs and ${!x[@]}
- zh_TW.BIG5: fixed some problems with the test encodings.
Report and patches from Grisha Levit <grishalevit@gmail.com>
11/25
-----
tests/glob2.sub
- zh_HK.big5hkscs -> zh_TW.big5 to work around macOS 14 issues with
BSD-based locale definition
bashline.c
- bash_execute_unix_command: check count != 1 instead of count > 1 to
handle negative arguments
lib/readline/bind.c
- rl_trim_arg_from_keyseq: change the parsing_digits logic to handle
multiple instances of `-' the same way rl_digit_loop does (collapse
to 1)
- rl_trim_arg_from_keyseq: fix typo to correctly recognize a `-'
after a key sequence bound to universal-argument
- rl_trim_arg_from_keyseq: trim negative argument for a key sequence
that is shadowed by a longer key sequence (ANYOTHERKEY)
Report and patches from Grisha Levit <grishalevit@gmail.com>
11/27
-----
support/shobj-conf
- solaris2: change PIC option for non-gcc Solaris 2 builds
lib/malloc/malloc.c
- binsize: make sure indexing into binsizes casts to size_t (unsigned)
examples/loadables/getconf.c
- protect more of the _SC defines with #ifdefs for different systems
examples/loadables/fdflags.c
- ALLFLAGS: add some more flag values from Solaris/AIX/HP-UX
11/28
-----
subst.c
- function_substitute: unwind return_catch_flag unconditionally
Report and patch from Grisha Levit <grishalevit@gmail.com>
- function_substitute: save getopts state and restore it if the
funsub declares a local copy of OPTIND
Report and patch from Grisha Levit <grishalevit@gmail.com>
lib/readline/display.c
- rl_redisplay: make sure lpos is initialized to 0 if local_prompt is
NULL
shell.c
- run_startup_files: make sure ssh_reading_startup_files is set to 0
in more places; still dependent on SSH_SOURCE_BASHRC
builtins/evalstring.c
- should_suppress_fork: make sure ssh_reading_startup_files is 0 in
order to suppress a fork. It will never be non-zero unless someone
enables SSH_SOURCE_BASHRC.
Fixes https://issues.redhat.com/browse/RHEL-5653
variables.c
- posix_unbind_tempvar: new function to implement POSIX interp 1009,
which says that `x=4 unset x' not only unsets the variable in the
temporary environment but the most recent scope as well.
variables.h
- posix_unbind_tempvar: extern declaration
builtins/set.def
- unset_builtin: if we are unsetting a variable that is in some
temporary environment, and the shell is in posix mode, call
posix_unbind_tempvar to implement the right posix behavior
doc/bashref.texi
- update posix mode section with change to unset for interp 1009
12/1
----
lib/readline/readline.c
- _rl_subseq_result: add check before _rl_do_lowercase_version that
_rl_to_lower actually results in a different key sequence
Report and patch from Grisha Levit <grishalevit@gmail.com>
lib/readline/isearch.c
- _rl_isearch_dispatch: if the function bound to a key and the function
bound to the result of _rl_to_lower for that key are both
rl_do_lowercase_version, just insert the key into the search string
12/5
----
parse.y,parser.h
- heredoc_string: new variable to indicate whether or not we're reading
a here-document from an alias (a pushed string). Set in
gather_here_documents individually for each call to
make_here_document.
parse.y
- read_a_line: if heredoc_string is non-zero, use shell_getc instead
of yy_getc to get the right alias processing
- shell_getc: if heredoc_string is non-zero, don't add a space to the
end of the alias -- it can mess up the here-document delimiter if
the next character is a newline
Report and sample patch from gldrk <me@rarity.fan>
parse.y,make_cmd.c
- read_a_line,make_here_document: if we're using shell_getc to read
the body of a here-document, let it manage line_number
12/8
----
bashline.c
- bash_dequote_filename: fix an off-by-one error that didn't remove a
closing single quote in a filename if it was backslash-escaped.
Report by Ole Tange <ota@prosa.dk>, fix from Grisha Levit <grishalevit@gmail.com>
lib/readline/terminal.c
- _rl_check_ansi_terminal: check whether or not rl_terminal_name
appears to be an ANSI/ECMA-48 terminal. Check some common terminal
types and then check whether some common terminal capabilities
(ce, nd, ho, up) begin with CSI (ESC-[) and then have a correct
subsequent character
- _rl_term_isansi: new variable, holds readline's idea about whether
the value of rl_terminal_name is an ANSI/ECMA-48 terminal. Initialized
to RL_ANSI_TERM_DEFAULT; set to the result of _rl_check_ansi_terminal
if initialized to 0 and on a `non-dumb' terminal
From an idea by John Tsiombikas <nuclear@mutantstargoat.com> in 11/2023
lib/readline/rlconf.h
- RL_ANSI_TERM_DEFAULT: define to 1 (yes) or 0 (no) to tell readline
whether or not to assume it's running on an ANSI/ECMA-48 terminal.
The default is 1 (yes)
12/11
-----
print_cmd.c
- make_command_string_internal: when printing a coproc, print the
coproc name only if the coproc command is not a simple command.
Report from Albert Akchurin <ackbeat@gmail.com>
12/14
-----
doc/bash.1,doc/bashref.texi
- bind: clarify meaning of `re-read' as being individual arguments
to `bind'.
Report from Dan Jacobson <jidanni@jidanni.org>
- history expansion: add that the quick substitution character is
only active when it's the first character on the line.
Suggested by Dale R. Worley <worley@alum.mit.edu>
lib/readline/histexpand.c
- history_expand: if history_quoting_state is "'", don't try to
interpret the quick substitution syntax at the start of the string.
Report from Sundeep Agarwal <learnbyexample.net@gmail.com>
execute_cmd.c,execute_cmd.h
- save_lastarg: new function, returns saved value of $_ in allocated
memory
parse.y
- execute_variable_command: instead of inline code, call save_lastarg
mailcheck.c
- check_mail: instead of inline code, call save_lastarg
- check_mail: instead of calling bind_variable, use bind_lastarg
parse.y
- decode_prompt_string: use save_lastarg() and bind_lastarg() to preserve
the value of $_ across prompt string decoding.
Patch from Grisha Levit <grishalevit@gmail.com>
12/21
-----
lib/readline/doc/readline.3
- updates to some vi-mode bindings
Patch from Josh Brobst <josh@brob.st>
builtins/setattr.def
- set_or_show_attributes: in posix mode, supplying an argument that is
not an identifier when not acting on functions is a utility error.
This will cause a non-interactive shell to exit
12/27
-----
print_cmd.c
- command_print_word_list,print_select_command_head,print_case_command_head,
print_function_def: if we're in pretty-print mode, dequote words
before printing them
Report from Seth Sabar <sethsabar@gmail.com>
shell.c
- execute_profile_file,execute_bashrc_file: separate the (duplicated)
code that sources the various profile and bashrc files out into
separate functions
- find_bashrc_file: new function, returns the name of the interactive
shell startup file that should be executed if --rcfile (--init-file)
is not supplied; currently returns DEFAULT_BASHRC
- bashrc_file: default to NULL, making it just the filename supplied as
an argument to --rcfile/--init-file
- execute_bashrc_file: execute whatever find_bashrc_file() returns
if bashrc_file is NULL
From a patch from Allison Karlitskaya <allison.karlitskaya@redhat.com>
1/3/2024
--------
print_cmd.c
- print_case_clauses: if we're printing a comsub for subsequent parsing,
don't add a newline before the first case clause, since it adds a
token after the `in' that will allow reserved words to be parsed.
Report from Oguz <oguzismailuysal@gmail.com>
1/5
---
lib/readline/doc/rltech.texi,lib/readline/doc/readline.3
- Note that since quoted characters are possible, the line readline()
returns may contain embedded newlines.
From a report by Martin Buck <mb-tmp-tah.bet@gromit.dyndns.org>
1/8
---
parse.y
- parse_compound_assignment,parse_string_to_word_list: if we call
reset_parser, directly or indirectly via yyerror, make sure to set
the pushed_strings member of the saved parser state to NULL, since
reset_parser already freed it and we don't want to try and restore
it in restore_parser_state.
From a report by Nathan Mills <the.true.nathan.mills@gmail.com>
1/10
----
builtins/hash.def, builtins/ulimit.def
- add some calls to sh_chkwrite where there is builtin output
lib/sh/eaccess.c
- sh_stat: use strcpy/strcpy when constructing pbuf instead of
strcpy/strcat
lib/sh/tmpfile.c
- sh_mktmpname,sh_mktmpfd,sh_mktmpdir: use snprintf (filename, PATH_MAX, ...)
instead of sprintf (filename, ...)
1/11
----
configure.ac
- unconditionally AC_DEFINE(PGRP_PIPE), to prevent the problem with a
pipeline and a DEBUG trap containing an external command described
in https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00037.html
1/12
----
jobs.c
- wait_for_any_job: if we're executing a funsub/varsub, do the wait
even if the jobs list is frozen, but don't remove the job from the
table or change its notification status
Report from Oguz <oguzismailuysal@gmail.com>
subst.c
- uw_unbind_variable: unset the first instance of the named variable,
don't follow namerefs. This is for REPLY in a varsub if it's made
a nameref.
Report from Oguz <oguzismailuysal@gmail.com>
shell.c
- main: call compat_init() so the linker drags in the old compatibility
functions from lib/sh/compat.c. Primarily for use by existing loadable
builtins
parse.y
- parse_compound_assignment: handle error case (wl == &parse_string_error)
before restoring the parser state from ps
Report from Grisha Levit <grishalevit@gmail.com>
1/13
----
lib/readline/complete.c
- compute_lcd_of_matches: move a strlen out of a call to MBRTOWC by
computing the length of the entire string once and then using an
offset from it while going through the loop
1/15
----
parse.y
- parse_compound_assignment: treat parsing a string following (( (read
by parse_dparen but not an arithmetic command) the same as
expanding an alias when fixing up the pushed string list
Report from Grisha Levit <grishalevit@gmail.com>
1/18
----
doc/bash.1
- typos and style fixes to satisfy groff warnings; remove uses of the
`CW' constant-width font; use .EX/.EE for examples; use consistent
style for double-quoted strings; fix inconsistent inter-paragraph
spacing
Fixes from G. Branden Robinson <g.branden.robinson@gmail.com>
1/19
----
test.c
- binary_test: make sure all calls in posix mode use TEST_LOCALE for
locale-specific string comparisons
shell.c
- find_bashrc_file: remove
1/20
----
shell.c
- exit_shell: don't try to call rl_deprep_terminal, regardless of the
readline state we inherited, if bash_readline_initialized is 0
Fixes bug reported by Oguz <oguzismailuysal@gmail.com>
- shell_reinitialize: reset startup_state and reading_shell_script to 0;
reset debugging_mode to 0
1/22
----
builtins/shopt.def
- reset_shopt_options: reset debugging_mode to 0
builtins/set.def
- reset_shell_options: reset interactive_comments to 1
braces.c
- brace_expand: if the first call to brace_gobbler consumes the entire
string, don't try to call it again
- brace_expand: check that i < tlen before checking to see if
expand_seqterm left more of the string unconsumed
- brace_gobbler: if extract_command_subst hits the end of the string
without closing the command substitution, make sure we return 0 as
well as set *i = tlen
From a fuzzing report by Nathan Mills <the.true.nathan.mills@gmail.com>
1/23
----
subst.c
- function_substitute: unwind-protect current_builtin and this_shell_builtin
like we do this_shell_function
From a fuzzing report by Nathan Mills <the.true.nathan.mills@gmail.com>
1/24
----
braces.c
- brace_gobbler: handle nofork command substitutions; skip over any
enclosed command and any braces it contains
bashline.c
- check_redir: return 0 if we're in a nofork comsub, so we will attempt
command word completion if appropriate
1/26
----
lib/readline/readline.h
- RL_STATE_READSTR: new state flag saying we are reading an arbitrary
string from the keyboard using rl_readstr
lib/readline/rlprivate.h
- READSTR_FREEPMT: new context state flag for rl_readstr; indicates
that we have allocated a new prompt with _rl_make_prompt_for_search
and we should free it with rl_restore_prompt because rl_clear_message
will not do it
lib/readline/text.c
- _rl_readstr_init,_rl_readstr_cleanup: set and unset RL_STATE_READSTR
- _rl_unsave_saved_readstr_line: free any rl_undo_list, which we may
have accumulated while reading the string, before restoring the line
Fixes leaks reported by sparrowhawk996@gmail.com.
- _rl_readstr_init: set the READSTR_FREEPMT context flag after we
call _rl_make_prompt_for_search, which calls rl_save_prompt
- _rl_readstr_sigcleanup: new function to call from signal cleanup;
restores prompt and calls _rl_readstr_cleanup to free the readstr
context
- _rl_readstr_restore: if the RL_READSTR_FREEPMT flag is set in the
context, call rl_restore_prompt to deallocate the prompt we created
lib/readline/callback.c
- rl_callback_sigcleanup: call _rl_readstr_sigcleanup to deallocate
readstr state on a signal
lib/readline/text.c
- rl_execute_named_command: free COMMAND before returning
1/27
----
lib/readline/rlprivate.h
- SF_FREEPMT: new flag for non-incremental search contexts: means we
saved the prompt data with _rl_make_prompt_for_search and need to
restore it with rl_restore_prompt, since rl_clear_message will not
lib/readline/search.c
- _rl_nsearch_sigcleanup: new function that if calls rl_restore_prompt
to clean up the saved prompt data if necessary before calling the
context cleanup function, avoids memory leak
- _rl_nsearch_init: set the SF_FREEPMPT flag after calling
_rl_make_prompt_from_search so we can clean it up properly on errors
- _rl_nsearch_abort,_rl_nsearch_dosearch: call rl_restore_prompt only
if cxt->sflags includes SF_FREEPMT, manage SF_FREEPMT state
lib/readline/signals.c
- _rl_state_sigcleanup: call _rl_nsearch_sigcleanup
lib/readline/callback.c
- _rl_callback_sigcleanup: call _rl_nsearch_sigcleanup
1/29
----
builtins/cd.def
- change_to_directory: don't try to canonicalize a NULL path that's
NULL after make_absolute.
From a report by Kerin Millar <kfm@plushkava.net>
jobs.c
- retrieve_proc_status,delete_proc_status: external interfaces to
bgp_search and bgp_delete, respectively; these take an argument
that says whether or not to block SIGCHLD
jobs.h
- retrieve_proc_status,delete_proc_status: extern declarations
builtins/wait.def
- check_bgpids: new function to check whether a requested PID is in
the bgpids table (retrieve_proc_status) and optionally delete it
if it is (posixly_correct delete_proc_status) while returning its
status. If the PID isn't in the bgpids table, return -1
- wait_builtin: if -n is supplied with pid/job arguments, use
check_bgpids to check the bgpids table for any of the requested
pids. Tagged for bash-5.3, might need another option
From a report by Steven Pelley <stevenpelley@gmail.com>
1/30
----
redir.c
- redir_open: assume the AFS bug with O_CREAT and existing files in
protected directories has been fixed over the years, so take out
the workaround.
From a report by Etienne Champetier <champetier.etienne@gmail.com>
jobs.c
- wait_for_any_job: if the jobs list is frozen and we're running a
funsub, mark the job as notified so it gets cleaned up later
- wait_for_any_job: if we're in posix mode, we should remove the job
from the job list and not add it to the bgpids list, as posix
requires
builtins/set.def
- set_shellopts: use ASS_FORCE in the call to bind_variable so we
don't have to mess with temporarily turning off readonly
builtins/shopt.def
- set_bashopts: same
Report by Emanuele Torre <torreemanuele6@gmail.com>
2/1
---
builtins/printf.def
- vblen: make it a size_t to avoid going negative on underflow
- clearerr, ferror, fflush: don't test these if vflag is set and we're
writing to a string (multiple places)
- vbprintf: pass through failure returns (< 0) from vsnprintf to the
caller(s) so we can return on errors
- printf_builtin: remove redundant test for empty or missing format
string
- PF: call builtin_error if vflag is set, sh_wrerror otherwise
(via PRETURN)
- PF: use PRETURN so we can get partial output to the variable on
error (if vflag is set)
- PRETURN: free conv_buf before attempting the write (it would get
cleaned up on the next call, but why not)
- PRETURN: clean up vbuf only if vflag is set, and clean it up on
error (it would get cleaned up on the next call, but...)
Fixes from Grisha Levit <grishalevit@gmail.com>
2/2
---
doc/bash.1,doc/bashref.texi
- word expansions: make it clearer that quote removal is one of the
shell word expansions
execute_cmd.c,execute_cmd.h
- currently_executing_command: no longer static, so other parts of
the shell can save and restore it if necessary
subst.c
- function_substitute: unwind-protect currently_executing_command,
since parse_and_execute can overwrite it in the current shell
execution context.
Report from Grisha Levit <grishalevit@gmail.com>
lib/readline/readline.c
- readline_common_teardown: new function from the guts of
readline_internal_teardown, manages and deallocates rl_undo_list.
lib/readline/callback.c
- rl_callback_handler_remove: if we're removing the line handler
while we still have an undo list, we didn't call
readline_internal_teardown. Call readline_common_teardown to manage
the undo list in case we are calling this from a signal handler
but not exiting the program.
Fixes leaks reported by sparrowhawk996@gmail.com.
variables.c
- initialize_shell_variables: use ASS_FORCE when binding SHELLOPTS or
BASHOPTS if we get them from the environment, in case they've
already been created as shell variables and set to readonly (like
changes from 1/30)
- set_ppid: use ASS_FORCE in the call to bind_variable instead of
temporarily turning off att_readonly
subst.c
- extract_delimited_string: pass FLAGS down to skip_single_quoted and
skip_double_quoted so we propagate SX_COMMAND and SX_COMPLETE
properly.
Fixes bug reported by A4-Tacks <wdsjxhno1001@163.com>
2/3
---
bashline.c
- initialize_readline: add `bash-vi-complete' as a bindable command
name so users can bind other key sequences to it
- vi_advance_point: function to advance point by one character even
in the presence of multibyte characters
- bash_vi_complete: call vi_advance_point instead of just incrementing
rl_point
2/5
---
doc/bash.1,lib/readline/doc/readline.3
- minor updates to handle old versions of troff and groff warnings
Fixes from G. Branden Robinson <g.branden.robinson@gmail.com>
2/7
---
jobs.c
- notify_of_job_status: in non-interactive shells, if we're not going
to print information about a terminated background job
(SIGINT/SIGTERM/SIGPIPE), don't mark it as notified, in the same
way that we don't mark background jobs that exit cleanly as notified
Inspired by a discussion with Robert Elz <kre@munnari.oz.au> and
https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00189.html
2/9
---
lib/readline/history.c
- DEFAULT_HISTORY_GROW_SIZE: bump up to 256
- real_history, real_history_size: the true history array and its
allocated size. the_history begins a user-visible window into this
list, extending for history_size entries
- history_list_grow_size: compute how much to extend the history list;
increase by roughly sqrt(history_size), don't extend by less than
(new) DEFAULT_HISTORY_GROW_SIZE
- history_list_resize: possibly resize/realloc real_history and reset
the_history to real_history and history_size to real_history_size
- advance_history: make the `window' that the_history provides into
real_history advance to simulate dropping an initial entry; don't
need to memmove all the entries any more
- add_history: call advance_history as necessary to move the_history
window
- add_history: call history_list_resize as necessary
Report and initial patch from Casey Johnson <strykre@hotmail.com>
2/12
----
bashline.c,lib/readline/bind.c,lib/readline/display.c
- replace some sprintf calls with snprintf to appease clang
execute_cmd.c
- execute_simple_command: unwind-protect this_command_name, since we
assign it to something we will free if unwind-protects are run
- execute_function: unwind-protect currently_executing_command, since
execute_command_internal will change it to something will will free
if unwind-protects are run
Report from Grisha Levit <grishalevit@gmail.com>
- execute_function: if we didn't compile with debugger support, restore
currently_executing_command after run_debug_trap, like in other
cases
2/13
----
builtins/declare.def
- declare_invalid_opts: move the code that checks for invalid option
combinations to its own function; it returns 0 for no errors and
a return code for declare_internal to return otherwise
Inspired by report from Grisha Levit <grishalevit@gmail.com>
- declare_invalid_opts: make -A -a and -A +A/-a +a option combinations
invalid
Report from Grisha Levit <grishalevit@gmail.com>
2/14
----
bashline.c,general.c,subst.c,lib/sh/pathphys.c,builtins/read.def,
support/bashversion.c
- changes for cygwin and msys (no new features)
bashline.c,builtins/fc.def,general.c,parse.y,stringlib.c,subst.c,variables.c
- MSYS-specific changes to support \r\n line endings and DOS-style
paths
configure.ac,cross-build/msys32.cache,support/config.rpath,support/shobj-conf
- MSYS-specific build options
configure.ac,config.h.in,m4/unlocked-io.m4,general.h,include/unlocked-io.h
MANIFEST
- adapt Gnulib's unlocked-io module for faster stdio functions.
From Grisha Levit <grishalevit@gmail.com>
lib/malloc/malloc.c,lib/malloc/table.h,lib/sh/strlcpy.c
- fixes for ISO C 23
Patch from Collin Funk <collin.funk1@gmail.com>
2/16
----
jobs.c
- waitchld: note whether or not we are executing in a signal handler
context and break out of the loop if we receive a terminating
signal instead of calling termsig_handler, which can execute unsafe
functions
From https://issues.redhat.com/browse/RHEL-22295
variables.h
- valid_readonly_attrs,invalid_readonly_attrs: new defines for declare
to use to validate attempts to modify attributes of readonly
variables
builtins/declare.def
- declare_internal: reject attempts to modify (set or unset) attributes
in invalid_readonly_attrs for readonly variables.
From a discussion with Grisha Levit <grishalevit@gmail.com>
2/17
----
variables.h
- add att_readonly to valid_readonly_attrs; it's valid to use
declare -r var ; declare -r var
Makefile.in,builtins/Makefile.in
- add unlocked-io.h to dependencies and variable contents where
appropriate
- add additional include files to INSTALLED_INCFILES
builtins/pushd.def,examples/loadables/necho.c
- fix order of includes to get unlocked-io.h
From Grisha Levit <grishalevit@gmail.com>
subst.c,subst.h
- rename quote_rhs -> quote_nosplit
2/19
----
subst.c
- quote_var_value: break the code that quotes a variable value ($x,
${x}, ${x[n]}, etc.) into a separate inline function and call it
from param_expand and parameter_brace_expand_word so they do it
consistently
- param_expand: quote $* appropriately using quote_nosplit if we are
in a place where word splitting will not occur (PF_NOSPLIT2),
expand_no_split_dollar_star == 1 but quoted is 0
- quote_var_value: use quote_nosplit if we are in a place where word
splitting will not occur (PF_NOSPLIT2) but quoted == 0.
Fixes bug with IFS=$'\1' reported by alex xmb sw ratchev <fxmbsw7@gmail.com>
arrayfunc.c
- array_value: make sure to quote ${A[*]} appropriately if not quoted
(quoted == 0) and in a place where word splitting does not occur
(flags & AV_ASSIGNRHS); the caller expects array_value to quote in
this case
subst.c
- parameter_brace_expand_word: make sure to call array_value with
AV_ASSIGNRHS if we are expanding unquoted ${A[*]} in a place where
word splitting does not occur with a non-null $IFS; array_value will
quote appropriately here
- parameter_brace_expand_word,param_expand: use quote_var_value when
expanding $N and ${N}
doc/bash.1,doc/bashref.texi
- HISTIGNORE: clarify the description a little to emphasize that lines
matching one of the patterns are not saved in the history list
From https://savannah.gnu.org/support/index.php?111020
2/20
----
builtins/evalfile.c
- FEVAL_RETRY: if set in FLAGS, _evalfile will retry an interrupted
open
- _evalfile: if open() returns -1, FEVAL_RETRY is set in FLAGS, and
errno == EINTR, retry the open after checking for interrupts or
terminating signals
- maybe_execute_file,force_execute_file: pass FEVAL_RETRY in flags
bashhist.c
- load_history: retry read_history if it returns EINTR after checking
for interrupts or terminating signals
lib/readline/bind.c
- _rl_read_init_file: retry the open once if it's interrupted due to a
signal. If we are at a point where readline has installed its
signal handlers, check for signals readline handles
From a patch from Grisha Levit <grishalevit@gmail.com>
2/21
----
subst.c
- make_internal_declare: now takes two strings of option arguments:
those to turn on (`-') and those to turn off (`+')
- expand_declaration_argument: simplify the code; handle `-' and `+'
optionsns; always call make_internal_declare
From a patch from Grisha Levit <grishalevit@gmail.com>
2/22
----
aclocal.m4
- add additional character to test for broken wcwidth (0x200b)
lib/readline/display.c
- update_line: use IS_COMBINING_CHAR instead of UNICODE_COMBINING_CHAR
plus WCWIDTH; it doesn't make sense on systems where wcwidth isn't
broken
2/27
----
print_cmd.c
- print_case_clauses: if one of the case command pattern lists begins
with the word `esac' (unquoted), precede the pattern list with `(',
since it had to be there originally to get through the parser.
Report by Emanuele Torre <torreemanuele6@gmail.com>
2/29
----
general.c,general.h
- string_to_rlimtype: takes a second ENDP argument, like strtol, so
the caller doesn't have to check that the string is all digits,
but can optionally check for and disallow a 0x prefix
3/2
---
subst.c
- dequote_list: unset the W_QUOTED flag in the word after dequoting it
- parameter_brace_expand_rhs: if the word in the list returned by
expand_string_for_rhs has W_QUOTED set, but the string being
expanded was not quoted, turn on the W_QUOTED in the returned word
so we can potentially avoid word splitting
- expand_word_internal: if CTLNUL is a IFS character, don't add quoted
null strings to istring if we're going to be word splitting, since
they will be treated as word delimiters
3/6
---
examples/loadables/getconf.c
- getconf_builtin,getconf_all: changes for POSIX interp 1808 proposal
to allow an optional pathname argument with -a that forces its use
for pathconf variables
https://www.austingroupbugs.net/view.php?id=1808
3/11
----
builtins/printf.def
- printf_builtin: %lc/%ls (%C/%S) should only work on wide characters
when in a locale where MB_CUR_MAX > 1.
Report by Emanuele Torre <torreemanuele6@gmail.com>
3/12
----
jobs.c
- notify_of_job_status: don't mark terminated background jobs or stopped
jobs as notified in shells started to run -c command
From a report by Greg Wooledge <greg@wooledge.org>
- notify_of_job_status: make the final marking the dead job as notified
a true catch-all so we can put a debugging message in there to see
if there are other missing cases
- notify_of_job_status: don't mark terminated jobs that died due to
a signal the shell trapped (on the assumption that the shell
received the signal, too) as notified, since we don't report on it
in the JDEAD case if the signal is trapped
3/13
----
builtins/printf.def
- PF: print an error message if printf returns an error or leaves
ferror(stdout) true
From a report by Paul Eggert <eggert@cs.ucla.edu>
3/14
----
builtins/printf.def
- getint: now takes an int argument and returns it if the conversion
overflows an int; changed callers in printf_builtin
- getint: consolidate checks for overflow. This changes the behavior
if the argument overflows an intmax_t: it returns a field width of
0 (the overflow result) instead of -1, which changes how printf
behaves. This is consistent with the behavior when the argument
overflows an int
- printf_builtin: change check for overflow of [LONG_MIN..LONG_MAX]
for %d/%i to be explicit instead of relying on integer overflow of p
- printstr,printwidestr: print message if field width or precision
overflow, since we don't call printf
- printstr,printwidestr: set field width and precision on integer
overflow the way we do in printf_builtin
From a report and patch by Paul Eggert <eggert@cs.ucla.edu>
bashtypes.h
- PRIdMAX: move redefinition here after including inttypes.h
builtins/printf.def,examples/loadables/seq.c,examples/loadables/getconf.h
- remove PRIdMAX redefinitions, since it's now fixed in bashtypes.h
From a report and patch by Paul Eggert <eggert@cs.ucla.edu>
3/15
----
include/stdckdint.in.h,include/intprops-internal.h
- new files, from gnulib
configure.ac
- stdckdint.h: create in the build directory if the system doesn't
provide one by copying ${srcdir}/include/stdckdint.in.h; make
sure we don't create a new one every time, changing the timestamp
Makefile.in
- CREATED_HEADERS: add stdckdint.h
stringlib.c,externs.h
- substring: now takes size_t arguments for START and END
lib/sh/stringvec.c
- strvec_create,strvec_mcreate,strvec_resize,strvec_mresize: use
ckd_mul to avoid size_t overflow
- strvec_len,strvec_flush: use size_t variable as array index
From a report by Paul Eggert <eggert@cs.ucla.edu>
bashansi.h
- stdbool.h: include if we have it, typedef bool as unsigned char if
we don't and HAVE_C_BOOL isn't defined
m4/c-bool.m4
- autoconf check for `bool' from gnulib
configure.ac
- include m4/c-bool.m4, call gl_C_BOOL; don't explicitly check for
stdbool.h using AC_CHECK_HEADERS any more
config.h.in
- HAVE_C_BOOL: define
3/16
----
builtins/printf.def
- decodeprec: now decodeint, takes new arguments: a char ** that is
the string to parse and update, an argument saying whether or not
to print an error message on overflow, and an argument that should
be the return value on overflow; use ckd_* macros to check overflow
- printstr, printwidestr: use a different mechanism to check overflow;
call decodeint to get precision and field width
braces.c
- include stdckdint.h for the ckd_* overflow checking macros
- mkseq: the width argument is now size_t
- mkseq: perform overflow detection using the ckd_* macros
- mkseq: perform zero-padding directly instead of using asprintf; the
sprintf family has trouble when width > INT_MAX
- expand_seqterm: use size_t instead of int for length and width
variables
From a report and patch by Paul Eggert <eggert@cs.ucla.edu>
3/18
----
builtins/printf.def
- printstr,bexpand: changed size/length arguments to be size_t; changed
callers
subst.c
- string_var_assignment: if the variable is a local variable at the
current scope, output a declare command even if there are no
attributes or value. Still tagged as tentative
3/23
----
test.c
- posixtest: takes an argument, the number of test arguments to parse
- two_arguments,three_arguments: use advance() instead of accessing
and manipulating pos directly
- posixtest,three_arguments,two_arguments: don't set pos = argc
directly, rely on functions to advance pos appropriately
Picked up from coreutils test
- term: if we see a left paren, scan forward for a closing right paren
and use posixtest() if there are 1-4 arguments between the parens to
avoid ambiguous behavior for expressions like true -a \( ! -a \),
which, though it's horribly ambiguous, a user would expect to
return false instead of an error message
Picked up from coreutils-9.2 test
3/25
----
bashansi.c
- HAVE_C_BOOL: prefer if defined, fall back to stdbool.h if bool isn't
a compiler builtin
braces.c
- mkseq: simplify break condition
builtins/printf.def
- decodeint: let the caller decide what to do with an overflow return,
don't return -1 after calling report_erange(). This will honor a
precision even if the field width overflows
- printf_builtin: check for overflow when adjusting precision for
string length with %Q
- printstr,printwidestr: now that the code uses decodeint, we don't
need to check the precision against INT_MAX
bashansi.h
- include stddef.h if we have it, otherwise define replacements for
NULL and offsetof()
builtins/help.def,lib/sh/fmtulong.c,lib/sh/getcwd.c,lib/sh/makepath.c,
lib/sh/snprintf.c,lib/sh/strtod.c,lib/sh/strtol.c,unwind_prot.c,
lib/readline/shell.c
- include bashansi.h instead of stddef.h, or remove a stddef.h include
if bashansi.h is already included
- remove extra definitions that appear in stddef.h or bashansi.h
lib/sh/reallocarray.c,externs.h
- implementation of reallocarray(), originally from OpenBSD, from
Paul Eggert
configure.ac
- use AC_REPLACE_FUNCS for reallocarray
xmalloc.c,xmalloc.h
- xreallocarray: implementation of reallocarray that uses xrealloc
- sh_xreallocarray: implementation of reallocarray that uses
sh_xrealloc and has file and line information for error messages
lib/sh/stringvec.c
- strvec_create, strvec_resize: rewrite in terms of xreallocarray
- strvec_mcreate, strvec_mresize: rewrite in terms of reallocarray
- strvec_remove, strvec_search, strvec_copy, strvec_from_word_list,
strvec_to_word_list: use size_t instead of int where appropriate
lib/sh/stringvec.c,externs.h
- strvec_search: return a value of type ptrdiff_t, since size_t is
unsigned and we want to return -1 if not found
All from a report and patch by Paul Eggert <eggert@cs.ucla.edu>
test.c
- term: change paren scan algorithm to count open and close parens so
we handle nested subexpressions. Still not compatible in the case
of something like test true -a \( ! -a \) \)
3/27
----
parse.y
- flush_parser_state: new function, deallocates the members of a
parser state struct that are dynamically allocated
- parse_comsub: call flush_parser_state in places where we will
return an error or jump to the top level
Fixes memory leaks on error reported by bug_reports00@protonmail.com
Makefile.in
- CREATED_MACOS: list of dSYM directories created by building and
testing
- distclean,maintainer-clean: remove $(CREATED_HEADERS) and
$(CREATED_MACOS)
- maintainer-clean: remove ctags/etags files
3/28
----
bashline.c,bashline.h
- uw_restore_parser_state: moved to parse.y and declaration to shell.h
shell.c,shell.h
- parsing_command: new flag, set to 1 when calling yyparse; saved and
restored by save_parser_state/restore_parser_state
parse.y,shell.h
- parsing_command: new element of sh_parser_state_t
sig.c
- throw_to_top_level: reset executing and parsing_command to 0
parse.y
- parse_comsub: set parsing_command to 1 before calling yyparse()
eval.c
- parse_command: set parsing_command to 1 before calling yyparse(),
restore old value when yyparse returns
subst.c
- function_substitute: if we are parsing a command, save the parser
state with save_parser_state and add an unwind-protect to restore it
From a report from Grisha Levit <grishalevit@gmail.com>
- function_substitute: only save and restore the pipestatus array if
we are not parsing a command, since save_parser_state saves it
parse.y,externs.h
- decode_prompt_string: now takes an additional argument to determine
whether this is expanding PS[0124] or the @P transformation
- decode_prompt_string: keep track of the (last) real prompt string
being decoded so a @P expansion embedded in the prompt returns the
same result as the prompt string itself for the \! and \# expansions
From a patch from Grisha Levit <grishalevit@gmail.com>
parse.y,print_cmd.c,eval.c,subst.c
- decode_prompt_string: changed all callers
3/29
----
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/history.3
- fix some font-setting directives
- fix some word breaks for font-changing macros
lib/readline/doc/history.3
- fix the macros for function signatures for AT&T troff limitations
- fix some paragraph spacing and other layout/spacing/hyphenation
issues
Fixes from G. Branden Robinson <g.branden.robinson@gmail.com>
4/1
---
execute_cmd.c
- shell_execve: minor changes to code that checks the #! interpreter
name
execute_cmd.c
- execute_coproc: if MULTIPLE_COPROCS is not defined, close any old
file descriptors corresponding to sh_coproc. The user can still
copy them from the coproc array if desired; this prevents the shell
from hanging if a second coproc inherits file descriptors from a
previous one
From a report by Carl Edquist <edquist@cs.wisc.edu>
jobs.c,nojobs.c,jobs.h
- process_exit_status: no longer static, public function with an
extern declaration
4/2
---
execute_cmd.c,execute_cmd.h
- coproc_pidchk: now takes a full WAIT status word as a second
argument instead of just the exit status; arranged the prototype
to only be included if the source file includes posixwait.h for WAIT
jobs.c
- waitchld: call coproc_pidchk with a WAIT second argument (like
nojobs.c does)
command.h
- COPROC_STOPPED,COPROC_FOREGROUND: new flags values for coproc
execute_cmd.c
- coproc_setstatus: now takes a full WAIT status word as the second
argument, passed from coproc_pidchk
- coproc_setstatus: use process_exit_status to translate a WAIT into
an int status, doing proper termsig+128 handling
- coproc_getstate: take a WAIT and return the appropriate COPROC_
status flag (DEAD, STOPPED, etc.)
- coproc_setstatus: use coproc_getstate to set cp->c_flags
4/4
---
configure.ac
- changed release status to bash-5.3-alpha
- AC_PROG_GCC_TRADITIONAL: removed, since it no longer is supported
in autoconf-2.72 (which MacPorts upgraded me to)
test.c
- term: made change of 3/25 dependent on the compatibility level
support/config.guess,support/config.sub,support/config.rpath
- new versions, imported from gnulib
4/5
---
doc/bashref.texi
- update compatibility, posix mode, and bourne shell sections for
bash-5.3-alpha release
version.c
- update copyright date to 2024
[bash-5.3-alpha frozen]
4/6
---
builtins/cd.def
- cd_builtin: a null pathname argument is now an error; POSIX interp
1047
variables.c
- makunbound: revert change from 7/10/2023 about preserving the export
attribute when unsetting a local variable in light of POSIX interp
1806
4/8
---
bashline.c
- command_word_completion_function: we don't need to perform an extra
comparison against what rl_filename_completion_function returns if
we are searching $PATH for executable completions
- command_word_completion_function: if a directory name from $PATH
contains characters that need to be quoted, quote them and set
rl_completion_found_quote to force rl_filename_completion_function
to dequote the entire pathname
- command_word_completion_function: since the directory name from $PATH
is not quoted, use the dequoted hint to construct the full pathname
to pass to rl_filename_completion_function (possibly after quoting it)
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306043
4/10
----
redir.h
- RX_EXPANDED: flag set when translating redirects to their final form;
indicates the redirection should not be expanded again
redir.c
- do_redirection_internal: when translating a redirect into
r_err_and_out, set the RX_EXPANDED flag so the filename doesn't
get expanded again.
Fixes bug reported by squeaky <q7d9y9muja@liamekaens.com>
4/12
----
parse.y
- expecting_in_command: new variable, set to FOR or CASE depending on
which command is expecting the IN token to follow it
- {save,restore}_parser_state: save and restore expecting_in_command
in `incmd' member
- special_case_tokens: for POSIX rule 6, check expecting_in_token
instead of last_read_token/token_before_that for case/for command
and whether we should return IN and maybe set PST_CASEPAT
- special_case_tokens: reset expecting_in_command before returning DO
- read_token_word: set expecting_in_command if last_read_token was
CASE or FOR and we are returning a WORD
- reset_parser: reset expecting_in_command
- parse_comsub,parse_compound_assignment: reset expecting_in_command
Fixes bug reported by nbowler@draconx.ca
parser.h
- incmd: new member of parser_state, saves and restores the value of
expecting_in_command
- PST_FORCMD: new parser state, used to say if we're parsing a `for'
command and waiting for an IN token (not used yet)
4/22
----
config-top.h
- MULTIPLE_COPROCS: now enabled by default
4/23
----
doc/bash.1,doc/bashref.texi
- add text clarifying the difference between PIPESTATUS and $?
expr.c,redir.c,jobs.c,parse.y,arrayfunc.c,test.c,subst.c
builtins/declare.def,builtins/wait.def,builtins/printf.def
- went through and removed or modified TAGs for bash-5.3
lib/readline/bind.c
- rl_print_keybinding: handle case where there are no key sequences
bound to the command name; don't just print out every unbound key
builtins/bind.def
- bind_builtin: if the shell compatibility level is > 52, interpret
additional non-option arguments supplied with -P and -p as bindable
command names and print out any bindings for those names
4/24
----
Makefile.in,doc/Makefile.in,builtins/Makefile.in
lib/sh/Makefile.in,lib/glob/Makefile.in,lib/tilde/Makefile.in
lib/readline/Makefile.in
- MFLAGS -> BASH_MAKEFLAGS, rely on make passing MAKEFLAGS in the
environment
From a report by Cedric Blancher <cedric.blancher@gmail.com>
buildconf.h
- new build include file, construct from buildconf.h.in; contains a
subset of config.h for use by the build tools
mksyntax.c
- now assumes a C90 compilation environment; includes buildconf.h for
any build-time configuration variables
Makefile.in
- buildconf.h: add to CREATED_CONFIGURE
- mksyntax: now depends on buildconf.h instead of config.h
4/25
----
support/bashversion.c,version.c
- now assumes a C90 compilation environment; includes buildconf.h for
any build-time configuration variables
support/printenv.c,support/recho.c,support/xcase.c,support/zecho.c
- now assumes a C90 compilation environment and POSIX.1-1990 execution
environment
4/26
----
redir.h
- RX_INTERNAL, RX_USER (unused), RX_SAVCLEXEC, RX_SAVEFD, RX_EXPANDED:
new values starting at 0x80, now intended for rflags member of a
struct redirect; don't want them colliding with O_XX flags for open
and fcntl
redir.c
- rflags: save redirect->rflags and pass it to make_redirection if
we're translating a redirection into a new one
- new_redirect: pass rflags to all calls to make_redirection now that
it holds more than REDIR_VARASSIGN
- RX_INTERNAL, RX_USER (unused), RX_SAVCLEXEC, RX_SAVEFD, RX_EXPANDED:
check and assign these in the rflags member; they're only used here
- do_redirection_internal: assign new_redirect->rflags back to
redirect->rflags since it can possibly be modified with RX_EXPANDED
- do_redirection_internal: take care not to leave REDIR_VARASSIGN in
new_redirect->rflags, since it will cause redirector to be freed,
leading to accessing freed memory
From a report by Clark Wang <dearvoid@gmail.com> and a hint from
<oguzismailuysal@gmail.com> and Grisha Levit <grishalevit@gmail.com>
4/28
----
lib/sh/anonfile.c
- anonopen: call memfd_create with MFD_NOEXEC_SEAL
From a report by Kerin Millar <kfm@plushkava.net>
4/29
----
shell.c,shell.h
- su_shell: now global
variables.c
- get_bash_name: use the user's login shell for $BASH if the shell is
a login shell and the name is "-su".
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069978
subst.c
- uw_unbind_localvar: unwind-protect to unbind a local variable at
the current function context
- function_substitute: make sure we unbind the local REPLY we created
at the current (fake) context
From a report by Koichi Murase <myoga.murase@gmail.com>
4/30
----
subst.c
- expand_arrayref: fix crash from freeing memory that's only allocated
and initialized if ARRAY_VARS is defined
Report and patch from Henrik Lindström <henrik@lxm.se>
jobs.h,jobs.c
- JLIST_POSIX: new format argument for pretty_print_job; implements
POSIX requirement that jobs display the status of all background
jobs and all jobs the user hasn't been notified about (unused yet)
- JLIST_BGONLY: new format argument for pretty_print_job; restricts
output to background jobs only (unused yet)
jobs.c,jobs.h,execute_cmd.c,subst.c
- freeze_jobs_list: now takes an int argument with the new value of
jobs_list_frozen; prep for having different values with different
meanings; changed callers
jobs.c
- wait_for_any_job: return right away if jobs_list_frozen > 0; allow
job status changes (e.g., J_NOTIFIED) if jobs_list_frozen < 0; use
this instead of testing executing_funsub directly
- notify_and_cleanup: allow notification and status change if
jobs_list_frozen < 0; don't delete any dead jobs
- should_notify: takes a job index and returns 1 if the shell would
notify the user about it, given the current job state
- pretty_print_job: if the jobs list is frozen, only print status
about jobs for which the shell would notify users (by calling
should_notify())
subst.c
- function_substitute: freeze the jobs list with value -1 so jobs
can change status and possibly inhibit printing by `jobs'
5/2
---
jobs.c
- notify_and_cleanup: allow job notifications if an interactive shell
is running a trap (interactive == 0 && interactive_shell && running_trap)
Fixes report by Koichi Murase <myoga.murase@gmail.com> on 11/14/2022
- print_pipeline: don't print an extra space before the pipeline; push
that into pretty_print_job; print the space after the pid if we
print one
jobs.h
- LONGEST_SIGNAL_DESC: update to 27 (macos SIGPROF). This changes the
test output
5/3
---
builtins/common.h
- SEVAL_NOTIFY: new flag for parse_and_execute; means we want job
notifications even though we're not interactive at this time and
would not satisfy the conditions
builtins/evalstring.c
- parse_prologue: if SEVAL_NOTIFY is supplied, unwind-protect
want_job_notifications and set it to 1
jobs.c,jobs.h.nojobs.c
- want_job_notifications: new global variable, initialized to 0
jobs.c
- notify_and_cleanup: notify about dead jobs if want_job_notifications
is non-zero
parse.y
- execute_variable_command: call parse_and_execute with the SEVAL_NOTIFY
flag
eval.c
- reader_loop: call notify_and_cleanup before executing $PROMPT_COMMAND
if the shell is interactive and prompting
trap.c
- run_pending_traps,_run_trap_internal,run_exit_trap: add SEVAL_NOTIFY
to the flags for parse_and_execute if the shell is interactive
bashline.c
- bash_execute_unix_command: add SEVAL_NOTIFY to the flags for
parse_and_execute if the shell is interactive
Rest of fix for report by Koichi Murase <myoga.murase@gmail.com>
on 11/14/2022
5/6
---
execute_cmd.c,shell.c,builtins/evalfile.c,unwind_prot.c
- change some translated error messages to make the text more uniform
and reduce the number of gettext() calls
redir.c,parse.y,bashhist.c.locale.c
builtins/common.c,builtins/bind.def,builtins/exec.def,builtins/fc.def
builtins/help.def,builtins/mapfile.def,builtins/printf.def,builtins/read.def
builtins/ulimit.def
- change some error messages to avoid having the format be the return
value from gettext() to avoid clang complaints; simplified
translatable strings and made them more uniform by removing printf
formatting directives
execute_cmd.c
- notfound_str: cache the translated version of "command not found"
so we can call gettext early on and work around a macOS misfeature
From a MacPorts ticket https://trac.macports.org/ticket/68638
forwarded by Tom <tom@msbit.com.au>
- execute_disk_command: use notfound_str instead of calling gettext
every time a command isn't found
execute_cmd.c,execute_cmd.h
- init_notfound_str: call gettext to initialize and translate
notfound_str
- execute_disk_command: call init_notfound_str before forking if it
hasn't been initialized
locale.c
- set_default_locale_vars: after we set the appropriate values for the
locale shell variables, call init_notfound_str to force a call to
gettext()
jobs.c
- wait_for: don't try to set the tty state if we're running a trap,
even if a process terminates due to a signal
5/7
---
builtins/enable.def
- enable_builtin: don't try to turn enable f into enable -f f if the
shell is restricted
5/11
----
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/rltech.texi
- document some of the bindable commands bound to Home, End, Insert,
Page Up, and Page Down, if those keys exist
From a report by Xose Vazquez Perez <xose.vazquez@gmail.com> in 3/2024
configure
- make sure to note in CHANGES that configure now supports
--enable-year2038 for large time_t
5/14
----
pathexp.c
- glob_quote_char: new function, identify characters that should have
backslashes preserved when quoting a glob pattern. Currently has
all the glob_char_p characters plus `%' and `#' for pattern
substitution and removal.
Fixes issue reported by Andreas Schwab <schwab@suse.de>
5/16
----
pcomplete.c
- programmable_completions: change to allow a newly-loaded compspec
(after a completion function returns 124) to be used in more cases
From a patch from Grisha Levit <grishalevit@gmail.com>
mksyntax.c,version.c,support/bashversion.c
- include config.h if CROSS_COMPILING is not defined, assuming that
the build host and target host are the same
buildconf.h.in
- if cross-compiling, define _POSIX_C_SOURCE and _XOPEN_SOURCE to
get the C90/1003.1-1992 compilation environment we assume
From a report from Grisha Levit <grishalevit@gmail.com>
5/17
----
pathexp.c
- globsort_sizecmp,globsort_blockscmp: replace subtraction with a
generic transitive comparison function to avoid problems with
integer underflow
From a report from Grisha Levit <grishalevit@gmail.com>
5/20
----
lib/readline/kill.c
- _rl_bracketed_text: make sure buf is null-terminated even if
rl_read_key() returns an error
From a report from Grisha Levit <grishalevit@gmail.com>
builtins/read.def
- read_builtin: if -u and -e are both supplied, dup the file descriptor
supplied as an argument to -u and use it in the new FILE * to pass
to readline as rl_instream. Works around an android problem with
stdio and application-managed file descriptors
Report and patch from Grisha Levit <grishalevit@gmail.com>
5/21
----
lib/sh/spell.c
- mindist: don't check best unless we set it
Report and patch from Grisha Levit <grishalevit@gmail.com>
jobs.c
- make_child: if FORK_NOJOB is in the flags argument, don't call
setpgid to set the child's process group in either the parent or
child
- alloc_process,dispose_process: allocate and deallocate a PROCESS;
changed callers
subst.c
- command_substitute: call cleanup_the_pipeline after waiting for
the command substitution process, since we allocated it
5/22
----
lib/readline/text.c
- rl_execute_named_command: fix a leak if the command name is null or
the bound function doesn't return (rl_abort)
Report and patch from Grisha Levit <grishalevit@gmail.com>
bashline.c
- command_word_completion_function: free directory_part if it's left
over from a previous completion
- command_subst_completion_function: free contents of match list left
over from previous completion
- bash_spell_correct_shellword: free text if it's "" before returning
- build_history_completion_array: only call qsort if there's actually
something in the array to sort
Report and patches from Grisha Levit <grishalevit@gmail.com>
- bash_spell_correct_shellword: fix bug where we would correct the
previous word if we start on the first character of a word
- bash_spell_correct_shellword: make negative argument counts work
backwards, correcting words before point
Report from Grisha Levit <grishalevit@gmail.com>
5/23
----
lib/readline/text.c
- rl_change_case: if mbrtowc returns -1 or -2, jump to changing case
for a single character, since _rl_find_next_mbchar_internal() will
treat an invalid multibyte character as a sequence of bytes
Report from Grisha Levit <grishalevit@gmail.com>
5/25
----
execute_cmd.c
- shell_execve: fix typo in code that chops \r off the end of the #!
interpreter
Report and fix from Collin Funk <collin.funk1@gmail.com>
5/28
----
execute_cmd.c
- time_command: only restore command->flags if we haven't longjmped
Report from Michael Maurer <michael.maurer@univie.ac.at> and
Grisha Levit <grishalevit@gmail.com>
subst.c
- skip_to_delim: if we're not skipping over command substitutions
lexically, call extract_command_subst instead of using the old
extract_delimited_string
Fixes bug reported by Oguz <oguzismailuysal@gmail.com>
execute_cmd.c
- execute_arith_for_command: handle the extremely unlikely case that
the step or test expressions execute `break' or `continue' in a
nofork command substitution
Report from Oguz <oguzismailuysal@gmail.com>
5/29
----
lib/readline/complete.c
- compute_lcd_of_matches: if we have multiple matches that compare
equally when using case-insensitive completion, but are different
lengths due to the presence of multibyte characters, use the
shorter match as the common prefix to avoid overflow
Report from Grisha Levit <grishalevit@gmail.com>
5/30
----
lib/readline/text.c
- _rl_readstr_init: don't call rl_maybe_replace_line since we're not
actually moving off this history line
Report from Grisha Levit <grishalevit@gmail.com>
builtins/read.def
- read_builtin: free ifs_chars in more return code paths
Report and patch from Grisha Levit <grishalevit@gmail.com>
5/31
----
quit.h
- ZRESET: new macro, calls zreset() if interrupt_state is non-zero
lib/sh/zread.c
- zread: if read returns -1/EINTR, and we're executing a builtin,
call zreset just in case
builtins/read.def
- read_builtin: if read returns > 0 (partial read) but interrupt_state
is non-zero, we're going to call throw_to_top_level, so call
ZRESET before that happens
Report from Oguz <oguzismailuysal@gmail.com>
- read_builtin: if zread/zreadc/zreadintr/zreadcintr return -1/EINTR,
make sure we call ZRESET in case zread did not
variables.h
- ASSIGN_DISALLOWED: macro that encapsulates when an assignment to
SHELL_VAR *v with flags f will be disallowed and fail
arrayfunc.c,execute_cmd.c,expr.c,redir.c,subst.c,variables.c
builtins/delare.def,builtins/getopts.def,builtins/printf.def,builtins/read.def
- use ASSIGN_DISALLOWED where appropriate
arrayfunc.c
- assign_array_element_internal: if the assignment failed, as tested by
ASSIGN_DISALLOWED, free the assoc array key we allocated
Report from Grisha Levit <grishalevit@gmail.com>
6/3
---
variables.c
- bind_function_def: don't copy the command tree if we're overwriting
a function definition; after function binding, the function_def
struct never uses the saved command anyway
From a report and patch by Koichi Murase <myoga.murase@gmail.com>
parse.y
- make sure to free WORD in coproc WORD COMMAND after creating the
coproc struct
Report and patch from Grisha Levit <grishalevit@gmail.com>
builtins/exec.def
- exec_builtin: we don't need to set args to NULL; if shell_execve
reallocates args to add more items at the front, it has committed
to longjmp back to the top level
Report and patch from Grisha Levit <grishalevit@gmail.com>
subst.c
- expand_word_internal: dispose of the list used for $@ if we're not
splitting and save the space-separated list back to tword->word
Report and patch from Grisha Levit <grishalevit@gmail.com>
parse.y
- read_token: if we try to parse a conditional command and get a syntax
error, make sure to dispose of the partial command we created
Report and patch from Grisha Levit <grishalevit@gmail.com>
- read_token: if we try to parse a conditional command and get a syntax
error because we read an unexpected WORD, dispose of the WORD_DESC
before returning -1
Report and patch from Grisha Levit <grishalevit@gmail.com>
- cond_term: if we read a WORD where we expect something else, dispose
of the WORD_DESC before returning COND_ERROR
Report and patch from Grisha Levit <grishalevit@gmail.com>
6/10
----
parse.y
- cond_term: if we read a WORD when expecting a close paren, dispose
of the WORD_DESC before returning COND_ERROR
- error_token_from_token: use the TOK argument instead of
current_token if we can't find the token as a reserved word or
symbol
6/12
----
builtins/source.def
- source_builtin: add -p PATH option, searches PATH argument instead
of $PATH; overrides sourcepath; does not search $PWD if path search
fails
doc/bash.1,doc/bashref.texi
- source: document -p
pathexp.c
- if the size, blocks, or any of the time values compare equal, use
the name for a secondary sort key
lib/sh/winsize.c
- tcgetwinsize: provide definition for missing newly-standard function
- get_new_window_size: use tcgetwinsize
subst.c
- do_compound_assignment: if ASS_CHKLOCAL is in the flags, check for
variables at previous local scopes instead of just the current local
scope and the global scope
Part of fix for inconsistency between arrays and scalar variables
reported by Will Allan <billyzkid@yahoo.com>
builtins/declare.def
- declare_find_variable: if `declare -G' is used, check for
variables at previous local scopes instead of just the current local
scope and the global scope
Rest of fix for inconsistency between arrays and scalar variables
reported by Will Allan <billyzkid@yahoo.com>
pathexp.h
- SORT_NUMERIC: new "numeric" sort specifier
pathexp.c
- globsort_numericcmp: new sort function for the "numeric" sort
specifier: all-digit names are sorted as numbers; names containing
any non-digits sort after all-digit names and are sorted
lexicographically.
Inspired by a discussion with Robert Elz <kre@munnari.oz.au>
6/21
----
lib/readline/text.c
- rl_change_case: make mlen size_t to assign the return value from
wcrtomb; change the tests of < 0 to use MB_INVALIDCH.
Report from Siteshwar Vashisht <svashisht@redhat.com>
6/26
----
trap.c
- run_debug_trap: give the terminal back to pipeline_pgrp only if
job_control is enabled; that's the only way the trap command would
have given it to a different process group
Fixes bug reported by Mark March <march@systempad.cloud>
6/27
----
configure.ac
- remove support for cached files for cross-compiling; it's too hard
to keep them up-to-date without access to the platforms
6/28
----
lib/readline/util.c
- _rl_audit_tty: make sure to close fd before returning on error
lib/sh/casemod.c
- sh_modcase: use size_t variable as return value for wcrtomb; check
for invalid wide char and copy all characters in the multibyte
character as-is if it is
lib/sh/zwrite.c
- zwrite: use size_t and ssize_t variables
builtins/evalfile.c
- _evalfile: use size_t variable for return value from strlen()
lib/readline/funmap.c
- rl_funmap_names: don't bother calling qsort if result doesn't have
any entries
All from a report by Siteshwar Vashisht <svashisht@redhat.com>
6/29
----
lib/readline/examples/histexamp.c,lib/readline/examples/manexamp.c,
lib/readline/examples/rl-callbacktest.c,lib/readline/examples/rl-callbacktest2.c,
lib/readline/examples/excallback.c,lib/readline/examples/rlptytest.c
- small changes to fix warnings
From a report by Hiroo Hayashi <hirooih@gmail.com>
7/1
---
execute_cmd.c:
- ADJUST_LINE_NUMBER: encapsulate code that adjusts line_number in
shell functions executed in interactive shells into a macro
7/2
---
doc/bash.1,doc/bashref.texi
- changes to the --rcfile description to avoid the use of `force' and
stay away from the word `replace'
lib/readline/misc.c
- _rl_maybe_replace_line: old rl_maybe_replace_line, now takes an
argument saying whether or not to clear rl_undo_list
- rl_maybe_replace_line: now calls _rl_maybe_replace_line with a 0
argument for backwards compatibility
lib/readline/rlprivate.h
- _rl_maybe_replace_line: extern declaration
lib/readline/search.c
- _rl_nsearch_init,rl_history_search_internal: call _rl_maybe_replace_line
with a 1 argument so these searches can manage rl_undo_list and
restore it appropriately
- rl_history_search_internal: don't set the history offset back to
oldpos if the history search is successful; we want the history offset
to be set to the position of the last matching line, like isearch
7/5
---
jobs.c
- procsub_reap: new function, blocks and unblocks SIGCHLD around
call to procsub_prune
- cleanup_dead_jobs: call procsub_reap even if there are no jobs in
the jobs list or the jobs list is frozen
Inspired by report from Zachary Santer <zsanter@gmail.com>
7/6
---
subst.c,subst.h,execute_cmd.c,jobs.c
- reap_procsubs: rename to delete_procsubs
7/7
---
aclocal.m4
- BASH_CHECK_LIB_TERMCAP: check for ncursesw before ncurses, add
-lncursesw if found, to avoid pkgconfig issues for readline (since
this is a shared file)
Report and fix from Rosen Penev <rosenp@gmail.com>
7/8
---
builtins/evalstring.c
- should_optimize_fork: don't optimize the fork if we're executing in
a shell function and a return trap is set
- optimize_shell_function: mark a simple command at the end of a shell
function as a candidate for optimization, rather than setting
CMD_NO_FORK before the function executes -- it could set a return
trap
Report from Jens Schmidt <farblos@vodafonemail.de>
- parse_and_execute: don't let process substitutions or other calls
to parse_and_execute do <file; that should be reserved for command
substitutions and implemented in command_substitute
Report by Emanuele Torre <torreemanuele6@gmail.com>
- parse_string: if flags & SEVAL_ONECMD, stop after parsing a single
command, even if it doesn't consume the entire string
parse.y
- parse_string_to_command: call parse_string with SEVAL_ONECMD, since
we only want to parse a single command and make sure it consumes
the entire string, not consume the string and return the last command
parsed
7/9
---
bashline.c
- _ignore_completion_names: restrict force_fignore to act only on
completions that should be affected by FIGNORE; in other cases
act as if it were set to 1
From a report and patch by Koichi Murase <myoga.murase@gmail.com>
7/15
----
builtins/ulimit.def
- add help text saying that some of the units change in posix mode
7/17
----
subst.c
- remove some unused functions
jobs.c,jobs.h
- procsub_search,procsub_delete: now take an extra parameter saying
whether or not to block SIGCHLD while they run; avoids overhead
when called when SIGCHLD is already blocked; changed callers and
extern declaration
- struct process now has a new FLAGS member; possible values defined
in jobs.h; initialized in alloc_process
- procsub_setflag,procsub_setflag: set one of the PROC_XXX flags on
one or all of the processes in the procsub list
- new value for the flags argument to make_child: FORK_PROCSUB
- add_process: now returns the PROCESS * it creates so the caller can
set flags or otherwise modify it
- get_job_by_pid: return NO_JOB for negative pids immediately
subst.c
- process_substitute,command_substitute: call make_child with the
appropriate FORK_ flag
jobs.c
- make_child: set PROC_ flags in the PROCESS * we create based on the
FORK_ flags the caller passes
- wait_for: only call set_procsub_status if the process has terminated
- wait_for_any_job: check for any terminated procsubs as well as any
terminated background jobs
builtins/wait.def
- check_bgpids: rename to check_nonjobs
- wait_builtin: if the -n option is supplied and pid arguments are
supplied, check the bgpids list and procsubs for terminated processes
- check_nonjobs: if one of the pids in LIST corresponds to a terminated
procsub, return its status and move the procsub to the bgpids list
- set_waitlist: if we have a non-existent or invalid job, and a pid
argument that's >= 0, look for a procsub with that pid and set
PROC_WAITING if we have one
- unset_waitlist: unset PROC_WAITING in all procsubs
7/18
----
jobs.c
- procsub_prune: set last_procsub_child to NULL if we are cleaning up
that process because it's terminated, since that will invalidate the
pointer
7/22
----
lib/malloc/malloc.c
- RIGHT_BUCKET: don't check binsizes[nu-1] unless nu >= 1; clamp at 0
otherwise
- internal_realloc: don't check bucket at nunits-1 unless nunits >= 1
Report and fix from Collin Funk <collin.funk1@gmail.com>
7/25
----
variables.c
- push_source: new function, pushes a filename to BASH_SOURCE; changed
callers (shell.c, execute_cmd.c, builtins/evalfile.c)
- bash_source_fullpath: new variable, if non-zero, push_source runs
the filename through sh_realpath before pushing it to BASH_SOURCE
Feature requested by several, including konsolebox <konsolebox@gmail.com>
builtins/shopt.def
- bash_source_fullpath: new option, controls bash_source_fullpath and
whether or not BASH_SOURCE contains full pathnames
doc/bash.1,doc/bashref.texi
- bash_source_fullpath: document new shell option
7/26
----
jobs.c,jobs.h,subst.c
- last_procsub_pid: new variable, set to the pid of last_procsub_child,
so it will survive the PROCESS * being deleted if we need it. Not
used yet
7/29
----
doc/bash.1,doc/bashref.texi
- wait: update description to clarify wait -n and unify language
Inspired by report from Zachary Santer <zsanter@gmail.com>
- set: note that the -e behavior for pipelines is affected by the
state of the pipefail option
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
variables.c,hashcmd.c,builtins/hash.def,builtins/history.def,builtins/source.def
- use ABSPATH/RELPATH/absolute_program instead of testing for slash
explicitly
7/30
----
lib/readline/histfile.c
- history_do_write: return 0 immediately if nelements < 0
Report from ZeroIntensity Dev <zintensitydev@gmail.com>
8/3
---
lib/sh/zread.c,externs.h
- zungetc: new function, pushes a character back into a single char of
storage so it can be used with the zread* functions that call read(2)
directly and don't use lbuf. If we try to push back more than one
char, we use lbuf, assuming that the caller will accommodate it
builtins/read.def
- read_mbchar: if we read a partial multibyte character (-2) and then
a delimiter that makes it an invalid multibyte character (-1), use
zungetc to push the delimiter back, adjust mbchar, and return what
we read so far to be added as single bytes
From a report by Kerin Millar <kfm@plushkava.net>
8/7
---
builtins/evalstring.c
- can_optimize_connection: only check bash_input.location.string if
bash_input.type == st_string, in case we want to use this in other
contexts. If we do, the caller *must* make sure it's the last
command in the calling context
execute_cmd.c
- execute_subshell_builtin_or_function: if this is an async function
call, try to optimize away the fork before the last simple command
in the function body by calling optimize_shell_function
- execute_command_internal: if we have a simple command for which
CMD_TRY_OPTIMIZING is set in a SUBSHELL_ASYNC subshell environment,
try to set CMD_NO_FORK by checking via should_optimize_fork
8/9
---
parse.y
- yy_readline_get: before calling readline, call rl_clear_signals to
reset the signal handling disposition to a known state. Most of the
time it's a no-op
lib/readline/signals.c
- _rl_handle_signal: make the call to sigprocmask(SIG_UNBLOCK,...
more symmetric with the corresponding call to SIG_BLOCK
trap.c
- run_pending_traps: before calling run_interrupt_trap, restore
running_trap and trap_return_context, since _run_trap_internal
will save and restore them, too
builtins/read.def
- read_builtin: if -e is supplied, make sure to install unwind-protects
to reset the attempted completion function and the event hook even
if the timeout is not supplied.
Report from Oguz <oguzismailuysal@gmail.com>
8/12
----
lib/readline/histsearch.c,lib/readline/histlib.h
- history_search_internal: takes a new argument, LINEDIR, saying which
direction to perform the substring/pattern search in the line,
decoupling it from the direction through the history list; changed
all callers (history_search, history_search_prefix, _hs_history_search,
_hs_history_patsearch)
- _hs_history_search,_hs_history_patsearch: takes the same new LINEDIR
argument, just passes it to history_search_internal; changed all
callers (noninc_search_from_pos)
lib/readline/search.c
- noninc_search_from_pos: changed calls to _hs_history_search and
_hs_history_patsearch
lib/readline/histexpand.c
- get_history_event: instead of using function pointers to a history
search function, set the right flags and just call _hs_history_search
with those flags using -1 for list direction and line direction
8/13
----
builtins/printf.def
- printf_builtin: fix params to call to mklong for long double formats
if STRTOLD_BROKEN is defined
lib/sh/winsize.c
- rearrange includes to make sure <termios.h> is included if
HAVE_TCGETWINSIZE is defined
Report from Grisha Levit <grishalevit@gmail.com>
8/14
----
lib/readline/rlmbutil.h
- _rl_is_basic: adapted from gnulib is_basic; tells whether a character
is a single byte because it's guaranteed by ISO C and POSIX
lib/readline/mbutil.c
- _rl_mbstrlen: counts the number of possibly multibyte characters in a
string depending on the current locale; uses _rl_utf8_mbstrlen or
_rl_gen_mbstrlen as appropriate (or strlen for a single-byte locale)
lib/readline/readline.c
- _rl_internal_char_cleanup: if we are using multibyte characters, call
_rl_mbstrlen to determine whether or not we've read as many characters
than rl_num_chars_to_read says we should
Report from Grisha Levit <grishalevit@gmail.com>
builtins/read.def
- delim,delim_char: once again an int so we can more easily
distinguish -1 and other unsigned char values >= 0x7f; make
sure delim gets an unsigned char if passed with -d
- edit_line: now takes an int parameter for the delim char; only add
the delim to the end of the string if it's non-negative
- set_eol_delim,unset_eol_delim: now explicitly check whether or not
the delimiter character is non-negativesince it's no longer unsigned
- read_mbchar: make sure to cast the char read to unsigned before
comparing it against the delim
Report and patch from Grisha Levit <grishalevit@gmail.com>
8/15
----
include/shmbchar.h,lib/sh/shmbchar.c
- is_basic: update test for IS_BASIC_ASCII to include $, @, and `,
which ISO C guarantees to be single-byte
- is_basic_table: update bitmap to include new characters
8/21
----
shell.c
- main: make sure to set read_but_dont_execute (-n) to 0 in an
interactive shell in case it was set at invocation, but not in
cases where it was forced with -i
Report from Milana <94888u@riseup.net>
8/22
----
lib/readline/bind.c
- force-meta-prefix: new bindable variable, used to determine whether
to convert a meta character (>= 0x80) to an escape-prefixed key
sequence (using ESC as the meta prefix). If set, do the conversion
unconditionally; if unset, use the value of convert-meta as in
previous bash/readline versions
Suggestion from Reuben Thomas <rrt@sc3d.org>
- _rl_function_of_keyseq_internal: if we encounter a character/byte
with the eighth bit set, use force-meta-prefix to decide whether
to translate it to an escape-prefixed key sequence
- rl_bind_key: if we have a meta character, assume it was generated by
Meta- and honor the setting of force-meta-prefix
- rl_translate_keyseq: if we have \M-, use force-meta-prefix to decide
whether or not to translate it to an escape-prefixed key sequence
lib/readline/doc/rluser.texi,lib/readline/doc/readline.3,doc/bash.1
- force-meta-prefix: document new bindable variable and defaults
- convert-meta, enable-meta-key, input-meta, output-meta: update
description with better explanation of Meta key and meta characters,
and locale character encoding
- Key Bindings: expand description of \M- and Meta- modifiers
- Readline Introduction: expand description of the Meta key and the
various things it can do, reference force-meta-prefix and
enable-meta-key
8/26
----
doc/bashref.texi
- case: add process substitution to the list of expansions for the
word.
Reported by shynur <one.last.kiss@outlook.com>
execute_cmd.c
- execute_null_command: if an empty simple command (no words, just
redirections) requires a fork, reset top_level and exit if we
longjmp there. This can happen with an expansion error while we
evaluate the redirection.
Report from youheng.lue@gmail.com
- execute_connection: in default mode, bash performs jobs notifications
in an interactive shell between commands separated by ';' or '\n'.
It shouldn't do this in posix mode, since posix now specifies when
notifications can take place
examples/loadables/{realpath,csv,dsv,cut,stat,kv}
- changes to make them build when arrays are not available
Report from Dennis Clarke <dclarke@blastwave.org>
jobs.c
- notify_and_cleanup: make interactive shells notifying during sourced
scripts dependent on the shell compatibility level and inactive in
versions beyond bash-5.2
Inspired by report from Zachary Santer <zsanter@gmail.com>
doc/bashref.texi
- Bash posix mode: note the change with job notifications in command
lists
- Shell compatibility mode: note job notification changes for compat
level > 52
parse.y
- CHECK_FOR_RESERVED_WORD: call set_word_top here on the reserved word
token about to be returned; don't worry about trying to set it after
the fact
Report from Collin Funk <collin.funk1@gmail.com>
8/28
----
parse.y
- CHECK_FOR_RESERVED_WORD: change word_top to keep track of the line
number where a compound command begins; call set_word_top on the
current token about to be returned
- read_token_word: call set_word_top if special_case_tokens returns
something; currently used for `{'
- set_word_top: add `{' to the list of compound commands we track
- grammar: every time we parse a group command or equivalent for the
`for' and `select' compound commands, decrement word_top after we
see the `}'
- parse_dparen: set arith_lineno from word_lineno[word_top] since we
now set it for FOR when we read it
8/29
----
parse.y
- read_token: don't turn on PST_SUBSHELL after reading a left paren
if the last token was a WORD, since that's a function definition,
not a subshell
- read_token,parse_dparen: don't turn on PST_SUBSHELL if we run into
a left paren while parsing a conditional command (PST_CONDCMD is
set in parser_state)
- set_word_top: add `(' to the tokens saved in word_lineno
- grammar: decrement word_top in the subshell_command production
- read_token,parse_dparen: call set_word_top where we add PST_SUBSHELL
to parser_state
8/30
----
parse.y
- set_word_top: add COND_START to the list of tokens that set
word_lineno[word_top]
- grammar: decrement word_top after COND_END
- rename: word_lineno -> compoundcmd_lineno, word_top -> compoundcmd_top,
set_word_top -> set_compoundcmd_top
lib/readline/signals.c
- _rl_release_sigint: don't check for signals if we're already
handling a received signal
Report from Tycho Kirchner <tychokirchner@mail.de> and
Eduardo A. Bustamante López <dualbus@gmail.com>
8/31
----
builtins/printf.def
- printf_builtin: when parsing a time specification format, don't
increment the format pointer to check for 'T' unless it points
to a closing right paren, rejecting the format if it's not a `)'
when the loop breaks
Report from Andrey Kovalev <i.not.student@yandex.ru>
9/6
---
jobs.c,jobs.h
- notify_and_cleanup: now takes an argument saying which job to notify
about; if arg is -1 it notifies about all jobs as previously
- maybe_print_job_notifications: convenience function to encapsulate
policy about when to call notify_of_job_status in one place; called
by notify_and_cleanup
- notify_of_job_status,maybe_print_job_notifications: now take an int
argument with the same semantics as notify_and_cleanup
- wait_for_any_job: now call notify_of_job_status only on the job we
just retrieved and will return
- wait_for: don't call notify_and_cleanup if posixly_correct unless
the shell is not currently interactive, since posix says we can
notify in a non-interactive shell when a foreground job changes
state
jobs.c,parse.y,eval.c,execute_cmd.c,builtins/jobs.def,trap.c
- notify_and_cleanup: changed all callers appropriately
builtins/evalfile.c
- _evalfile: renamed to evalfile_internal
- evalfile_internal: increment and decrement (or unwind-protect) the
value of want_job_notifications; increment it to a non-zero value
if the shell is interactive and the compatibility level is <= 52
(see change to notify_and_cleanup of 8/26)
jobs.c
- maybe_print_job_notifications: remove clause testing sourcelevel;
use want_job_notifications for this
9/11
----
[prayers for the victims of 9/11]
9/12
----
support/mkdep
- new version from Martin Kealey; modified for inclusion
Makefile.in
- MKDEP_ variables to be able to control various aspects of `make
depend'
9/13
----
configure.ac
- relstatus: update to `beta'
9/16
----
builtins/jobs.def
- jobs_builtin: when listing individial jobs, don't call notify_and_cleanup
(which notifies about outstanding terminated jobs) if the shell is
interactive and in posix mode
9/20
----
jobs.c
- wait_for_single_pid: if wait finds a status for the pid argument in
the bgp list, remove it from the bgp list if the shell is in posix
mode
9/23
----
execute_cmd.c
- execute_command_internal: if the COMMAND * passed in to execute has
the CMD_INVERT_RETURN flag set, make sure we propagate that to
simple commands, for commands, arith for commands, select commands,
case commands, while/until commands, if commands, group commands,
shell functions, pipelines, subshells, and connections so if set -e
is enabled in the body (or test for if/while/until) its effect is
ignored
- execute_in_subshell: if the subshell's return status is being inverted,
make sure to ignore set -e in the commands the subshell executes
- execute_pipeline: if the pipeline's return status is being inverted,
make sure to ignore the effects of set -e in all pipeline elements
- execute_connection: if the list's return status is being inverted
(tough to do because of precedence), make sure the list commands
ignore the effect of set -e
9/24
----
jobs.c
- start_job: don't fetch the tty settings if we're being called from
a readline key binding (bind -x) or programmable completion
From a report by David Moberg <kaddkaka@gmail.com>
9/25
----
jobs.c
- wait_for_any_job: if the jobs table is empty and there are no
eligible procsubs, and the shell is in posix mode, take a random
pid from the bgpids table, delete it, and return its status
(since we would be deleting that pid from bgpids anyway)
9/26
----
lib/readline/histexpand.c
- history_tokenize_word: fix off-by-one error (incrementing i one too
many positions after the increment in the loop) preventing words
like `$((expr))' from being tokenized correctly
Report from Milana <94888u@riseup.net>
config.h.in,configure.ac
- new option: bash-source-fullpath-default: set it to make the
bash_source_fullpath option enabled by default; sets
BASH_SOURCE_FULLPATH_DEFAULT
Based on a patch from konsolebox <konsolebox@gmail.com>
variables.c
- bash_source_fullpath: initialize to BASH_SOURCE_FULLPATH_DEFAULT,
set by configure
doc/bashref.texi
- --enable-bash-source-default: document
9/27
----
doc/bash.1,doc/bashref.texi
- update builtins documenation: make language and paragraph breaks
more consistent between the document formats; update active
language
10/1
----
doc/bash.1,doc/bashref.texi,lib/readline/doc/rluser.texi,lib/readline/doc/hsuser.texi
- update more documentation sections to make language consistent
between formats, reduce passive voice
10/7
----
lib/readline/doc/history.3
- update history expansion section to be consistent with hsuser.texi
and bash.1
doc/bash.1,doc/bashref.texi,lib/readline/doc/rluser.texi,lib/readline/doc/readline.3
lib/readline/doc/hsuser.texi,lib/readline/doc/history.3
- next set of updates for consistency between formats, update language,
fix formatting conventions
10/11
-----
lib/readline/doc/rltech.texi,lib/readline/doc/hstech.texi
- next set of updates for consistency between formats, update language,
fix formatting conventions
10/12
-----
Makefile.in,builtins/Makefile.in
- update dependencies on readline, history include files
builtins/shopt.def
- update bash_source_fullpath reset to use new default
configure.ac
- update to use the right option name for bash-source-fullpath-default
Report and patch from Grisha Levit <grishalevit@gmail.com>
braces.c
- mkseq: fix loop condition to avoid integer overflow
Report and patch from Grisha Levit <grishalevit@gmail.com>
builtins/help.def
- show_desc: don't assume that long_doc[0] ends with a newline,
just add one manually when we hit a newline or NULL
Report and patch from Grisha Levit <grishalevit@gmail.com>
builtins/read.def
- read_builtin: don't check the timeout after breaking out of the
character read loop unless we didn't read anything (i == 0) and
the last read return EOF or error
- read_builtin: move check_read_timeout call to the end of the read
loop, after we check for the delimiter and whether or not we've
read the right number of characters, so we always return any
valid data
Report from Thomas Oettli <thomas.oettli@sfs.com>
10/14
-----
jobs.c
- wait_for_any_job: in posix mode, take any terminated pid from bgpids
before waiting for a running job to terminate
Inspired by report from Zachary Santer <zsanter@gmail.com>
10/14
-----
doc/bash.1,doc/bashref.texi
- next set of updates for consistency between formats, update language,
fix formatting conventions (job control section)
doc/bash.1,doc/bashref.texi,lib/readline/doc/readline.3,lib/readline/doc/rluser.texi
- minor wording updates and typo fixes from
G. Branden Robinson <g.branden.robinson@gmail.com>
10/15
-----
doc/bash.1,doc/bashref.texi,lib/readline/doc/readline.3,lib/readline/doc/rluser.texi
- wording/formatting updates and typo fixes from
G. Branden Robinson <g.branden.robinson@gmail.com>
doc/bash.1
- update .FN macro, use it consistently for filenames, like @file{}
doc/bashref.texi
- make sure to use @dots and @file consistently
doc/bash.1,lib/readline/doc/readline.3
- make sure `readline' is typeset consistently
10/18
-----
sig.c
- fix minix typo
lib/readline/history.c
- history_do_write: for portability, make sure that the offset argument
to mmap is page-aligned, since some systems (linux, macos) require it.
Report and patch from Grisha Levit <grishalevit@gmail.com>
lib/readline/util.c
- rl_tilde_expand: rearrange code to do bounds checking before data
validation when finding the end of the tilde-word to avoid
touching uninitialized data
Report and patch from Grisha Levit <grishalevit@gmail.com>
10/20
-----
doc/bash.1,doc/bashref.texi
- update word splitting section to add what IFS whitespace means and
how word splitting uses it. Based on a bug-bash discussion
10/21
-----
lib/readline/colors.c
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/rluser.texi
- RL_COLOR_PREFIX_EXTENSION: remove the leading `.' again; this was
the result of a misunderstanding about how `dircolors' works
Report from Daniël Gerbrand Haasbroek <dghaasbroek@gmail.com>
lib/readline/isearch.c
- _rl_isearch_dispatch: when adding the character to the search
string, insert it as a single byte in the C locale (or if we're
not doing multibyte characters)
Report and patch from Grisha Levit <grishalevit@gmail.com>
10/23
-----
doc/bash.1,doc/bashref.texi
- SIGNALS: update section to make it clear how job control affects
SIGINT receipt and the behavior of the shell when it's waiting
for a command that receives one.
From a suggestion by Simone Robinson <robinson027@yahoo.com>
builtins/common.c
- get_job_spec: warn about deprecated notation if the job spec doesn't
have a leading `%'; code to return BAD_JOBSPEC tagged for bash-5.4
- sh_invalidjob: new convenience function to print error for invalid
job specifications
builtins/jobs.def, builtins/ kill.def, builtins/ wait.def, builtins/fg_bg.def
- handle BAD_JOBSPEC return from get_job_spec; call sh_invalidjob.
Nothing returns that yet.
builtins/kill.def
- kill_builtin: change to use common error message via sh_badpid() if
we get an argument where the first character is not a digit or `%'
builtins/jobs.def
- jobs_builtin: check for INVALID_JOB return from get_job_spec to
avoid call to get_job_by_jid
10/24
-----
error.c, error.h
- err_invalidid: common error function for invalid identifiers;
changed callers in execute_cmd.c, general.c
general.c
- valid_function_word: separated posix check against special builtin
names (flags&4) and posix check for valid identifiers (flags&1);
callers need to differentiate. This means that posix mode does not
require function names to be valid identifiers
execute_cmd.c
- execute_intern_function: don't call valid_function_word with
(flags&1) in posix mode unless POSIX_RESTRICT_FUNCNAME is defined;
call with flags&4 to keep the check against special builtin names
print_cmd.c
- print_function_def,named_function_string: don't print functions
with names that are invalid identifiers with a leading `function'
config-top.h
- POSIX_RESTRICT_FUNCNAME: placeholder, not defined by default
doc/bashref.texi
- Posix mode: remove item about function names being valid shell
identifiers
10/25
-----
aclocal.m4
- simplify the checks for the various members of struct dirent
Report and patch from Grisha Levit <grishalevit@gmail.com>
m4/strtoimax.m4
- simplify and remove redundant caching and cache check
Report and patch from Grisha Levit <grishalevit@gmail.com>
builtins/common.c
- get_exitstat: make the behavior of exit with no arguments
running in a trap action the same as return: check for any trap
(running_trap > 0) in the current execution_context. This is
POSIX interp 1602, in POSIX.1-2024
stringlib.c
- find_token_in_alist: if FLAGS is non-zero, do *not* allocate new
memory for the token. The existing behavior is to allocate memory
and return a copy of the token, and all callers pass 0
parse.y
- compoundcmd_lineno: now an array of `struct tokeninfo', which
has line number and current compound command information
- change compoundcmd_lineno[compoundcmd_top] to
compoundcmd_lineno[compoundcmd_top].lineno in all calls
- set_compoundcmd_top: in addition to assigning line number info,
assign T to compoundcmd_lineno[compoundcmd_top].token
- report_syntax_error: if we get a syntax error while looking for
shell_eof_token (comsubs), include the token we were looking for
in the error message
- report_syntax_error: if we are reporting an unexpected EOF error,
and compoundcmd_top >= 0, look up the token for the compound
command we're parsing, including `(', and change the error message
to include it
10/26
-----
Makefile.in
- PURIFY,GLOBC,GLOBO,ALLOC_FILES,LIBRARY_SOURCE: remove
- ADDON_CFLAGS,ADDON_LDDFLAGS: initialize to empty
- GRAM_H: remove from HSOURCES
- profiling-tests: use Program instead of PROGRAM
builtins/Makefile.in
- DEBUG: initialize from configure
- SYSTEM_FLAGS: remove, since it's not passed from topdir Makefile
- ADDON_CFLAGS: initialize to empty
lib/glob/Makefile.in
- ADDON_CFLAGS: initialize to empty
lib/readline/Makefile.in
- ADDON_CFLAGS: initialize to empty
- APP_CFLAGS: remove
lib/sh/Makefile.in
- DEBUG: initialize from configure
- ADDON_CFLAGS: initialize to empty
- LIBOBJDIR: initialize to empty; configure uses it in LIBOBJS
lib/tilde/Makefile.in
- ADDON_CFLAGS: initialize to empty
- CCFLAGS: add ADDON_CFLAGS, replacing ASAN_CFLAGS
support/Makefile.in
- SYSTEM_FLAGS: remove, since it's not passed from topdir Makefile
Makefiles report and patch from Grisha Levit <grishalevit@gmail.com>
version.c,shell.h
- default_compatibility_level: int variable, initialized to
DEFAULT_COMPAT_LEVEL like shell_compatibility_level
variables.c
- sv_shcompat: use default_compatibility_level instead of
DEFAULT_COMPAT_LEVEL so variables.o doesn't have to depend on
version.h
builtins/shopt.def
- set_compatibility_level: use default_compatibility_level instead
of DEFAULT_COMPAT_LEVEL so shopt.o doesn't have to depend on
version.h
- don't include version.h any more
configure.ac,Makefile.in,support/Makefile.in,doc/Makefile.in
- remove some unused variables: BASE_CFLAGS_FOR_BUILD, DEBUGGER_DIR,
INTLOBJS, TEXINDEX, TEX, MALLOC, SIGNAMES_SUPPORT
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
10/28
-----
builtins/exec.def
- exec_builtin: don't try to print an error message in the cases
where shell_execve prints one, in case we have execfail set
Report from Emanuele Torre <torreemanuele6@gmail.com>
Makefile.in
- LIBRARY_SOURCE: add back in to tags targets, add definition
Suggestion from Mike Jonkmans <bashbug@jonkmans.nl>
10/31
-----
lib/readline/search.c
- make_history_line_current: change to use the same strategy to move
to a history line as incremental search: one or more calls to
rl_get_{next,previous}_history
- dispose_saved_search_line: remove
- noninc_dosearch: no longer need to call _rl_unsave_saved_search_line
or dispose_saved_search_line; use new calling convention for
make_history_line_current
- _rl_nsearch_init: don't need to call _rl_maybe_replace_line, wait
until we move to the history line
- _rl_nsearch_dosearch: free the undo list unconditionally, since we
are committed to using the contents of rl_line_buffer as the search
string
- _rl_nsearch_dosearch: if we abort because of no search string, call
_rl_unsave_saved_search_line and let the caller clean up
- _rl_nsearch_dosearch: if the search fails, reset rl_point to the
saved point, since we will be restoring the old line
- rl_history_search_internal: don't bother to save and restore the
search line, since we don't use rl_line_buffer for anything
- rl_history_search_internal: use new calling convention for
make_history_line_current
- all these changes unify the incremental and non-incremental search
implementations
lib/readline/readline.c
- rl_initialize: reset rl_eof_found to 0 at the same time we reset
the EOF state
Report and fix from Andrew Burgess <aburgess@redhat.com> (GDB)
11/6
----
lib/readline/display.c
- rl_redisplay: if we changed screen lines during the redisplay and
we need to return to the line with the cursor, make sure to account
for differing numbers of invisible characters in the two lines
- rl_redisplay: if we need to redisplay the prompt because we moved
into a portion of it containing invisible characters while moving
to the line containing the cursor, make sure to account for the
cursor being on a line other than 0 and the prompt wrapping lines.
If it wraps, we only want to redisplay the portion after the line
wrap before the line the cursor is on
Fix for C locale issues reported by Grisha Levit <grishalevit@gmail.com>
11/7
----
lib/termcap/termcap.c
- tgetent: fix small memory leak on file open error
Makefile.in
- y.tab.h: move from CREATED_HEADERS to INSTALLED_HEADERS so we don't
clean it
- maybe-clean: slightly change the syntax of the recipe
doc/Makefile.in
- PSFILES: split into CREATED_PS and ps files from the distro
so we just remove CREATED_PS in maintainer-clean target
- PDFFILES: split into CREATED_PDF and ps files from the distro
so we just remove CREATED_PDF in maintainer-clean targets
- clean,mostlyclean: swap
- mostlyclean: don't remove Makefile
- maybe-clean: use realpath equivalent like in top-level Makefile.in
Report from Mike Jonkmans <bashbug@jonkmans.nl>
11/11
-----
Makefile.in,doc/Makefile.in,lib/glob/Makefile.in,lib/readline/Makefile.in
lib/malloc/Makefile.in.,lib/tilde/Makefile.in
- mostlyclean: swap with clean where appropriate
- add .PHONY target for clean targets where appropriate
Makefile.in,configure.ac
- STDCKDINT_H: variable for possibly-created file stdckdint.h, for
dependencies; add dependencies where appropriate
Makefile.in,doc/Makefile.in
- add various gnu-standard install targets that do nothing
11/14
-----
CHANGES,NEWS
- updated for bash-5.3-beta
11/15
-----
lib/sh/snprintf.c
- wchars: fix small memory leak by freeing lbuf if wcrtomb fails
Report from SerGoGubarev <sergeygubarev263@gmail.com>
lib/readline/complete.c
- vector_len: an inline convenience function to return the length
of an array of strings; callers are remove_duplicate_matches,
rl_old_menu_complete, rl_menu_complete
- rl_complete_internal: add `$' as a value for what_to_do that
exports a (possibly null) list of possible completions to an
application or another process by writing them, using a specific
protocol, to rl_outstream
- rl_export_completions: bindable command to perform word completion
and write the results, with other information, to rl_outstream
- _rl_export_completions: workhorse function to export the completions
Based on a patch from Matthew Tromp <matthewktromp@gmail.com>,
original request from Spencer Baugh <sbaugh@catern.com> back in 11/23
lib/readline/readline.h
- rl_export_completions: extern declaration
lib/readline/funmap.c
- export-completions: new bindable command name
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/rluser.texi
- export-completions: document, including output format
11/19
-----
Makefile.in
- HYBRID_HEADERS: new variable containing header files that may appear
in the build directory or the source directory
- maybe-install-headers: rule to install header files that may appear
in the build directory or a subdirectory of it; install-headers
depends on it
- uninstall-headers: remove $(HYBRID_HEADERS); fix typo in recipe
11/21
-----
builtins/printf.def
- chk_converror: inline function to use for single place to check
for numeric overflow, change callers to use it
11/25
-----
doc/bash.1,doc/bashref.texi
- minor updates to the section on bracket expressions in pattern
matching
builtins/command.def
- update -v help string to indicate that the output is a single word
Report from Andrew Davis <addavis@gmail.com>
11/26
-----
builtins/printf.def
- chk_converr: add check for no characters being converted at all,
print same warning message as if *ep != 0. This covers the case of
an empty string argument.
Report by Paul Eggert <eggert@cs.ucla.edu>
Makefile.in,doc/Makefile.in
- uninstall: make sure the bash-specific directories created by
`make install' are emptied and removed
11/27
-----
doc/bash.1,doc/bashref.texi
lib/readline/doc/readline.3,lib/readline/doc/history.3
lib/readline/doc/rluser.texi,lib/readline/doc/rltech.texi
- another set of updates for formatting consistency, language
consistency between man pages and info files
12/1
----
lib/readline/misc.c
- rl_get_previous_history: call _rl_maybe_replace_line with arg of 1
so it clears rl_undo_list, since this may not immediately replace
rl_undo_list with something from history
Report from Grisha Levit <grishalevit@gmail.com>
12/5
----
doc/bash.1,doc/bashref.texi
lib/readline/doc/rluser.texi
- updates for active voice, future tense, formatting and fonts, edits
to Programmable Completion
Suggestions from G. Branden Robinson <g.branden.robinson@gmail.com>
12/10
-----
lib/readline/complete.c
- fnprint: make sure _rl_completion_prefix_display_length and
_rl_colored_completion_prefix are mutually exclusive, since the
callers assume they are.
bashline.c
- bash_default_completion: if we're trying to complete a glob pattern,
and rl_completion_type is '?', tell readline not to append a slash
if the pattern ends in one.
doc/bash.1,lib/readline/doc/readline.3,lib/readline/doc/rluser.texi
- completion-prefix-display-length: note that readline uses `___'
instead of an ellipsis if the filename begins with a period
All reported by Frederick Abell <fkabell3@hotmail.com>
doc/bash.1,doc/bashref.texi
- PIPESTATUS: enumerate the commands that set PIPESTATUS
From a report by Ulrich Müller <ulm@gentoo.org>
lib/readline/isearch.c
- _rl_isearch_init: change to call _rl_maybe_replace_line with arg
of 1 so rl_undo_list gets cleared (see change from 12/1)
Report from Grisha Levit <grishalevit@gmail.com>
12/13
-----
CHANGES,NEWS
- updated for bash-5.3-beta
12/15
-----
lib/readline/histexpand.c
- get_history_event: make sure we don't change history_offset whether
the search succeeds or fails, don't set it to history_length.
Callers don't expect to have the history offset changed out from
under them.
Fixes bug reported by Grisha Levit <grishalevit@gmail.com>
12/16
-----
lib/readline/util.c
- _rl_abort_internal: make sure to clear _rl_command_to_execute
Report and patch from Grisha Levit <grishalevit@gmail.com>
tests/printf7.sub,tests/cond-regexp2.sub
- accommodate different error messages across different systems
1/2/2025
--------
tests/run-all, tests/run-minimal
- BASHOPTS: unset or unexport as appropriate, same as SHELLOPTS
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
1/9
---
subst.c
- string_extract_verbatim: take into account the fact that CTLESC can
quote multibyte characters; use ADVANCE_CHAR instead of increment
Fixes bug reported by jktseug@gmail.com
1/10
----
expr.c
- expr_bind_variable,expr_streval: suppress additional expansion if
called by the `let' builtin, whether or not array_expand_once is set
- expr_skipsubscript: suppress expansion while parsing subscripts
whether array_expand_once is set or not
Still have to change tests if this goes final
These are all conditional on shell_compatibility_level > 51
From a bug-bash post by Greg Wooledge <greg@wooledge.org>
1/14
----
lib/readline/complete.c
- _rl_export_completions: use print_filename instead of fprintf to
display the possible completions so slashes and file types can
be included
From a patch from Matthew Tromp <matthewktromp@gmail.com>
1/15
----
examples/loadables/fltexpr.c
- fltexpr: new loadable builtin to do floating-point arithmetic
expression evaluation and optionally print the result
1/16
----
builtins/printf.def
- getarg(), advancearg(): cosmetic changes to make it easier to
implement %N$ format specifiers in the future
1/18
----
subst.c
- array_length_reference: requesting the length of an element of an
unset variable using array syntax is a fatal error when `set -u'
is enabled and the subscript is not `@' or `*'.
Inspired by a report from Ian Kelling <iank@fsf.org>
1/20
----
parse.y
- decode_prompt_string: since Debian has made the spectaculary bad call
to allow arbitrary characters in usernames, protect the results of
the \u expansion in the same way as \[Ww] and \[Hh] (externally-
controlled data)
From https://savannah.gnu.org/patch/?10496
1/21
----
eval.c
- reader_loop: if we longjmp with ERREXIT, don't reset any local
function contexts in posix mode, since POSIX says to exit as if
executing the `exit builtin with no arguments'. Revision of change
from 7/2022.
From a report by Ivan Shapovalov <intelfx@intelfx.name> in 11/2024
lib/readline/display.c
- rl_redisplay: after calling update_line, when putting the cursor
where it needs to be and reprinting part of the line with the
prompt that contains invisible characters, make sure we start to
output characters at the portion in the prompt buffer that begins
on the current line and only offset by the number of invisible
characters on the current line, and set _rl_last_c_pos accordingly
in both multibyte and singlebyte locales.
Fixes bug reported by Andreas Schwab <schwab@linux-m68k.org>
1/22
----
execute_cmd.c
- execute_builtin_or_function: if we're executing the exec builtin,
and there are redirections, let exec_builtin handle disposing of
redirection_undo_list if there is no program name to execute, so
it's still there if exec returns and doesn't exit the shell.
Then we can manage disposing of exec_redirection_undo_list and
letting the redirections be undone as normal.
This is POSIX interp 1896, with modifications from
https://www.austingroupbugs.net/view.php?id=1896#c7037
builtins/exec.def
- exec_builtin: dispose of redirection_undo_list and set it to NULL
if there is no program name operand; let execute_builtin_or_function
clean it up
1/23
----
lib/readline/terminal.c
- _rl_tcgetwinsize,_rl_tcsetwinsize: function wrappers for tcgetwinsize/
tcsetwinsize with fallbacks to ioctl if those functions aren't
available
- _rl_get_screensize: use _rl_tcgetwinsize
lib/readline/rlwinsize.h
- _rl_tcgetwinsize,_rl_tcsetwinsize: extern function declarations
lib/readine/rltty.c
- set_winsize: use _rl_tcgetwinsize/_rl_tcsetwinsize
- set_winsize: if _rl_tcgetwinsize succeeds, use the values to set
readline's idea of the screen size via _rl_set_screen_size
Inspired by a discussion with Olav Mørkrid <omega@funker.no>
1/24
----
lib/readline/signals.c
- _rl_handling_signal: new private variable, set to the signal we're
currently handling in _rl_signal_handler (SIGWINCH) or
_rl_handle_signal (all others). Only valid if RL_STATE_SIGHANDLER
is set
lib/readline/rlprivate.h
- _rl_handling_signal: new extern declaration
lib/readline/rltty.c
- set_winsize: only set readline's idea of the screen size if we're
executing in a signal handler context and handling SIGTSTP and the
application has indicated that it doesn't want the environment
variables LINES and COLUMNS to have priority (rl_prefer_env_winsize)
1/30
----
jobs.c
- wait_for_single_pid: if wait_for returns -1/ECHILD, make sure to
return 257 just as if the child was not found, optionally printing
an error message if JWAIT_PERROR is supplied
From a discussion with Ian <saturns_rings@protonmail.com>
2/8
---
redir.c
- do_redirection_internal: keep track of whether the redirector fd
was active with a new variable. Not used yet, should be optimized
out.
- add_undo_fd_redirect: new undo function using r_move_input so we
don't need a dup redir and a separate close redir to undo. Not
used yet
- do_redirection_internal: only call check_bash_input if we're
creating an undo list and not running one
command.h
- OUTPUT_REDIRECT: add r_output_force
input.c
- check_bash_input: if we dup the bash input fd to another in
save_bash_input, return that fd. Continue to return -1 on error
and 0 if we don't do anything but sync
execute_cmd.c
- execute_null_command: force a subshell if any of the redirections
involve the bash input buffered fd.
From a report by Martin D Kealey <martin@kurahaupo.gen.nz>
2/10
----
examples/loadables/chmod.c
- chmod: new loadable builtin, inspired by zhixu.liu@gmail.com in
https://savannah.gnu.org/patch/?10499
2/11
----
builtins/kill.def
- kill_builtin: in posix mode, return a failure status if any of the
pid/job arguments are not found or sending the signal fails. This
is consistent with
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/kill.html#tag_20_64_14
2/12
----
braces.c
- brace_gobbler: take a new argument in which to return the type of
brace expansion (comma or sequence) we think we've found; change
all callers
- brace_expand: even if we find a BRACE_ARG_SEPARATOR, don't try to
perform expansion if brace_gobbler doesn't think we have a
BRACE_COMMA expansion
- valid_seqterm: new function, performs minimal validation on a
sequence expansion, used to skip over invalid sequence expressions
in brace_expand
- brace_expand: call valid_seqterm if brace_gobbler finds a BRACE_SEQ
expansion
Inspired by report from Robert Elz <kre@munnari.oz.au>
2/13
----
doc/bash.1,doc/bashref.texi
- clarified the handling of double quotes in EXPRESSION in
(( EXPRESSION )) and $(( EXPRESSION )) to say that only unescaped
double quotes are removed
expr.c
- expr_bind_variable,expr_streval: revert change from 1/10 that
suppresses additional expansion when called by the `let' builtin,
tag for possible inclusion in a future release when I can look
at parallel changes to ((...)) and $((...)) (and probably
declare 'a[" "]=12' or similar)
2/14
----
lib/sh/zmapfd.c,externs.h
- zmapfd: now returns ssize_t in case of large files when size_t is
larger than int
builtins/evalfile.c,builtins/help.def
- zmapfd: changed callers
print_cmd.c
- print_redirection: the default file descriptor for <> is 0
Report and fix from Emanuele Torre <torreemanuele6@gmail.com>
2/18
----
configure.ac
- check for d_type member of struct dirent for future use
2/24
----
doc/bash.1,doc/bashref.texi
- document the word expansions performed on indexed array subscripts
and assoc array keys
- document the possibility and effect of empty strings on arithmetic
evaluation for substring expansion, arithmetic expansion, operands
to the the [[ command's arithmetic operators, the expression in
the (( compound command, and indexed array subscripts
2/24
----
execute_cmd.c
- execute_command_internal: if executing a (...) subshell, make sure
to update BASH_COMMAND before exiting on an error return from the
subshell with -e set
Report from Max Bowsher <maxbowsher@gmail.com>
3/3
---
redir.c
- here_document_to_fd: if we are trying to use a pipe for a here
document, but the F_GETPIPE_SZ fcntl returns a value shorter than
the here document length, make sure to close the pipe file descriptors
builtins/ulimit.def
- pipesize: use pathconf and _PC_PIPE_BUF if available
3/8
---
braces.c
- brace_expand: make sure to call valid_seqterm with the right length
so that text[tlen] == '}'
3/10
----
builtins/help.def
- show_manpage: if the first line of long_doc doesn't contain a
newline, e.g., if it's a loadable builtin, add one so there's the
usual space between NAME and SYNOPSIS
m4/codeset.m4
- define HAVE_NL_LANGINFO
lib/sh/strftime.c
- updates for locale-awareness
3/14
----
lib/termcap/termcap.c,lib/termcap/tparam.c
- updates for ISO C
3/17
----
configure.ac
- update release to rc1, update CHANGES and NEWS
3/19
----
lib/readline/rlmbutil.h
- _rl_wcwidth: make sure wchar_t constants have an `L' prefix
3/24
----
subst.c
- function_substitute: set temporary_env to NULL (we've already
set up an unwind-protect for it) before pushing the context, so
pop_context doesn't free it out from underneath the caller.
Report from Emanuele Torre <torreemanuele6@gmail.com>
3/27
----
shell.c
- set_bash_input: if the call to with_input_from_buffered_stream does
not result in a valid buffer corresponding to the file descriptor,
print an error message and set last_command_exit_value
From a report in https://savannah.gnu.org/patch/?10512
4/3
---
lib/sh/gettimeofday.c
- updated from version in gnulib
[bash-5.3-rc1 frozen]
4/4
---
examples/loadables/fltexpr.c
- add support for function calls; support almost all math function
calls in math.h
- add support for pi, gamma, e mathematical constants
4/7
---
doc/bash.1,doc/bashref.texi
- HISTFILESIZE: note that the history file will contain complete
history entries whose lines may total slightly more than
$HISTFILESIZE if the entries contain multiple lines
From a report from Jens Schmidt <farblos@vodafonemail.de>
- export: note that you can use -f with -p to display exported functions
From a report from Duncan Roe <duncan_roe@optusnet.com.au>
builtins/history.def
- add history -d start-end to the long doc
From a report from Duncan Roe <duncan_roe@optusnet.com.au>
4/9
---
lib/readline/histfile.c
- read_history_range: changes to not skip blank lines if we are
reading a history file with multiline history entries.
From a report by Jens Schmidt <farblos@vodafonemail.de>
4/11
----
bashline.c
- attempt_shell_completion: move the check for char_is_quoted from
check_redir to the caller, set in_command_position to 0 if the
command separator is quoted
From https://savannah.gnu.org/support/?111224 david@mandelberg.org
- check_extglob: break check for extended glob out into separate
function, call from attempted_shell_completion, set in_command_position
to -1 if it returns 1, as with the old call to check_redir
4/21
----
builtins/read.def
- read_mbchar: if we read a delimiter character that makes an
incomplete multibyte character into an invalid multibyte character,
only push the delimiter back if we read that character ourselves
(i > 1).
Report from Greg Wooledge <greg@wooledge.org>
4/23
----
parse.y
- pop_delimiter: only decrement delimiter_depth if it's > 0, since
reset_parser() may have set it to 0 after the matching call to
push_delimiter
Report from Grisha Levit <grishalevit@gmail.com> based on a report
from ÐлекÑандр Ушаков <aushakov@astralinux.ru>
4/25
----
parse.y
- read_a_line: if the shell is interactive, and not reading from a
string, check whether a previous call to shell_getc has set
EOF_Reached and return EOF in this case, after resetting the
current token to '\n'. This makes EOFs that are not the first
character on the line `sticky' instead of just token delimiters.
From https://savannah.gnu.org/bugs/?67045
- history_delimiting_chars: if it looks like we just finished a
subshell, and the line we're adding begins with an operator that
can't follow a semicolon, return a newline
From https://savannah.gnu.org/patch/?10517
4/28
----
parse.y
- parse_arith_command: if the character after the first right paren
isn't a right paren, making the construct a nested subshell, push
that character back and return the subshell command as the current
token string, which we push onto the pushed string list. Reading
one character more can cause synchronization problems with backslash
newline, among other things.
From https://savannah.gnu.org/patch/?10517
4/29
----
builtins/evalstring.c
- parse_string: only run the top-level unwind-protects if we're
actually going to be calling jump_to_top_level(); otherwise let
xparse_dolparen take care of it
From a report by ÐлекÑандр Ушаков <aushakov@astralinux.ru>
5/1
---
lib/sh/zread.c
- zungetc: rework to use a local 16-byte buffer so we can push back
multiple characters whether we use read or zread
- zread/zreadretry/zreadintr/zreadc/zreadcintr/zreadn: changed to use
zpopbuf to check whether we have pushed back bytes
- zreset,zsyncfd: reset the pushback buffer indices
builtins/read.def
- read_mbchar: handle the delimiter being part of an invalid multibyte
character, not just the byte that makes the multibyte character
invalid: keep track of where the delimiter char is in the buffer and
use zungetc to push back that character and everything we read
after it so subsequent buffered (zread) or unbuffered (read) reads
will return them
5/2
---
lib/readline/display.c,lib/readline/histexpand.c,lib/readline/history.c,
lib/readline/input.c,lib/readline/search.c,lib/readline/shell.c,
lib/readline/util.c,lib/readline/readline.c,lib/readline/histfile.c
- fixes for issues (unused variables, etc.) uncovered by static
analysis
All from a report by Siteshwar Vashisht <svashisht@redhat.com>
5/16
----
lib/readline/terminal.c
- NEED_EXTERN_PC: add __gnu_hurd__ to the systems that require this
if not using ncurses; rework the structure of the defines
Report from Collin Funk <collin.funk1@gmail.com>
braces.c
- brace_gobbler: don't mark an expression as BRACE_SEQ if we've
already seen a comma and marked it as BRACE_COMMA, so we treat
it as a comma brace expansion.
From a report by Sam James <sam@gentoo.org>
support/install-sh
- new version from coreutils-git (2024-12-03.03); renamed from install.sh
aclocal.m4
- AM_PROG_INSTALL_SH, AM_PROG_INSTALL_STRIP: added from automake
configure.ac
- call AM_PROG_INSTALL_SH, AM_PROG_INSTALL_STRIP
Makefile.in
- STRIP: let configure substitute it from AC_CHECK_TOOL result
- INSTALL_STRIP_PROGRAM: let configure substitute it from
AM_PROG_INSTALL_STRIP
- install-strip: change to set INSTALL_PROGRAM=${INSTALL_STRIP_PROGRAM}
to avoid hard-coding `-s' in the recipe
All from a report by NR <nroycea+gnu@gmail.com>
5/18
----
subst.c
- param_expand: if we expand a nameref that references an unset array
variable reference, make sure we enforce `nounset', with the usual
exceptions for `@' and `*' subscripts
From a report from Emanuele Torre <torreemanuele6@gmail.com>
5/22
----
buildconf.h.in
- add additional defines for conservative ISO C/POSIX environment
- add HAVE_C_BOOL define in case someone cross-compiles with a C23
compiler
From a report by Bruce Dubbs <bdubbs@linuxfromscratch.org>
builtins/mkbuiltins.c
- include buildconf.h instead of having separate defines when
cross-compiling