summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2015-09-01 14:44:02 -0400
committerChet Ramey <chet.ramey@case.edu>2015-09-01 14:44:02 -0400
commitf2d7e1a3bcbdec7ef09db71779d800237fbc58bb (patch)
tree99f5c754703cdb6f5ab5fb7c7200f821df7d61f8
parente9eee9d4b0b266ba3e4aceadcbff1a921431318c (diff)
downloadbash-f2d7e1a3bcbdec7ef09db71779d800237fbc58bb.tar.gz
commit bash-20150813 snapshot
-rw-r--r--CWRU/CWRU.chlog70
-rw-r--r--Makefile.in4
-rw-r--r--bashhist.c13
-rw-r--r--builtins/Makefile.in2
-rw-r--r--builtins/enable.def27
-rw-r--r--builtins/type.def7
-rw-r--r--config-top.h1
-rwxr-xr-xconfigure9
-rw-r--r--configure.ac8
-rw-r--r--doc/bash.120
-rw-r--r--doc/bashref.texi27
-rw-r--r--doc/version.texi6
-rw-r--r--examples/loadables/Makefile.in2
-rw-r--r--jobs.c25
-rw-r--r--jobs.h5
-rw-r--r--lib/readline/text.c7
-rw-r--r--print_cmd.c6
-rw-r--r--subst.c15
-rw-r--r--trap.c2
19 files changed, 223 insertions, 33 deletions
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index c6baf1f..3b4e9fc 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -9315,3 +9315,73 @@ execute_cmd.c
- time_command: catch longjmps to top_level and print command timing
statistics even after a jump to top_level. Fixes issue reported by
Sam Watkins <sam@nipl.net>
+
+ 8/10
+ ----
+config-top.h
+ - OPENLOG_OPTS: if SYSLOG_HISTORY is defined, define to LOG_PID, so each
+ message is tagged with the pid
+
+bashhist.h
+ - bash_syslog_history: the first time it's called, call openlog with
+ OPENLOG_OPTS and SYSLOG_FACILITY
+
+ 8/11
+ ----
+doc/{bash.1,bashref.texi}
+ - GROUPS,FUNCNAME: change description to note that assignments are silently
+ ignored, but do not return an error (which would constitute an assignment
+ error and cause posix mode shells to abort). Problem pointed out by
+ Grzegorz Bajson <gbajson@gmail.com>
+
+ 8/12
+ ----
+subst.c
+ - parameter_brace_expand_indir: if the value of the indirectly expanded
+ variable isn't something that the shell would expand if it were inside
+ ${}, error out right away before calling parameter_brace_expand_word.
+ Fixes problem reported by isabella parakiss <izaberina@gmail.com>
+ - parameter_brace_expand: handle returning &expand_wdesc_error or
+ &expand_wdesc_fatal from parameter_brace_expand_indir in case it does
+ that someday
+
+ 8/13
+ ----
+jobs.c
+ - {save,restore}_pipeline: saved_pipeline now a linked list of pipelines,
+ new ones allocated in save_pipeline and freed in restore_pipeline. This
+ allow multiple nested calls to save_pipeline (e.g., in traps and then in
+ process substitution). Fix for bug reported by isabella parakiss
+ <izaberina@gmail.com>
+
+print_cmd.c
+ - named_function_string: if printing a function with the same name as a
+ reserved word, add the `function ' keyword before the name to avoid
+ parsing problems when trying to reuse it as input. Fix for bug
+ reported by isabella parakiss <izaberina@gmail.com>
+
+ 8/14
+ ----
+lib/readline/text.c
+ - rl_insert: when optimizing typeahead, make sure we set rl_last_func
+ ourselves if we set pending input, since the mainline code path
+ won't set rl_last_func if input is pending. Fixes bug reported by
+ Hiroo Hayashi <hiroo.hayashi@computer.org>
+
+ 8/15
+ ----
+builtins/type.def
+ - describe_command: if using the short description (CDESC_SHORTDESC) in
+ posix mode, describe posix special builtins as such. Requested by
+ Stephane Chazelas <stephane.chazelas@gmail.com>
+
+builtins/enable.def
+ - BASH_LOADABLES_PATH: a colon-separated list of directories where bash
+ looks for loadable builtins specified as arguments to `enable -f'
+
+doc/{bash.1,bashref.texi}
+ - BASH_LOADABLES_PATH: document new shell variable
+
+configure.ac,Makefile.in,builtins/Makefile.in
+ - loadablesdir: set in configure, substitute into Makefiles. Reserved
+ for future use
diff --git a/Makefile.in b/Makefile.in
index ed2cbb2..03df2a4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile for bash-4.4, version 4.14
+# Makefile for bash-4.4, version 4.15
#
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
@@ -42,6 +42,8 @@ includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
+loadablesdir = @loadablesdir@
+
docdir = @docdir@
mandir = @mandir@
diff --git a/bashhist.c b/bashhist.c
index fbb20ea..54343f8 100644
--- a/bashhist.c
+++ b/bashhist.c
@@ -730,11 +730,24 @@ check_add_history (line, force)
#if defined (SYSLOG_HISTORY)
#define SYSLOG_MAXLEN 600
+extern char *shell_name;
+
+#ifndef OPENLOG_OPTS
+#define OPENLOG_OPTS 0
+#endif
+
void
bash_syslog_history (line)
const char *line;
{
char trunc[SYSLOG_MAXLEN];
+ static int first = 1;
+
+ if (first)
+ {
+ openlog (shell_name, OPENLOG_OPTS, SYSLOG_FACILITY);
+ first = 0;
+ }
if (strlen(line) < SYSLOG_MAXLEN)
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d %s", getpid(), current_user.uid, line);
diff --git a/builtins/Makefile.in b/builtins/Makefile.in
index 47b60cd..19dd384 100644
--- a/builtins/Makefile.in
+++ b/builtins/Makefile.in
@@ -45,6 +45,8 @@ includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
+loadablesdir = @loadablesdir@
+
# Support an alternate destination root directory for package building
DESTDIR =
diff --git a/builtins/enable.def b/builtins/enable.def
index 6e8e959..10cd92d 100644
--- a/builtins/enable.def
+++ b/builtins/enable.def
@@ -66,6 +66,7 @@ $END
#include "../flags.h"
#include "common.h"
#include "bashgetopt.h"
+#include "findcmd.h"
#if defined (PROGRAMMABLE_COMPLETION)
# include "../pcomplete.h"
@@ -299,6 +300,7 @@ dyn_load_builtin (list, flags, filename)
char *struct_name, *name, *funcname;
sh_load_func_t *loadfunc;
struct builtin **new_builtins, *b, *new_shell_builtins, *old_builtin;
+ char *loadables_path, *load_path;
if (list == 0)
return (EXECUTION_FAILURE);
@@ -307,10 +309,31 @@ dyn_load_builtin (list, flags, filename)
#define RTLD_LAZY 1
#endif
+ handle = 0;
+ if (absolute_program (filename) == 0)
+ {
+ loadables_path = get_string_value ("BASH_LOADABLES_PATH");
+ if (loadables_path)
+ {
+ load_path = find_in_path (filename, loadables_path, FS_NODIRS|FS_EXEC_PREFERRED);
+ if (load_path)
+ {
+#if defined (_AIX)
+ handle = dlopen (load_path, RTLD_NOW|RTLD_GLOBAL);
+#else
+ handle = dlopen (load_path, RTLD_LAZY);
+#endif /* !_AIX */
+ free (load_path);
+ }
+ }
+ }
+
+ /* Fall back to current directory for now */
+ if (handle == 0)
#if defined (_AIX)
- handle = dlopen (filename, RTLD_NOW|RTLD_GLOBAL);
+ handle = dlopen (filename, RTLD_NOW|RTLD_GLOBAL);
#else
- handle = dlopen (filename, RTLD_LAZY);
+ handle = dlopen (filename, RTLD_LAZY);
#endif /* !_AIX */
if (handle == 0)
diff --git a/builtins/type.def b/builtins/type.def
index 77044b6..8cb84c9 100644
--- a/builtins/type.def
+++ b/builtins/type.def
@@ -294,7 +294,12 @@ describe_command (command, dflags)
if (dflags & CDESC_TYPE)
puts ("builtin");
else if (dflags & CDESC_SHORTDESC)
- printf (_("%s is a shell builtin\n"), command);
+ {
+ if (posixly_correct && find_special_builtin (command) != 0)
+ printf (_("%s is a special shell builtin\n"), command);
+ else
+ printf (_("%s is a shell builtin\n"), command);
+ }
else if (dflags & CDESC_REUSABLE)
printf ("%s\n", command);
diff --git a/config-top.h b/config-top.h
index 8bae506..e32482d 100644
--- a/config-top.h
+++ b/config-top.h
@@ -113,6 +113,7 @@
#if defined (SYSLOG_HISTORY)
# define SYSLOG_FACILITY LOG_USER
# define SYSLOG_LEVEL LOG_INFO
+# define OPENLOG_OPTS LOG_PID
#endif
/* Define if you want to include code in shell.c to support wordexp(3) */
diff --git a/configure b/configure
index a20c5a3..e1a5774 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac for Bash 4.4, version 4.071.
+# From configure.ac for Bash 4.4, version 4.072.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-alpha.
#
@@ -635,6 +635,7 @@ DEBUG
RELSTATUS
BASHVERS
ARFLAGS
+loadablesdir
BUILD_DIR
incdir
PROFILE_FLAGS
@@ -16116,6 +16117,12 @@ fi
+# directory where we install dynamically loadable builtins
+if test -z "$loadablesdir"; then
+ loadablesdir='${libdir}/bash'
+fi
+
+
diff --git a/configure.ac b/configure.ac
index 1c15c37..91fcf46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Bash 4.4, version 4.071])dnl
+AC_REVISION([for Bash 4.4, version 4.072])dnl
define(bashvers, 4.4)
define(relstatus, alpha)
@@ -1191,6 +1191,12 @@ AC_SUBST(BUILD_DIR)
AC_SUBST(datarootdir)
AC_SUBST(localedir)
+# directory where we install dynamically loadable builtins
+if test -z "$loadablesdir"; then
+ loadablesdir='${libdir}/bash'
+fi
+AC_SUBST(loadablesdir)
+
AC_SUBST(YACC)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
diff --git a/doc/bash.1 b/doc/bash.1
index d36861b..5e4625d 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Fri Jul 31 11:16:37 EDT 2015
+.\" Last Change: Sat Aug 15 15:17:33 EDT 2015
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
-.TH BASH 1 "2015 July 31" "GNU Bash 4.4"
+.TH BASH 1 "2015 August 15" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1520,6 +1520,12 @@ Use
.B LINENO
to obtain the current line number.
.TP
+.B BASH_LOADABLES_PATH
+A colon-separated list of directories in which the shell looks for
+dynamically loadable builtins specified by the
+.B enable
+command.
+.TP
.B BASH_REMATCH
An array variable whose members are assigned by the \fB=~\fP binary
operator to the \fB[[\fP conditional command.
@@ -1681,7 +1687,7 @@ This variable exists only when a shell function is executing.
Assignments to
.SM
.B FUNCNAME
-have no effect and return an error status.
+have no effect.
If
.SM
.B FUNCNAME
@@ -1704,7 +1710,7 @@ user is a member.
Assignments to
.SM
.B GROUPS
-have no effect and return an error status.
+have no effect.
If
.SM
.B GROUPS
@@ -8656,15 +8662,15 @@ The return value is zero on success, non-zero on failure.
.PD
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
-directory. With no arguments, exchanges the top two directories
+directory. With no arguments, \fBpushd\fP exchanges the top two directories
and returns 0, unless the directory stack is empty.
Arguments, if supplied, have the following meanings:
.RS
.PD 0
.TP
.B \-n
-Suppresses the normal change of directory when adding directories
-to the stack, so that only the stack is manipulated.
+Suppresses the normal change of directory when rotating or
+adding directories to the stack, so that only the stack is manipulated.
.TP
\fB+\fP\fIn\fP
Rotates the stack so that the \fIn\fPth directory
diff --git a/doc/bashref.texi b/doc/bashref.texi
index 7b75f3f..f2a699f 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -5503,6 +5503,11 @@ where each corresponding member of @var{FUNCNAME} was invoked.
referenced within another shell function).
Use @code{LINENO} to obtain the current line number.
+@item BASH_LOADABLES_PATH
+A colon-separated list of directories in which the shell looks for
+dynamically loadable builtins specified by the
+@code{enable} command.
+
@item BASH_REMATCH
An array variable whose members are assigned by the @samp{=~} binary
operator to the @code{[[} conditional command
@@ -5698,7 +5703,7 @@ shell function.
The bottom-most element (the one with the highest index)
is @code{"main"}.
This variable exists only when a shell function is executing.
-Assignments to @env{FUNCNAME} have no effect and return an error status.
+Assignments to @env{FUNCNAME} have no effect.
If @env{FUNCNAME} is unset, it loses its special properties, even if
it is subsequently reset.
@@ -5725,7 +5730,7 @@ of matches.
@item GROUPS
An array variable containing the list of groups of which the current
user is a member.
-Assignments to @env{GROUPS} have no effect and return an error status.
+Assignments to @env{GROUPS} have no effect.
If @env{GROUPS} is unset, it loses its special properties, even if it is
subsequently reset.
@@ -6992,6 +6997,7 @@ The directory stack is a list of recently-visited directories. The
the current directory, and the @code{popd} builtin removes specified
directories from the stack and changes the current directory to
the directory removed. The @code{dirs} builtin displays the contents
+of the directory stack. The current directory is always the "top"
of the directory stack.
The contents of the directory stack are also visible
@@ -7040,13 +7046,11 @@ with zero.
popd [-n] [+@var{N} | -@var{N}]
@end example
-Remove the top entry from the directory stack, and @code{cd}
-to the new top directory.
When no arguments are given, @code{popd}
removes the top directory from the stack and
-performs a @code{cd} to the new top directory. The
-elements are numbered from 0 starting at the first directory listed with
-@code{dirs}; that is, @code{popd} is equivalent to @code{popd +0}.
+performs a @code{cd} to the new top directory.
+The elements are numbered from 0 starting at the first directory
+listed with @code{dirs}; that is, @code{popd} is equivalent to @code{popd +0}.
@table @code
@item -n
@@ -7068,12 +7072,13 @@ pushd [-n] [@var{+N} | @var{-N} | @var{dir}]
Save the current directory on the top of the directory stack
and then @code{cd} to @var{dir}.
-With no arguments, @code{pushd} exchanges the top two directories.
+With no arguments, @code{pushd} exchanges the top two directories
+and makes the new top the current directory.
@table @code
@item -n
-Suppresses the normal change of directory when adding directories
-to the stack, so that only the stack is manipulated.
+Suppresses the normal change of directory when rotating or
+adding directories to the stack, so that only the stack is manipulated.
@item +@var{N}
Brings the @var{N}th directory (counting from the left of the
list printed by @code{dirs}, starting with zero) to the top of
@@ -7083,7 +7088,7 @@ Brings the @var{N}th directory (counting from the right of the
list printed by @code{dirs}, starting with zero) to the top of
the list by rotating the stack.
@item @var{dir}
-Makes the current working directory be the top of the stack, making
+Makes @var{dir} be the top of the stack, making
it the new current directory as if it had been supplied as an argument
to the @code{cd} builtin.
@end table
diff --git a/doc/version.texi b/doc/version.texi
index ed54f5d..182402b 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -2,10 +2,10 @@
Copyright (C) 1988-2015 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Fri Jul 31 11:16:22 EDT 2015
+@set LASTCHANGE Sat Aug 15 15:17:52 EDT 2015
@set EDITION 4.4
@set VERSION 4.4
-@set UPDATED 31 July 2015
-@set UPDATED-MONTH July 2015
+@set UPDATED 15 August 2015
+@set UPDATED-MONTH August 2015
diff --git a/examples/loadables/Makefile.in b/examples/loadables/Makefile.in
index f3aba44..304d87d 100644
--- a/examples/loadables/Makefile.in
+++ b/examples/loadables/Makefile.in
@@ -27,7 +27,7 @@ infodir = @infodir@
includedir = @includedir@
datarootdir = @datarootdir@
-loadablesdir = ${libdir}/bash
+loadablesdir = @loadablesdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
diff --git a/jobs.c b/jobs.c
index 22703ed..81da02f 100644
--- a/jobs.c
+++ b/jobs.c
@@ -323,7 +323,7 @@ static SigHandler *old_tstp, *old_ttou, *old_ttin;
static SigHandler *old_cont = (SigHandler *)SIG_DFL;
/* A place to temporarily save the current pipeline. */
-static PROCESS *saved_pipeline;
+static struct pipeline_saver *saved_pipeline;
static int saved_already_making_children;
/* Set this to non-zero whenever you don't want the jobs list to change at
@@ -435,14 +435,29 @@ cleanup_the_pipeline ()
discard_pipeline (disposer);
}
+struct pipeline_saver *
+alloc_pipeline_saver ()
+{
+ struct pipeline_saver *ret;
+
+ ret = (struct pipeline_saver *)xmalloc (sizeof (struct pipeline_saver));
+ ret->pipeline = 0;
+ ret->next = 0;
+ return ret;
+}
+
void
save_pipeline (clear)
int clear;
{
sigset_t set, oset;
+ struct pipeline_saver *saver;
BLOCK_CHILD (set, oset);
- saved_pipeline = the_pipeline;
+ saver = alloc_pipeline_saver ();
+ saver->pipeline = the_pipeline;
+ saver->next = saved_pipeline;
+ saved_pipeline = saver;
if (clear)
the_pipeline = (PROCESS *)NULL;
saved_already_making_children = already_making_children;
@@ -455,10 +470,14 @@ restore_pipeline (discard)
{
PROCESS *old_pipeline;
sigset_t set, oset;
+ struct pipeline_saver *saver;
BLOCK_CHILD (set, oset);
old_pipeline = the_pipeline;
- the_pipeline = saved_pipeline;
+ the_pipeline = saved_pipeline->pipeline;
+ saver = saved_pipeline;
+ saved_pipeline = saved_pipeline->next;
+ free (saver);
already_making_children = saved_already_making_children;
UNBLOCK_CHILD (oset);
diff --git a/jobs.h b/jobs.h
index a296f81..d3c9d0c 100644
--- a/jobs.h
+++ b/jobs.h
@@ -61,6 +61,11 @@ typedef struct process {
char *command; /* The particular program that is running. */
} PROCESS;
+struct pipeline_saver {
+ struct process *pipeline;
+ struct pipeline_saver *next;
+};
+
/* PALIVE really means `not exited' */
#define PSTOPPED(p) (WIFSTOPPED((p)->status))
#define PRUNNING(p) ((p)->running == PS_RUNNING)
diff --git a/lib/readline/text.c b/lib/readline/text.c
index f2bb224..f11b950 100644
--- a/lib/readline/text.c
+++ b/lib/readline/text.c
@@ -925,7 +925,12 @@ rl_insert (count, c)
}
if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */
- r = rl_execute_next (n);
+ {
+ /* setting rl_pending_input inhibits setting rl_last_func so we do it
+ ourselves here */
+ rl_last_func = rl_insert;
+ r = rl_execute_next (n);
+ }
return r;
}
diff --git a/print_cmd.c b/print_cmd.c
index b4ddc95..b0d276f 100644
--- a/print_cmd.c
+++ b/print_cmd.c
@@ -1339,7 +1339,11 @@ named_function_string (name, command, flags)
deferred_heredocs = 0;
if (name && *name)
- cprintf ("%s ", name);
+ {
+ if (find_reserved_word (name) >= 0)
+ cprintf ("function ");
+ cprintf ("%s ", name);
+ }
cprintf ("() ");
diff --git a/subst.c b/subst.c
index 383c939..aac0907 100644
--- a/subst.c
+++ b/subst.c
@@ -6313,6 +6313,16 @@ parameter_brace_expand_indir (name, var_is_special, quoted, quoted_dollar_atp, c
if (t == 0)
return (WORD_DESC *)NULL;
+ if (valid_brace_expansion_word (t, SPECIAL_VAR (t, 0)) == 0)
+ {
+ report_error (_("%s: bad substitution"), t);
+ free (t);
+ w = alloc_word_desc ();
+ w->word = &expand_param_error;
+ w->flags = 0;
+ return (w);
+ }
+
w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0, 0);
free (t);
@@ -7827,6 +7837,11 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
if (want_indir)
{
tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
+ if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal)
+ {
+ temp = (char *)NULL;
+ goto bad_substitution;
+ }
/* Turn off the W_ARRAYIND flag because there is no way for this function
to return the index we're supposed to be using. */
if (tdesc && tdesc->flags)
diff --git a/trap.c b/trap.c
index bf3cfbc..a9b1f42 100644
--- a/trap.c
+++ b/trap.c
@@ -320,6 +320,7 @@ run_pending_traps ()
while (pending_traps[sig]--) instead of the if statement. */
if (pending_traps[sig])
{
+itrace("run_pending_traps: %d: %d", sig, pending_traps[sig]);
if (running_trap == sig+1)
/*continue*/;
@@ -403,6 +404,7 @@ run_pending_traps ()
/* XXX - set pending_traps[sig] = 0 here? */
pending_traps[sig] = 0;
evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
+itrace("run_pending_traps: evalstring returns");
#if defined (JOB_CONTROL)
restore_pipeline (1);
#endif