commit bash-20210115 snapshot

This commit is contained in:
Chet Ramey
2021-01-19 17:12:43 -05:00
parent a9cf0031ef
commit 3aec0ec30f
11 changed files with 187 additions and 24 deletions
+36
View File
@@ -9341,3 +9341,39 @@ findcmd.c
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
View File
@@ -1215,6 +1215,7 @@ tests/nameref19.sub f
tests/nameref20.sub f
tests/nameref21.sub f
tests/nameref22.sub f
tests/nameref23.sub f
tests/nameref.right f
tests/new-exp.tests f
tests/new-exp1.sub f
+1 -1
View File
@@ -746,7 +746,7 @@ ${DEFDIR}/bashgetopt.o: $(BUILTIN_SRCDIR)/bashgetopt.c
${DEFDIR}/builtext.h: $(BUILTIN_DEFS)
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) builtext.h ) || exit 1
${DEFDIR}/pipesize.h:
${DEFDIR}/pipesize.h: ${BUILTINS_LIBRARY}
@(cd $(DEFDIR) && $(MAKE) $(MFLAGS) pipesize.h ) || exit 1
$(SDIR)/man2html$(EXEEXT): ${SUPPORT_SRC}/man2html.c
+8 -7
View File
@@ -1234,7 +1234,7 @@ parser_if (char *args)
#endif /* VI_MODE */
else if (_rl_strnicmp (args, "version", 7) == 0)
{
int rlversion, versionarg, op, previ, major, minor;
int rlversion, versionarg, op, previ, major, minor, opresult;
_rl_parsing_conditionalized_out = 1;
rlversion = RL_VERSION_MAJOR*10 + RL_VERSION_MINOR;
@@ -1294,24 +1294,25 @@ parser_if (char *args)
switch (op)
{
case OP_EQ:
_rl_parsing_conditionalized_out = rlversion == versionarg;
opresult = rlversion == versionarg;
break;
case OP_NE:
_rl_parsing_conditionalized_out = rlversion != versionarg;
opresult = rlversion != versionarg;
break;
case OP_GT:
_rl_parsing_conditionalized_out = rlversion > versionarg;
opresult = rlversion > versionarg;
break;
case OP_GE:
_rl_parsing_conditionalized_out = rlversion >= versionarg;
opresult = rlversion >= versionarg;
break;
case OP_LT:
_rl_parsing_conditionalized_out = rlversion < versionarg;
opresult = rlversion < versionarg;
break;
case OP_LE:
_rl_parsing_conditionalized_out = rlversion <= versionarg;
opresult = rlversion <= versionarg;
break;
}
_rl_parsing_conditionalized_out = 1 - opresult;
}
/* Check to see if the first word in ARGS is the same as the
value stored in rl_readline_name. */
+1 -3
View File
@@ -664,15 +664,13 @@ set_saved_history ()
}
int
rl_operate_and_get_next (count, c)
int count, c;
rl_operate_and_get_next (int count, int c)
{
/* Accept the current line. */
rl_newline (1, c);
saved_history_logical_offset = rl_explicit_arg ? count : where_history () + history_base + 1;
_rl_saved_internal_startup_hook = _rl_internal_startup_hook;
_rl_internal_startup_hook = set_saved_history;
+18 -10
View File
@@ -91,6 +91,8 @@ extern void _rl_parse_colors PARAMS((void)); /* XXX */
static char *readline_internal PARAMS((void));
static void readline_initialize_everything PARAMS((void));
static void run_startup_hooks PARAMS((void));
static void bind_arrow_keys_internal PARAMS((Keymap));
static void bind_arrow_keys PARAMS((void));
@@ -403,6 +405,16 @@ readline (const char *prompt)
return (value);
}
static void
run_startup_hooks (void)
{
if (rl_startup_hook)
(*rl_startup_hook) ();
if (_rl_internal_startup_hook)
(*_rl_internal_startup_hook) ();
}
#if defined (READLINE_CALLBACKS)
# define STATIC_CALLBACK
#else
@@ -422,11 +434,7 @@ readline_internal_setup (void)
if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED))
_rl_enable_meta_key ();
if (rl_startup_hook)
(*rl_startup_hook) ();
if (_rl_internal_startup_hook)
(*_rl_internal_startup_hook) ();
run_startup_hooks ();
rl_deactivate_mark ();
@@ -511,6 +519,11 @@ readline_internal_teardown (int eof)
void
_rl_internal_char_cleanup (void)
{
if (_rl_keep_mark_active)
_rl_keep_mark_active = 0;
else if (rl_mark_active_p ())
rl_deactivate_mark ();
#if defined (VI_MODE)
/* In vi mode, when you exit insert mode, the cursor moves back
over the previous character. We explicitly check for that here. */
@@ -668,11 +681,6 @@ readline_internal_charloop (void)
if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
_rl_last_command_was_kill = 0;
if (_rl_keep_mark_active)
_rl_keep_mark_active = 0;
else if (rl_mark_active_p ())
rl_deactivate_mark ();
_rl_internal_char_cleanup ();
#if defined (READLINE_CALLBACKS)
+7 -1
View File
@@ -68,6 +68,11 @@ extern int errno;
extern int shell_tty;
#if defined (READLINE)
/* Let's not call readline, forcing readline to initialize the termcap/terminfo
variables it needs, unless we have to. */
extern int interactive_shell;
extern int no_line_editing;
extern int bash_readline_initialized;
extern void rl_set_screen_size PARAMS((int, int));
#endif
extern void sh_set_lines_and_columns PARAMS((int, int));
@@ -87,7 +92,8 @@ get_new_window_size (from_sig, rp, cp)
{
sh_set_lines_and_columns (win.ws_row, win.ws_col);
#if defined (READLINE)
rl_set_screen_size (win.ws_row, win.ws_col);
if ((interactive_shell && no_line_editing == 0) || bash_readline_initialized)
rl_set_screen_size (win.ws_row, win.ws_col);
#endif
if (rp)
*rp = win.ws_row;
+1 -1
View File
@@ -77,7 +77,7 @@ OBJ1 = man2html.o
all: man2html$(EXEEXT)
man2html$(EXEEXT): $(OBJ1)
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS_FOR_BUILD}
$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS_FOR_BUILD}
clean:
$(RM) man2html$(EXEEXT) $(OBJ1)
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/chet/bash/bash-current
BUILD_DIR=/usr/local/build/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
+31
View File
@@ -510,3 +510,34 @@ declare -a array
declare -ai array=([0]="one")
declare -a array=([0]="zero")
declare -a array=([0]="one" [1]="two" [2]="three")
declare -ai a=([0]="5")
declare -ai a=([0]="6")
declare -ai a=([0]="1")
./nameref23.sub: line 15: declare: b: not found
declare -ai a=([0]="1")
declare -- b="1"
declare -ai a=([0]="1")
declare -- b="11"
declare -ai a=([0]="1")
declare -- b="110"
./nameref23.sub: line 25: declare: `1': invalid variable name for name reference
declare -ai a=([0]="1")
./nameref23.sub: line 27: declare: b: not found
declare -ai a=([0]="4")
declare -in b="a[0]"
declare -ai a=([0]="6")
declare -in b="a[0]"
foo
foo bar
declare -a a=([0]="" [1]="foo bar")
declare -n b="a[1]"
foo
foo bar
declare -a a=([0]="" [1]="foo bar")
declare -n b="a[1]"
12
16
declare -ai a=([0]="0" [1]="16")
12
16
declare -ai a=([0]="0" [1]="16")
+82
View File
@@ -0,0 +1,82 @@
declare -ai a
a[0]=4
declare -n b='a[0]'
b+=1 ; declare -p a
declare b+=1 ; declare -p a
unset a b
unset -n b
######
declare -ai a=(1)
declare -in b="a[0]"
declare -p a b
b+=1 ; declare -p a b
b+=1 ; declare -p a b
b+=0 ; declare -p a b
unset a b
#####
declare -ai a=(1)
declare -n b="1"
declare -p a
declare -np b
unset a ; unset -n b
#####
declare -ai a=('4');
declare -n b='a[0]';
declare -ni b; # this should maybe not be allowed, but it is for now
declare -p a b
b+=2;
declare -p a b
unset a ; unset -n b
#####
f()
{
local -a a=('' 'foo');
local -n b=a[1];
echo $b;
b+=\ bar;
echo $b;
declare -p a b;
}
f
declare -a a=('' 'foo');
declare -n b=a[1];
echo $b;
b+=\ bar;
echo $b;
declare -p a b
unset a ; unset -n b
unset -f f
f()
{
local -ai a=(0 12);
local -n b=a[1];
echo $b;
b+=4;
echo $b;
declare -p a;
}
f
declare -ai a=(0 12);
declare -n b=a[1];
echo $b;
b+=4;
echo $b;
declare -p a
unset a ; unset -n b