mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-02 09:50:50 +02:00
commit bash-20161206 snapshot
This commit is contained in:
@@ -12630,3 +12630,34 @@ parse.y
|
||||
subst.c
|
||||
- parameter_brace_expand_indir: clean up checks for unset variables to
|
||||
minimize incompatibilities with previous versions
|
||||
|
||||
12/5
|
||||
----
|
||||
lib/readline/history.c
|
||||
- add_history: don't update history_length until all of the updates to
|
||||
the_history are complete, so history_length is always consistent.
|
||||
Report and fix from Hong Cho <hong.cho@citrix.com>
|
||||
|
||||
bashline.c
|
||||
- bash_backward_shellword: fix to work better at the end of the line,
|
||||
with multiple trailing whitespace characters. Inspired by report
|
||||
from Kirill Timofeev <kt97679@gmail.com>
|
||||
|
||||
Makefile.in
|
||||
- bashbug: use `^' as the sed delimiter instead of `%'; some compilers
|
||||
use `%' in CFLAGS. Report from Vladimir Marek
|
||||
<Vladimir.Marek@oracle.com>
|
||||
|
||||
12/6
|
||||
----
|
||||
test.c
|
||||
- test_unop: make sure op[1] != 0 before testing op[2]
|
||||
- term: make sure argv[pos][1] != 0 before testing argv[pos][2]. Fixes
|
||||
oob-read reported by Jerzy Kramarz <op7ica@gmail.com>
|
||||
|
||||
12/7
|
||||
----
|
||||
lib/glob/glob.c
|
||||
- glob_filename: assign the return value of realloc (results, ...) to
|
||||
a temp pointer, so if realloc returns NULL, we make sure we free
|
||||
results. Report from Kirill Timofeev <kt97679@gmail.com>
|
||||
|
||||
+3
-6
@@ -584,12 +584,9 @@ $(Program): .build $(OBJECTS) $(BUILTINS_DEP) $(LIBDEP)
|
||||
@echo " ***********************************************************"
|
||||
@echo
|
||||
|
||||
bashbug: $(SUPPORT_SRC)bashbug.sh config.h Makefile $(VERSPROG)
|
||||
@sed -e "s%!MACHINE!%$(Machine)%" -e "s%!OS!%$(OS)%" \
|
||||
-e "s%!CFLAGS!%$(CCFLAGS)%" -e "s%!CC!%$(CC)%" \
|
||||
-e "s%!RELEASE!%$(Version)%" -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
|
||||
-e "s%!MACHTYPE!%$(MACHTYPE)%" -e "s%!RELSTATUS!%$(RELSTATUS)%" \
|
||||
$(SUPPORT_SRC)bashbug.sh > $@
|
||||
bashbug: $(SDIR)/bashbug.sh config.h Makefile $(VERSPROG)
|
||||
@sed -e "s%!PATCHLEVEL!%$(PatchLevel)%" \
|
||||
$(SDIR)/bashbug.sh > $@
|
||||
@chmod a+rx bashbug
|
||||
|
||||
strip: $(Program) .made
|
||||
|
||||
+8
-5
@@ -1173,7 +1173,10 @@ bash_backward_shellword (count, key)
|
||||
|
||||
p = rl_point;
|
||||
slen = rl_end;
|
||||
|
||||
|
||||
if (p == rl_end && p > 0)
|
||||
p--;
|
||||
|
||||
while (count)
|
||||
{
|
||||
if (p == 0)
|
||||
@@ -1186,9 +1189,9 @@ bash_backward_shellword (count, key)
|
||||
while (p > 0)
|
||||
{
|
||||
c = rl_line_buffer[p];
|
||||
if (WORDDELIM (c) && char_is_quoted (rl_line_buffer, p) == 0)
|
||||
BACKUP_CHAR (rl_line_buffer, slen, p);
|
||||
break;
|
||||
if (WORDDELIM (c) == 0 || char_is_quoted (rl_line_buffer, p))
|
||||
break;
|
||||
BACKUP_CHAR (rl_line_buffer, slen, p);
|
||||
}
|
||||
|
||||
if (p == 0)
|
||||
@@ -1639,7 +1642,7 @@ bash_default_completion (text, start, end, qc, compflags)
|
||||
matches = (char **)NULL;
|
||||
|
||||
/* New posix-style command substitution or variable name? */
|
||||
if (!matches && *text == '$')
|
||||
if (*text == '$')
|
||||
{
|
||||
if (qc != '\'' && text[1] == '(') /* ) */
|
||||
matches = rl_completion_matches (text, command_subst_completion_function);
|
||||
|
||||
@@ -101,6 +101,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
|
||||
#define W_ASSNGLOBAL 0x2000000 /* word is a global assignment to declare (declare/typeset -g) */
|
||||
#define W_NOBRACE 0x4000000 /* Don't perform brace expansion */
|
||||
#define W_COMPLETE 0x8000000 /* word is being expanded for completion */
|
||||
#define W_CHKLOCAL 0x10000000 /* check for local vars on assignment */
|
||||
|
||||
/* Flags for the `pflags' argument to param_expand() and various
|
||||
parameter_brace_expand_xxx functions; also used for string_list_dollar_at */
|
||||
|
||||
@@ -16288,7 +16288,7 @@ fi
|
||||
#AC_SUBST(ALLOCA_SOURCE)
|
||||
#AC_SUBST(ALLOCA_OBJECT)
|
||||
|
||||
ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in examples/loadables/Makefile examples/loadables/Makefile.inc examples/loadables/perl/Makefile support/bash.pc"
|
||||
ac_config_files="$ac_config_files Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile lib/intl/Makefile lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in examples/loadables/Makefile examples/loadables/Makefile.inc examples/loadables/perl/Makefile support/bash.pc support/bashbug.sh"
|
||||
|
||||
ac_config_commands="$ac_config_commands default"
|
||||
|
||||
@@ -17016,6 +17016,7 @@ do
|
||||
"examples/loadables/Makefile.inc") CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile.inc" ;;
|
||||
"examples/loadables/perl/Makefile") CONFIG_FILES="$CONFIG_FILES examples/loadables/perl/Makefile" ;;
|
||||
"support/bash.pc") CONFIG_FILES="$CONFIG_FILES support/bash.pc" ;;
|
||||
"support/bashbug.sh") CONFIG_FILES="$CONFIG_FILES support/bashbug.sh" ;;
|
||||
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
|
||||
|
||||
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||
|
||||
+1
-1
@@ -1237,7 +1237,7 @@ AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
|
||||
lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
|
||||
examples/loadables/Makefile examples/loadables/Makefile.inc \
|
||||
examples/loadables/perl/Makefile \
|
||||
support/bash.pc],
|
||||
support/bash.pc support/bashbug.sh],
|
||||
[
|
||||
# Makefile uses this timestamp file to record whether config.h is up to date.
|
||||
echo timestamp > stamp-h
|
||||
|
||||
@@ -3710,6 +3710,12 @@ Matches one of the given patterns
|
||||
Matches anything except one of the given patterns
|
||||
.RE
|
||||
.PD
|
||||
.PP
|
||||
Complicated extended pattern matching against long strings is slow,
|
||||
especially when the patterns contain alternations and the strings
|
||||
contain multiple matches.
|
||||
Using separate matches against shorter strings, or using arrays of
|
||||
strings instead of a single long string, may be faster.
|
||||
.SS Quote Removal
|
||||
.PP
|
||||
After the preceding expansions, all unquoted occurrences of the
|
||||
|
||||
@@ -2536,6 +2536,12 @@ Matches one of the given patterns.
|
||||
Matches anything except one of the given patterns.
|
||||
@end table
|
||||
|
||||
Complicated extended pattern matching against long strings is slow,
|
||||
especially when the patterns contain alternations and the strings
|
||||
contain multiple matches.
|
||||
Using separate matches against shorter strings, or using arrays of
|
||||
strings instead of a single long string, may be faster.
|
||||
|
||||
@node Quote Removal
|
||||
@subsection Quote Removal
|
||||
|
||||
|
||||
+6
-6
@@ -2225,7 +2225,7 @@ coproc_setvars (cp)
|
||||
|
||||
t = itos (cp->c_wfd);
|
||||
ind = 1;
|
||||
bind_array_variable (cp->c_name, ind, t, 0);
|
||||
v = bind_array_variable (cp->c_name, ind, t, 0);
|
||||
free (t);
|
||||
#else
|
||||
sprintf (namevar, "%s_READ", cp->c_name);
|
||||
@@ -2240,7 +2240,7 @@ coproc_setvars (cp)
|
||||
|
||||
sprintf (namevar, "%s_PID", cp->c_name);
|
||||
t = itos (cp->c_pid);
|
||||
bind_variable (namevar, t, 0);
|
||||
v = bind_variable (namevar, t, 0);
|
||||
free (t);
|
||||
|
||||
free (namevar);
|
||||
@@ -3798,7 +3798,6 @@ execute_cond_command (cond_command)
|
||||
{
|
||||
int retval, save_line_number;
|
||||
|
||||
retval = EXECUTION_SUCCESS;
|
||||
save_line_number = line_number;
|
||||
|
||||
this_command_name = "[[";
|
||||
@@ -3981,9 +3980,10 @@ fix_assignment_words (words)
|
||||
|
||||
/* If we have an assignment builtin that does not create local variables,
|
||||
make sure we create global variables even if we internally call
|
||||
`declare' */
|
||||
`declare'. The CHKLOCAL flag means to set attributes or values on
|
||||
an existing local variable */
|
||||
if (b && ((b->flags & (ASSIGNMENT_BUILTIN|LOCALVAR_BUILTIN)) == ASSIGNMENT_BUILTIN))
|
||||
w->word->flags |= W_ASSNGLOBAL;
|
||||
w->word->flags |= W_ASSNGLOBAL|W_CHKLOCAL;
|
||||
}
|
||||
#if defined (ARRAY_VARS)
|
||||
/* Note that we saw an associative array option to a builtin that takes
|
||||
@@ -4086,7 +4086,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||
last_command_subst_pid = NO_PID;
|
||||
old_last_async_pid = last_asynchronous_pid;
|
||||
|
||||
already_forked = dofork = 0;
|
||||
already_forked = 0;
|
||||
|
||||
/* If we're in a pipeline or run in the background, set DOFORK so we
|
||||
make the child early, before word expansion. This keeps assignment
|
||||
|
||||
+4
-4
@@ -1018,7 +1018,7 @@ glob_filename (pathname, flags)
|
||||
char *pathname;
|
||||
int flags;
|
||||
{
|
||||
char **result;
|
||||
char **result, **new_result;
|
||||
unsigned int result_size;
|
||||
char *directory_name, *filename, *dname, *fn;
|
||||
unsigned int directory_len;
|
||||
@@ -1248,16 +1248,16 @@ glob_filename (pathname, flags)
|
||||
while (array[l] != NULL)
|
||||
++l;
|
||||
|
||||
result =
|
||||
(char **)realloc (result, (result_size + l) * sizeof (char *));
|
||||
new_result = (char **)realloc (result, (result_size + l) * sizeof (char *));
|
||||
|
||||
if (result == NULL)
|
||||
if (new_result == NULL)
|
||||
{
|
||||
for (l = 0; array[l]; ++l)
|
||||
free (array[l]);
|
||||
free ((char *)array);
|
||||
goto memory_error;
|
||||
}
|
||||
result = new_result;
|
||||
|
||||
for (l = 0; array[l] != NULL; ++l)
|
||||
result[result_size++ - 1] = array[l];
|
||||
|
||||
@@ -279,6 +279,7 @@ add_history (string)
|
||||
const char *string;
|
||||
{
|
||||
HIST_ENTRY *temp;
|
||||
int new_length;
|
||||
|
||||
if (history_stifled && (history_length == history_max_entries))
|
||||
{
|
||||
@@ -295,13 +296,9 @@ add_history (string)
|
||||
|
||||
/* Copy the rest of the entries, moving down one slot. Copy includes
|
||||
trailing NULL. */
|
||||
#if 0
|
||||
for (i = 0; i < history_length; i++)
|
||||
the_history[i] = the_history[i + 1];
|
||||
#else
|
||||
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
|
||||
#endif
|
||||
|
||||
new_length = history_length;
|
||||
history_base++;
|
||||
}
|
||||
else
|
||||
@@ -315,7 +312,7 @@ add_history (string)
|
||||
else
|
||||
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
|
||||
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
|
||||
history_length = 1;
|
||||
new_length = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,14 +322,15 @@ add_history (string)
|
||||
the_history = (HIST_ENTRY **)
|
||||
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
|
||||
}
|
||||
history_length++;
|
||||
new_length = history_length + 1;
|
||||
}
|
||||
}
|
||||
|
||||
temp = alloc_history_entry ((char *)string, hist_inittime ());
|
||||
|
||||
the_history[history_length] = (HIST_ENTRY *)NULL;
|
||||
the_history[history_length - 1] = temp;
|
||||
the_history[new_length] = (HIST_ENTRY *)NULL;
|
||||
the_history[new_length - 1] = temp;
|
||||
history_length = new_length;
|
||||
}
|
||||
|
||||
/* Change the time stamp of the most recent history entry to STRING. */
|
||||
|
||||
@@ -518,6 +518,11 @@ dump_word_flags (flags)
|
||||
f &= ~W_COMPLETE;
|
||||
fprintf (stderr, "W_COMPLETE%s", f ? "|" : "");
|
||||
}
|
||||
if (f & W_CHKLOCAL)
|
||||
{
|
||||
f &= ~W_CHKLOCAL;
|
||||
fprintf (stderr, "W_CHKLOCAL%s", f ? "|" : "");
|
||||
}
|
||||
|
||||
fprintf (stderr, "\n");
|
||||
fflush (stderr);
|
||||
@@ -3054,7 +3059,7 @@ do_compound_assignment (name, value, flags)
|
||||
v = find_variable (name);
|
||||
if (v && ((readonly_p (v) && (flags & ASS_FORCE) == 0) || noassign_p (v)))
|
||||
{
|
||||
if (v && readonly_p (v))
|
||||
if (readonly_p (v))
|
||||
err_readonly (name);
|
||||
return (v); /* XXX */
|
||||
}
|
||||
@@ -3074,7 +3079,7 @@ do_compound_assignment (name, value, flags)
|
||||
v = find_global_variable (name);
|
||||
if (v && ((readonly_p (v) && (flags & ASS_FORCE) == 0) || noassign_p (v)))
|
||||
{
|
||||
if (v && readonly_p (v))
|
||||
if (readonly_p (v))
|
||||
err_readonly (name);
|
||||
return (v); /* XXX */
|
||||
}
|
||||
@@ -3097,7 +3102,7 @@ do_compound_assignment (name, value, flags)
|
||||
v = assign_array_from_string (name, value, flags);
|
||||
if (v && ((readonly_p (v) && (flags & ASS_FORCE) == 0) || noassign_p (v)))
|
||||
{
|
||||
if (v && readonly_p (v))
|
||||
if (readonly_p (v))
|
||||
err_readonly (name);
|
||||
return (v); /* XXX */
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ term ()
|
||||
value = binary_operator ();
|
||||
|
||||
/* Might be a switch type argument */
|
||||
else if (argv[pos][0] == '-' && argv[pos][2] == '\0')
|
||||
else if (argv[pos][0] == '-' && argv[pos][1] && argv[pos][2] == '\0')
|
||||
{
|
||||
if (test_unop (argv[pos]))
|
||||
value = unary_operator ();
|
||||
@@ -718,7 +718,7 @@ int
|
||||
test_unop (op)
|
||||
char *op;
|
||||
{
|
||||
if (op[0] != '-' || op[2] != 0)
|
||||
if (op[0] != '-' || (op[1] && op[2] != 0))
|
||||
return (0);
|
||||
|
||||
switch (op[1])
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ echo "$qpath"
|
||||
|
||||
# it's crazy that all three of these produce the same result
|
||||
printf "%s\n" ${qpath//\\/}
|
||||
printf "%s\n" ${qpath//"`echo \\`"/}
|
||||
printf "%s\n" ${qpath//`echo "\\\\\\\\"`/}
|
||||
printf "%s\n" ${qpath//"`printf '%s' \\`"/}
|
||||
printf "%s\n" ${qpath//`printf '%s' "\\\\\\\\"`/}
|
||||
|
||||
+3
-3
@@ -59,10 +59,10 @@ echo $?
|
||||
echo $?
|
||||
|
||||
# kill two birds with one test -- test out the BASH_ENV code
|
||||
echo echo this is bashenv > /tmp/bashenv
|
||||
export BASH_ENV=/tmp/bashenv
|
||||
echo echo this is bashenv > $TMPDIR/bashenv
|
||||
export BASH_ENV=$TMPDIR/bashenv
|
||||
${THIS_SH} ./exec3.sub
|
||||
rm -f /tmp/bashenv
|
||||
rm -f $TMPDIR/bashenv
|
||||
unset BASH_ENV
|
||||
|
||||
# we're resetting the $PATH to empty, so this should be last
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ declare -- var="x\001y\177z"$
|
||||
argv[1] = <$'x\001y\177z'>
|
||||
argv[1] = <x^Ay^?z>
|
||||
var=$'x\001y\177z'
|
||||
./exp8.sub: line 18: xyz: syntax error: invalid arithmetic operator (error token is "z")
|
||||
./exp8.sub: line 16: xyz: syntax error: invalid arithmetic operator (error token is "z")
|
||||
declare -a array=()
|
||||
declare -a array=([0]=$'x\001y\177z')
|
||||
argv[1] = <x^Ay^?z>
|
||||
|
||||
+2
-4
@@ -1,16 +1,14 @@
|
||||
# expansions involving patterns
|
||||
shopt -u xpg_echo
|
||||
|
||||
var='[hello'
|
||||
echo "${var//[/}"
|
||||
|
||||
red='\[\e[0;31m\]'
|
||||
echo "${red//\\[\\e/}"
|
||||
printf "%s\n" "${red//\\[\\e/}"
|
||||
|
||||
foo="${red//\\[\\e/}"
|
||||
|
||||
# foo == [0;31m\]
|
||||
echo "${foo//[0;31m\\/}"
|
||||
printf "%s\n" "${foo//[0;31m\\/}"
|
||||
|
||||
echo "${var//[]/}"
|
||||
echo "${red//[]/}"
|
||||
|
||||
+4
-6
@@ -1,5 +1,3 @@
|
||||
shopt -u xpg_echo
|
||||
|
||||
var=$'x\001y\177z'
|
||||
|
||||
recho "$var"
|
||||
@@ -12,11 +10,11 @@ declare -p var | sed -n l
|
||||
|
||||
recho ${var@Q}
|
||||
recho ${var@P}
|
||||
echo ${var@A}
|
||||
echo -E ${var@A}
|
||||
|
||||
unset array
|
||||
array=( [$'x\001y\177z']=foo ) # should be error
|
||||
echo ${array[@]@A}
|
||||
echo -E ${array[@]@A}
|
||||
|
||||
unset array
|
||||
declare -a array=([0]=$'x\001y\177z')
|
||||
@@ -25,9 +23,9 @@ declare -p array
|
||||
unset array
|
||||
array=( "$var" )
|
||||
recho ${array[@]}
|
||||
echo ${array[@]@A}
|
||||
echo -E ${array[@]@A}
|
||||
|
||||
unset array
|
||||
declare -A array
|
||||
array=( [$'x\001y\177z']=$'a\242b\002c' )
|
||||
echo ${array[@]@A}
|
||||
echo -E ${array[@]@A}
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
shopt -s extglob
|
||||
DIR=/tmp/extglob-$$
|
||||
DIR=$TMPDIR/extglob-$$
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
@@ -18,4 +18,3 @@ echo !(foo)*
|
||||
|
||||
cd $OLDPWD
|
||||
rm -rf $DIR
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ ${THIS_SH} ./glob2.sub
|
||||
|
||||
MYDIR=$PWD # save where we are
|
||||
|
||||
TESTDIR=/tmp/glob-test
|
||||
TESTDIR=$TMPDIR/glob-test-$$
|
||||
mkdir $TESTDIR
|
||||
builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
|
||||
rm -rf *
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ jkl mno
|
||||
fff is a function
|
||||
fff ()
|
||||
{
|
||||
ed /tmp/foo <<ENDOFINPUT > /dev/null
|
||||
ed ${TMPDIR}/foo <<ENDOFINPUT > /dev/null
|
||||
/^name/d
|
||||
w
|
||||
q
|
||||
@@ -31,7 +31,7 @@ ENDOFINPUT
|
||||
fff is a function
|
||||
fff ()
|
||||
{
|
||||
ed /tmp/foo <<ENDOFINPUT > /dev/null
|
||||
ed ${TMPDIR}/foo <<ENDOFINPUT > /dev/null
|
||||
/^name/d
|
||||
w
|
||||
q
|
||||
|
||||
+6
-6
@@ -59,22 +59,22 @@ cat <<- EOF
|
||||
EOF
|
||||
|
||||
# check appending of text to file from here document
|
||||
rm -f /tmp/bash-zzz
|
||||
cat > /tmp/bash-zzz << EOF
|
||||
rm -f ${TMPDIR}/bash-zzz
|
||||
cat > ${TMPDIR}/bash-zzz << EOF
|
||||
abc
|
||||
EOF
|
||||
cat >> /tmp/bash-zzz << EOF
|
||||
cat >> ${TMPDIR}/bash-zzz << EOF
|
||||
def ghi
|
||||
jkl mno
|
||||
EOF
|
||||
cat /tmp/bash-zzz
|
||||
rm -f /tmp/bash-zzz
|
||||
cat ${TMPDIR}/bash-zzz
|
||||
rm -f ${TMPDIR}/bash-zzz
|
||||
|
||||
# make sure command printing puts the here-document as the last redirection
|
||||
# on the line, and the function export code preserves syntactic correctness
|
||||
fff()
|
||||
{
|
||||
ed /tmp/foo <<ENDOFINPUT >/dev/null
|
||||
ed ${TMPDIR}/foo <<ENDOFINPUT >/dev/null
|
||||
/^name/d
|
||||
w
|
||||
q
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ echo $BASH_VERSION
|
||||
2 /bin/sh -c 'echo this is $0'
|
||||
3 ls
|
||||
4 echo $BASH_VERSION
|
||||
5 HISTFILE=/tmp/newhistory
|
||||
5 HISTFILE=$TMPDIR/newhistory
|
||||
6 echo line 2 for history
|
||||
echo line 2 for history
|
||||
echo line 2 for history
|
||||
@@ -19,7 +19,7 @@ line 2 for history
|
||||
2 /bin/sh -c 'echo this is $0'
|
||||
3 ls
|
||||
4 echo $BASH_VERSION
|
||||
5 HISTFILE=/tmp/newhistory
|
||||
5 HISTFILE=$TMPDIR/newhistory
|
||||
6 echo line 2 for history
|
||||
7 set -H
|
||||
8 echo line 2 for history
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
LC_ALL=C
|
||||
LANG=C
|
||||
trap 'rm /tmp/newhistory' 0
|
||||
trap 'rm $TMPDIR/newhistory' 0
|
||||
|
||||
file=bax
|
||||
histchars='!^#' # make sure history comment char is set correctly
|
||||
@@ -25,7 +25,7 @@ history -p '!!:z'
|
||||
|
||||
history
|
||||
|
||||
HISTFILE=/tmp/newhistory
|
||||
HISTFILE=$TMPDIR/newhistory
|
||||
history -a
|
||||
|
||||
history -w
|
||||
|
||||
+7
-7
@@ -36,13 +36,13 @@ echo line for history
|
||||
echo line for history
|
||||
displaying $HISTFILE after history -a
|
||||
echo line for history
|
||||
HISTFILE=/tmp/newhistory
|
||||
HISTFILE=$TMPDIR/newhistory
|
||||
1 for i in one two three; do echo $i; done
|
||||
2 /bin/sh -c 'echo this is $0'
|
||||
3 ls
|
||||
4 echo $BASH_VERSION
|
||||
5 echo line for history
|
||||
6 HISTFILE=/tmp/newhistory
|
||||
6 HISTFILE=$TMPDIR/newhistory
|
||||
7 echo displaying \$HISTFILE after history -a
|
||||
8 cat $HISTFILE
|
||||
for i in one two three; do echo $i; done
|
||||
@@ -50,7 +50,7 @@ for i in one two three; do echo $i; done
|
||||
ls
|
||||
echo $BASH_VERSION
|
||||
echo line for history
|
||||
HISTFILE=/tmp/newhistory
|
||||
HISTFILE=$TMPDIR/newhistory
|
||||
echo displaying \$HISTFILE after history -a
|
||||
cat $HISTFILE
|
||||
1 for i in one two three; do echo $i; done
|
||||
@@ -58,7 +58,7 @@ cat $HISTFILE
|
||||
3 ls
|
||||
4 echo $BASH_VERSION
|
||||
5 echo line for history
|
||||
6 HISTFILE=/tmp/newhistory
|
||||
6 HISTFILE=$TMPDIR/newhistory
|
||||
7 echo displaying \$HISTFILE after history -a
|
||||
8 cat $HISTFILE
|
||||
9 echo line 2 for history
|
||||
@@ -69,7 +69,7 @@ echo line 2 for history
|
||||
3 ls
|
||||
4 echo $BASH_VERSION
|
||||
5 echo line for history
|
||||
6 HISTFILE=/tmp/newhistory
|
||||
6 HISTFILE=$TMPDIR/newhistory
|
||||
7 echo displaying \$HISTFILE after history -a
|
||||
8 cat $HISTFILE
|
||||
9 echo line 2 for history
|
||||
@@ -80,7 +80,7 @@ echo line 2 for history
|
||||
line 2 for history
|
||||
4 echo $BASH_VERSION
|
||||
5 echo line for history
|
||||
6 HISTFILE=/tmp/newhistory
|
||||
6 HISTFILE=$TMPDIR/newhistory
|
||||
7 echo displaying \$HISTFILE after history -a
|
||||
8 cat $HISTFILE
|
||||
9 echo line 2 for history
|
||||
@@ -94,7 +94,7 @@ line 2 for history
|
||||
17 unset HISTFILE
|
||||
4 echo $BASH_VERSION
|
||||
5 echo line for history
|
||||
6 HISTFILE=/tmp/newhistory
|
||||
6 HISTFILE=$TMPDIR/newhistory
|
||||
7 echo displaying \$HISTFILE after history -a
|
||||
8 cat $HISTFILE
|
||||
./history.tests: line 75: fc: history specification out of range
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
trap 'rm /tmp/newhistory' 0
|
||||
trap 'rm $TMPDIR/newhistory' 0
|
||||
|
||||
# bad options
|
||||
history -x
|
||||
@@ -39,7 +39,7 @@ history -p '!!'
|
||||
|
||||
fc -nl
|
||||
|
||||
HISTFILE=/tmp/newhistory
|
||||
HISTFILE=$TMPDIR/newhistory
|
||||
history -a
|
||||
echo displaying \$HISTFILE after history -a
|
||||
cat $HISTFILE
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
set -m
|
||||
sleep 60 &
|
||||
|
||||
FN=/tmp/jobs-pid.$$
|
||||
FN=$TMPDIR/jobs-pid.$$
|
||||
|
||||
pid1=$!
|
||||
jobs -p %+ > $FN
|
||||
|
||||
+2
-3
@@ -169,11 +169,10 @@ lines.
|
||||
This-string-has-multiple-lines.
|
||||
this is a test of proc subst
|
||||
this is test 2
|
||||
./new-exp2.sub: line 31: /tmp/bashtmp.x*: No such file or directory
|
||||
./new-exp2.sub: line 35: /tmp/redir-notthere: No such file or directory
|
||||
./new-exp2.sub: line 42: /tmp/redir-notthere: No such file or directory
|
||||
1
|
||||
|
||||
./new-exp2.sub: line 42: 1111111111111111111111: command not found
|
||||
./new-exp2.sub: line 49: 1111111111111111111111: command not found
|
||||
|
||||
argv[1] = <6>
|
||||
./new-exp.tests: line 285: ${#:}: bad substitution
|
||||
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
FN=${TMPDIR}/bashtest-$$
|
||||
expect()
|
||||
{
|
||||
echo expect "$@"
|
||||
@@ -5,7 +6,7 @@ expect()
|
||||
|
||||
expect this is a test of proc subst
|
||||
cat <(echo this is a test of proc subst)
|
||||
echo this is test 2 > /tmp/x
|
||||
echo this is test 2 > $FN
|
||||
expect this is test 2
|
||||
cat <(cat /tmp/x)
|
||||
rm -f /tmp/x
|
||||
cat <(cat $FN)
|
||||
rm -f $FN
|
||||
|
||||
+10
-3
@@ -4,7 +4,7 @@ export LANG=C
|
||||
# test out the new $(< filename) code
|
||||
# it should be exactly equivalent to $(cat filename)
|
||||
|
||||
FILENAME=/tmp/bashtmp.x$$
|
||||
FILENAME=$TMPDIR/bashtmp.x$$
|
||||
|
||||
trap 'rm -f $FILENAME' 0
|
||||
|
||||
@@ -21,17 +21,24 @@ if [[ $LINES1 != $LINES2 ]]; then
|
||||
echo 'whoops: $(< filename) failed'
|
||||
fi
|
||||
|
||||
LINES2=$(< /tmp/bashtmp.x*)
|
||||
LINES2=$(< $TMPDIR/bashtmp.x*)
|
||||
if [[ $LINES1 != $LINES2 ]]; then
|
||||
echo 'whoops: $(< filename) with glob expansion failed'
|
||||
fi
|
||||
|
||||
# but the glob expansion in the redirection should fail in posix mode
|
||||
set -o posix
|
||||
LINES2=$(< /tmp/bashtmp.x*)
|
||||
exec 3>&2
|
||||
exec 2>/dev/null
|
||||
LINES2=$(< $TMPDIR/bashtmp.x*)
|
||||
exec 2>&3
|
||||
if [[ $LINES2 -gt 0 ]]; then
|
||||
echo "whoops: redirection glob expansion should be disabled in posix mode" >&2
|
||||
fi
|
||||
set +o posix
|
||||
|
||||
# now see what happens when we try it with a non-existant file
|
||||
rm -f /tmp/redir-notthere
|
||||
LINES3=$(< /tmp/redir-notthere)
|
||||
echo $?
|
||||
|
||||
|
||||
+13
-13
@@ -25,43 +25,43 @@ echo $'\177' | ( read ; recho "$REPLY" )
|
||||
# the input stream
|
||||
echo $'ab\\\ncd' | ( read ; recho "$REPLY" )
|
||||
|
||||
echo "A B " > /tmp/IN
|
||||
echo "A B " > $TMPDIR/IN
|
||||
unset x y z
|
||||
read x y z < /tmp/IN
|
||||
read x y z < $TMPDIR/IN
|
||||
echo 1: "x[$x] y[$y] z[$z]"
|
||||
echo 1a: ${z-z not set}
|
||||
read x < /tmp/IN
|
||||
read x < $TMPDIR/IN
|
||||
echo 2: "x[$x]"
|
||||
rm /tmp/IN
|
||||
rm $TMPDIR/IN
|
||||
|
||||
# this is where the bash `read' behavior with respect to $REPLY differs
|
||||
# from ksh93
|
||||
echo "A B " > /tmp/IN
|
||||
echo "A B " > $TMPDIR/IN
|
||||
|
||||
read < /tmp/IN
|
||||
read < $TMPDIR/IN
|
||||
echo "[$REPLY]"
|
||||
|
||||
rm /tmp/IN
|
||||
rm $TMPDIR/IN
|
||||
|
||||
echo " A B " > /tmp/IN
|
||||
echo " A B " > $TMPDIR/IN
|
||||
|
||||
read < /tmp/IN
|
||||
read < $TMPDIR/IN
|
||||
echo "[$REPLY]"
|
||||
|
||||
rm /tmp/IN
|
||||
rm $TMPDIR/IN
|
||||
|
||||
# make sure that read with more variables than words sets the extra
|
||||
# variables to the empty string
|
||||
|
||||
bvar=bvar
|
||||
cvar=cvar
|
||||
echo aa > /tmp/IN
|
||||
read avar bvar cvar < /tmp/IN
|
||||
echo aa > $TMPDIR/IN
|
||||
read avar bvar cvar < $TMPDIR/IN
|
||||
echo =="$avar"==
|
||||
echo =="$bvar"==
|
||||
echo =="$cvar"==
|
||||
|
||||
rm /tmp/IN
|
||||
rm $TMPDIR/IN
|
||||
|
||||
# test behavior of read with various settings of IFS
|
||||
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ from stdin: aa
|
||||
to stdout
|
||||
./redir4.sub: line 32: $fd: ambiguous redirect
|
||||
./redir4.sub: line 33: $fd: ambiguous redirect
|
||||
/tmp/err-and-out:
|
||||
err-and-out:
|
||||
to stdout
|
||||
to stderr
|
||||
/tmp/err-and-out:
|
||||
err-and-out:
|
||||
to stdout
|
||||
to stderr
|
||||
0 -- 3 0
|
||||
|
||||
+8
-8
@@ -34,23 +34,23 @@ exec 4>&$fd
|
||||
|
||||
exec 3>&1 4>&2
|
||||
|
||||
exec >&/tmp/err-and-out
|
||||
exec >&${TMPDIR}/err-and-out
|
||||
echo to stdout
|
||||
echo to stderr >&2
|
||||
|
||||
exec 1>&3 2>&4
|
||||
echo /tmp/err-and-out:
|
||||
cat /tmp/err-and-out
|
||||
echo err-and-out:
|
||||
cat ${TMPDIR}/err-and-out
|
||||
|
||||
rm /tmp/err-and-out
|
||||
rm ${TMPDIR}/err-and-out
|
||||
|
||||
fd=/tmp/err-and-out
|
||||
fd=${TMPDIR}/err-and-out
|
||||
exec >&$fd
|
||||
echo to stdout
|
||||
echo to stderr >&2
|
||||
|
||||
exec 1>&3 2>&4
|
||||
echo /tmp/err-and-out:
|
||||
cat /tmp/err-and-out
|
||||
echo err-and-out:
|
||||
cat ${TMPDIR}/err-and-out
|
||||
|
||||
rm /tmp/err-and-out
|
||||
rm ${TMPDIR}/err-and-out
|
||||
|
||||
+1
-1
@@ -4729,7 +4729,7 @@ push_func_var (data)
|
||||
/* XXX - should we set v->context here? */
|
||||
v = bind_variable_internal (var->name, value_cell (var), shell_variables->table, 0, 0);
|
||||
#if defined (ARRAY_VARS)
|
||||
if (array_p (var) || assoc_p (var))
|
||||
if (v && (array_p (var) || assoc_p (var)))
|
||||
{
|
||||
FREE (value_cell (v));
|
||||
if (array_p (var))
|
||||
|
||||
Reference in New Issue
Block a user