bash-4.4 beta release

This commit is contained in:
Chet Ramey
2015-10-12 09:57:17 -04:00
parent eac8fb1b4c
commit 54a5fbe126
314 changed files with 29440 additions and 18757 deletions
+168 -3
View File
@@ -1,3 +1,164 @@
This document details the changes between this version, bash-4.4-beta, and
the previous version, bash-4.4-alpha.
1. Change to Bash
a. Fixed two bugs that caused out-of-bounds reads when skipping over assignment
statements while finding the word on which to perform programmable
completion.
b. Fixed a memory leak in programmable completion.
c. Fixed a bug that could cause the shell to crash when interrupting the
wait builtin.
d. Fixed a bug that caused ${!vvv@} to be interpreted as introducing the new
`@' operator.
e. Fixed a bug that caused the && and || operators to be incorrectly optimized.
f. The shell now undoes redirections before exiting the shell when the `-e'
option is enabled, and a shell function fails.
g. History expansion now skips over the history expansion character in command
and process substitution.
h. Fixed a bug that caused stray '\001' characters to be added to the output
of `declare -p'.
i. Fixed a memory leak when processing declare commands that perform compound
array assignments.
j. Fixed a bug that could cause the shell to crash when reading input from a
file and the limit on open file descriptors is high.
k. Fixed a bug that caused the ERR and RETURN traps to be unset if they were
set in a shell function but unset previously.
l. Fixed a bug that caused several signals to be ignored if `exec' failed in
an interactive shell.
m. A posix-mode non-interactive shell now considers a parameter expansion error
to be a fatal error.
n. The `time' command now prints timing statistics for failed commands when
the -e option is enabled.
o. Fixed a bug that caused the shell to crash when attempting to indirectly
expand a shell variable with an invalid name.
p. Fixed a bug that caused the shell to crash when running a trap containing
a process substitution.
q. Bash now prints the keyword `function' before a function with the same name
as a reserved word when using `declare -f' to avoid parse errors when
reusing the output as input.
r. Fixed a bug that caused the shell to crash when using declare -g to attempt
to redefine an existing global indexed array variable as an associative
array.
s. Fixed a memory leak that occurred when interrupting brace expansions
generating a sequence.
t. Fixed a bug that resulted in alias expansion in redirections.
u. The `declare -a' and `declare -A' commands now print fewer warnings when
attempting to create and initialize an array at the same time, but
relying on word expansions to construct the compound assignment.
v. The `help' builtin now behaves better in locales where each wide
character occupies more than one display column.
w. The `read' builtin no longer has a possible race condition when a timeout
occurs.
x. Fixed several expansion problems encountered when IFS="'".
y. Fixed a problem with the expansion of $'\c?'.
z. Bash no longer splits the expansion of here-strings, as the documentation
has always said.
aa. Bash now puts `s' in the value of $- if the shell is reading from standard
input, as Posix requires.
bb. Fixed a bug that caused the shell to crash if invoked with a NULL
environment.
cc. The shell now only trusts an inherited value for $PWD if it begins with a
`/'.
dd. Fixed a memory leak when creating local array variables and assigning to
them using compound assignment with the `declare' builtin.
ee. Fixed a bug that could cause the shell to crash when processing nested here
documents inside a command substitution.
ff. Array keys and values are now displayed using $'...' quoting where
appropriate.
gg. Fixed a bug that could cause the shell to crash if the replacement string
in pattern substitution was NULL.
hh. Fixed a bug that could cause the shell to crash if a command substitution
contained a non-fatal syntax error.
ii. Fixed a bug that could cause the shell to crash if variable indirection
resulted in a NULL variable.
jj. Fixed a bug that could cause the shell to crash if a long string contained
multiple unterminated parameter expansion constructs.
kk. Improved the code that acts on SIGINT received while waiting for a child
process only if the child exits due to SIGINT.
ll. $BASH_SUBSHELL now has more consistent values in asynchronous simple
commands.
2. Changes to Readline
a. Colored completion prefixes are now displayed using a different color, less
likely to collide with files.
b. Fixed a bug that caused vi-mode character search to misbehave when
running in callback mode.
c. Fixed a bug that caused output to be delayed when input is coming from a
macro in vi-mode.
d. Fixed a bug that caused the vi-mode `.' command to misbehave when redoing
a multi-key key sequence via a macro.
e. Fixed a bug that caused problems with applications that supply their own
input function when performing completion.
f. When read returns -1/EIO when attempting to read a key, return an error
instead of line termination back to the caller.
g. Updated tty auditing feature based on patch from Red Hat.
h. Fixed a bug that could cause the history library to crash on overflows
introduced by malicious editing of timestamps in the history file.
3. New Features in Bash
a. `make install' now installs the example loadable builtins and a set of
bash headers to use when developing new loadable builtins.
b. `enable -f' now attempts to call functions named BUILTIN_builtin_load when
loading BUILTIN, and BUILTIN_builtin_unload when deleting it. This allows
loadable builtins to run initialization and cleanup code.
c. There is a new BASH_LOADABLES_PATH variable containing a list of directories
where the `enable -f' command looks for shared objects containing loadable
builtins.
d. The `kill' builtin now has a `-L' option, equivalent to `-l', for compatibility
with Linux standalone versions of kill.
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.4-alpha, and
the previous version, bash-4.3-release.
@@ -236,7 +397,7 @@ www. Fixes for upper and lower-casing multibyte characters, some locales have
bytes.
xxx. Fixed a bug that caused the ERR trap in a shell function to have the
right value for $LINENO.
wrong value for $LINENO.
yyy. Fixed a bug that resulted in incorrect quoting of regexps for the =~
operator when an open brace appears without a close brace.
@@ -323,6 +484,10 @@ vvvv. Fixed a bug that caused the completion code to read past the end of the
wwww. Fixed a bug that caused case statements within loops contained in a
command substitution to be parsed incorrectly.
xxxx. Fixed a bug that could cause SIGCHLD handling to be delayed after
running `wait' with no arguments and interrupting it with ^C without
a trap handler installed.
2. Changes to Readline
a. A bug that caused vi-mode `.' to be unable to redo `c', `d', and `y'
@@ -439,7 +604,7 @@ r. Executing the rhs of && and || will no longer cause the shell to fork if
it's not necessary.
s. The `local' builtin takes a new argument: `-', which will cause it to save
and the single-letter shell options and restore their previous values at
the single-letter shell options and restore their previous values at
function return.
t. `complete' and `compgen' have a new `-o nosort' option, which forces
@@ -1277,7 +1442,7 @@ y. The {x}<word redirection feature now allows words like {array[ind]} and
can use variables with special meanings to the shell (e.g., BASH_XTRACEFD).
z. There is a new CHILD_MAX special shell variable; its value controls the
number of exited child statues the shell remembers.
number of exited child statuses the shell remembers.
aa. There is a new configuration option (--enable-direxpand-default) that
causes the `direxpand' shell option to be enabled by default.
+2
View File
@@ -425,6 +425,8 @@ compat43 set
- the shell does not print a warning message if an attempt is made to
use a quoted compound assignment as an argument to declare
(declare -a foo='(1 2)')
- word expansion errors are considered non-fatal errors that cause the
current command to fail, even in Posix mode
-------------------------------------------------------------------------------
+743
View File
@@ -8956,3 +8956,746 @@ builtins/wait.def
[bash-4.4-alpha frozen]
7/7
---
bashline.c
- attempt_shell_completion: when skipping assignment statements, don't
skip past rl_point to find the word on which to perform programmable
completion. Fixes bug reported by Hanno Böck <hanno@hboeck.de>
7/10
----
pcomplib.c
- compspec_copy: set the refcount on the copy to 1, since it's a freshly
allocated copy and there are no other pointers to it. Fixes memory
leak from gen_progcomp_completions
lib/readline/complete.c
- printable_part: if the pathname passed is just `/', just return it
instead of potentially reading before the `/'. Fixes bug reported
by Hanno Böck <hanno@hboeck.de>
7/11
----
support/man2html.c
- change calls to malloc to use xmalloc; provide standard xmalloc
definition. Report from Bill Parker <wp02855@gmail.com>
builtins/wait.def
- wait_intr_flag: set to denote validity of wait_intr_buf as target
for longjmp; reset by WAIT_RETURN macro; should always be 0 when
wait_builtin returns
quit.h
- CHECK_WAIT_INTR: now also checks wait_intr_flag to ensure valid state
of wait_intr_buf before sh_longjmp
{jobs,nojobs}.c
- wait_intr_flag: extern declaration for use by CHECK_WAIT_INTR
sig.c
- wait_intr_flag: set back to 0 every place the shell resets state after
a jump to top_level
- sigint_sighandler: only set wait_signal_received if wait_intr_flag
indicates that the wait builtin has correctly set wait_intr_buf.
Final fix for bug reported by Ondrej Oprala <ooprala@redhat.com>
subst.c
- parameter_brace_expand: fix so that ${!vvv@} is not interpreted as
introducing a `@' operator, but instead retains its meaning as all
variables whose name begins with vvv. Fixes bug reported by
konsolebox <konsolebox@gmail.com>
7/14
----
execute_cmd.c
- execute_connection: remove the fork optimization from and AND_AND
and OR_OR cases; it has trouble with `a && b && c', since the `&&'
is left-associative. Putting that code here can result in unwanted
fork optimizations since the `b' will end up as `second' on a
recursive call to execute_command. Bug reported by Mike Frysinger
<vapier@gentoo.org>
builtins/evalstring.c
- optimize_fork: moved code from execute_connection to here; checks
whether the RHS of a && or || passes the suppress_fork() tests and
turns on the NO_FORK bit if so
- parse_and_execute: if suppress_fork() tests fail, check whether the
command to be executed is a connection and attempt to optimize the
fork for the right side using optimize_fork(). The key is dealing
with the entire command passed to `bash -c' or `eval'
builtins/common.h
- optimize_fork: new extern declaration
execute_cmd.c
- execute_command_internal: enable code put in to undo redirections
before exiting the shell due to `set -e' in the case of a shell
function that gets command-not-found or a syntax error. Reported
back in May, 2014 by Mark Ferrell <major@homeonderanged.org>
bashhist.c
- bash_history_inhibit_expansion: enable change from 1/10 that skips
over history expansion character in command and process
substitution
7/15
----
lib/readline/{history,undo}.c
- replace_history_data now _hs_replace_history_data
7/16
----
lib/readline/readline.c
- make sure _rl_to_lower doesn't ever get characters that are outside
of its valid range by casting arg to unsigned char
lib/readline/colors.h
- change completion prefix color (C_PREFIX) to be the same as C_SOCK,
which is less likely to collide with file type colorings (magenta)
lib/readline/complete.c
- fnprint: now takes an additional argument: the full, expanded pathname
corresponding to the `toprint' argument
- fnprint: don't zero out prefix_bytes if we're not printing the
ellipisis but we still want to use prefix_bytes for displaying
the common prefix in a color
- print_filename: move colored-stats display responsibility into fnprint
- fnprint: change so colored-prefix and colored-stats can cooperate
and display filenames with multiple colors: one for the prefix and
one for the file type. The prefix is displayed in the prefix color
and the remainder of the pathname, if any, is displayed in the color
corresponding to the file type. Report and suggestion from Mike
Frysinger <vapier@gentoo.org>
7/17
----
lib/readline/readline.[ch]
- rl_readline_state: now unsigned long, prepare for more than 32 states
7/18
----
lib/readline/history.h
- history_offset: now declared here, was always a global variable
- copy_history_entry: now declared here, part of the public interface
- alloc_history_entry: now declared here, part of the public interface
7/20
----
lib/readline/readline.h
- RL_STATE_CHARSEARCH: new state, for vi mode character search. Was
previously handled by simply setting _rl_callback_func
lib/readline/vi_mode.c
- rl_domove_motion_callback: split into two functions, remaining code
after _rl_dispatch call goes into new function
_rl_vi_domove_motion_cleanup
- rl_vi_char_search: set RL_STATE_CHARSEARCH
- rl_vi_char_search: sets `i2' member of callback data to the key used
to invoke the char search
- _rl_vi_callback_char_search: unset RL_STATE_CHARSEARCH after reading
the character to find
- _rl_vi_domove_motion_cleanup: make sure RL_STATE_VIMOTION is unset in
all cases where this function returns
- _rl_vi_domove_motion_cleanup: use `end' member of vi motion context
as value of rl_end to restore after adding blank at end of line in
rl_domove_motion_callback; avoids need to keep `old_end' and somehow
pass it between the two functions
lib/readline/rlprivate.h
- _rl_vi_domove_motion_cleanup: new extern declaration
lib/readline/callback.c
- rl_callback_read_char: handle RL_STATE_CHARSEARCH, including case
where char search is vi motion command for d/c/y/m and RL_STATE_VIMOTION
is set when this is called. Last of set of fixes for bug reported
by Carlos Pita <carlosjosepita@gmail.com> with vi-mode `dty' command
in callback mode
7/21
----
subst.c
- command_substitute, process_substitute: add QUIT call in the child
after restoring original signal handlers to catch post-fork SIGINT
or terminating signal
jobs.c,nojobs.c
- make_child: after forking, clear interrupt_state in child
before restoring signal mask so children get their own set of
interrupts
7/22
----
lib/sh/shquote.c
- sh_double_quote: since all uses of the return value from this function
are for display and not subject to subsequent expansion, we don't
need to protect CTLESC and CTLNUL with CTLESC. Bug report and fix
from isabella parakiss <izaberina@gmail.com>
parse.y
- decode_prompt_string: need to protect literal instances of CTLESC
and CTLNUL with CTLESC, even if they are not coming out of one of
the backslash-expansions
subst.c
- make_internal_declare: fixed memory leak; make_internal_declare should
free the memory it allocates to construct the word list. From Red
Hat bug 1245233; https://bugzilla.redhat.com/show_bug.cgi?id=1245233
lib/readline/readline.c
- _rl_dispatch_subseq: when checking whether an ESC in vi insert mode
should be treated as part of a key sequence or as a single char,
make sure we are getting input from the keyboard before we check
_rl_input_queued(). If we are getting input from a macro, this
causes a needless delay. Report from Carlos Pita
<carlosjosepita@gmail.com>
7/23
----
input.c
- save_bash_input: before checking to see whether or not a new fd has a
stale associated buffer, make sure that the new fd is within bounds.
Bug report and fix from Alexey Makhalov <makhaloff@gmail.com>
7/24
----
doc/{bash.1,bashref.texi}
- note that the `return' builtin accepts arguments beginning with `-'
without requiring `--'
7/27
----
examples/loadables/Makefile.in
- add variables and targets to support `make install'; installs
supported builtins in $(libdir)/bash
7/28
----
lib/readline/{readline,rlprivate}.h, lib/readline/display.c
- rearrange some structure members for better alignment and to reduce
padding. Fix from <git-dpa@aegee.org>
tests/run-*
- use BASH_TSTOUT instead of hardcoded /tmp/xx as output file
trap.[ch]
- maybe_set_error_trap: set a trap for the ERR trap if it is not already
trapped; similar to maybe_set_debug_trap back from 4/10
lib/malloc/malloc.c
- internal_free: make sure `ubytes' is initialized if MALLOC_WATCH is
defined and we'll be passing it to _malloc_ckwatch. Report from
Flavio Medeiros <flaviomotamederios@gmail.com>
execute_cmd.c
- execute_function: use maybe_set_error_trap in the same way as
maybe_set_debug_trap. Fixes bug reported by David Waddell
<David.Waddell@owmobility.com>
7/29
----
jobs.c
- wait_for: no longer need to call job_signal_status when checking
whether a comsub shell reaped a child that died due to SIGINT; code
now uses child_caught_sigint
7/30
----
builtins/exec.def
- exec_builtin: after call to restore_original_signals, need to call
default_tty_job_signals to undo changes done by initialize_job_signals.
Fix for problem reported by Andreas Schwab <schwab@suse.de>
doc/{bash.1,bashref.texi}
- clarify definition of metacharacter to explicitly include newline;
prompted by report from George Gallo <georgeggallo@gmail.com>
8/3
---
lib/readline/search.c
- _rl_free_history_entry: should be void, not int. Report from
Dilyan Palauzov <dilyan.palauzov@aegee.org>
general.h
- sh_load_func_t, sh_unload_func_t: new function pointer types, used by
enable for load and unload hook functions
builtins/enable.def
- dyn_load_builtin: attempt to execute a function named BUILTIN_builtin_load,
where BUILTIN is the name of the command being loaded. If that
function returns 0, the load fails
- dyn_unload_builtin: attempt to execute a function named BUILTIN_builtin_unload,
where BUILTIN is the name of the command being unloaded. It offers a
dynamic builtin a way to clean up after itself. Inspired by
suggestion from Piotr Grzybowski <narsil.pl@gmail.com> in response
to a bug report from isabella parakiss <izaberina@gmail.com>
8/6
---
lib/readline/colors.[ch]
- _rl_print_color_indicator: now takes `const char *' argument
lib/readline/complete.c
- colored_stat_start: now takes `const char *' argument
lib/malloc/table.h
- ma_table_t: `file' member is now `const char *'
lib/malloc/table.c
- mlocation_register_alloc: make sure variable assigned to `file' in
ma_table_t is of type `const char *'. Fixes from Dilyan Palauzov
<dilyan.palauzov@aegee.org>
lib/termcap/termcap.[ch]
- tputs: should return int instead of void
lib/readline/readline.h
- RL_STATE_DONE: correct value, avoid collision
lib/readline/vi_mode.c
- _rl_vi_redoing: now global, added _rl_ prefix to `vi_redoing'
lib/readline/readline.c
- _rl_subseq_result: call _rl_dispatch_subseq instead of rl_dispatch to
avoid changing _rl_dispatching_keymap
- _rl_subseq_result: in the -2 case, set _rl_dispatching_keymap to the
map passed as an argument. Without this, vi mode doesn't call
rl_vi_set_last when it should
- _rl_dispatch_subseq: if redoing a vi mode command with `.'
(_rl_vi_redoing != 0) in callback mode and we're indirecting into
another keymap that has shadowed the key corresponding to the command
we are redoing, just call _rl_subseq_result immediately: vi redo
doesn't need to read any additional input, and rl_vi_redo assumes
that a single call to rl_dispatch is sufficient. Fixes bug reported
by Carlos Pita <carlosjosepita@gmail.com>
8/7
---
subst.c
- parameter_brace_expand: if a substitution (parameter expansion) error
occurs, and shell_compatibility_level is <= 43, return expansion error
as in all previous versions. If shell_compatibility_level is > 43,
a posix-mode non-interactive shell will consider this a fatal error.
Problem reported by Christian Neukirchen <chneukirchen@gmail.com>
doc/bashref.texi
- documented that word expansion errors cause fatal errors in posix mode
non-interactive shells
8/8
---
subst.h
- SD_COMPLETE: skip_to_delim being called as part of word completion
- SX_COMPLETE: one of the string_extract functions being called as
part of word completion
bashline.c
- find_cmd_start,find_cmd_end,find_cmd_name: call skip_to_delim with
SD_COMPLETE flag
subst.c
- skip_double_quoted: takes new flags argument; changed callers
- skip_double_quoted: if flags argument includes SX_COMPLETE, pass it
to extract_command_subst
- extract_command_subst: if flags&SX_COMPLETE, call
extract_delimited_string instead of xparse_dolparen, since completion
may call this for unterminated command substitutions. Fixes
(imperfectly) bug reported by Ingo Ruhnke <grumbel@gmail.com>
- skip_to_delim: if passed the SD_COMPLETE flag, pass the SX_COMPLETE
flag to skip_double_quoted
- char_is_quoted: pass SX_COMPLETE flag to skip_double_quoted
- unclosed_pair: pass SX_COMPLETE flag to skip_double_quoted
8/9
---
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
8/18
----
subst.c
- shell_expand_word_list: if make_internal_declare fails, make sure to
propagate that error return back and make the assignment statement
fail. Fixes seg fault reported by Sergey Tselikh <stselikh@gmail.com>
8/20
----
builtins/declare.def
- declare_internal: made a slight tweak to the warning message about
quoted compound assignments by printing it only if the array (indexed
or assoc) does not already exist
8/21
----
braces.c
- mkseq: call strvec_dispose before throw_to_top_level if we saw SIGINT
to avoid a memory leak
trap.c
- maybe_set_return_trap: set the RETURN trap to string if it's not
already trapped, in the same way as the debug and error traps
execute_cmd.c
- execute_function: use maybe_set_return_trap to allow functions to set
return traps that persist across calls even if function tracing is
enabled
lib/readline/input.c
- rl_gather_tyi: make sure errno reset to 0 after select call, for
ioctl and read
- rl_gather_tyi: if read returns -1/EIO, return -1
- rl_read_key: if rl_gather_tyi returns -1/EIO, return READERR if in
RL_STATE_READCMD (reading command in readline_internal_char), EOF
if not (like rl_getc). Continue to return '\n' on other errors;
rl_done = 1 in any case. Fix for issue reported by
Lubomir Rintel <lkundrak@v3.sk>
lib/readline/{misc,text,vi_mode}.c
- fix return values from rl_read_key to handle < 0
8/22
----
parse.y
- parsing_redirection: macro that expands to true if the last read
token (always passed as an argument) is a redirection token that
will leave us reading a word that's the target of the redirection
- command_token_position: make sure that even if the parser state
indicates we are reading a simple command (PST_REDIRLIST), we do
not perform alias expansion on a WORD that is part of a redirection,
using parsing_redirection() to do so. Fixes but reported to Red Hat
by Robert Alm Nilsson <rorialni@gmail.com>
https://bugzilla.redhat.com/show_bug.cgi?id=795795
builtins/declare.def
- declare_internal: only print the warning now if the variable is not
already an array or if we are not creating an array with -a or -A,
cuts down the spurious warnings
- declare_internal: even if the rhs of the assignment looks like a
compound array, if we're not assigning to an existing array or we're
not creating an array, make it an array subscript assignment. This
means things like declare a[1]='(foo)' and a[1]='(foo)' behave
identically
builtins/help.def
- wdispcolumn: change use of displen and add new dispchars variable to
deal with locales where each wide character does not take up one
column position. Fix for bug reported by Mingye (Arthur) Wang
<arthur200126@hotmail.com>
8/23
----
sig.c
- sigint_sighandler: if we get a SIGINT while this_shell_builtin ==
wait_builtin, perform the special handling only if wait_intr_flag
is non-zero, don't just use it to set wait_sigint_received. This
makes sure we run bashline_set_event_hook. Fixes bug reported by
isabella parakiss <izaberina@gmail.com>
8/25
----
subst.h
- SD_HISTEXP: new flag for skip_to_delim, indicates we are looking for
the history expansion character (special double quote handling)
- skip_to_delim: handle SD_HISTEXP flag, changes double quote handling
to be similar to history library: don't call skip_double_quote, make
sure single quotes aren't special in double quotes, but continue to
skip over $(), ${}, and other similar constructs
8/27
----
support/bash.pc.in
- new file, pkgconfig template for bash, installed to support nascent
loadable builtins dev environment
examples/loadables/Makefile.inc
- new file, example Makefile with correct definitions for loadable
builtin development
configure.ac
- headersdir: directory where headers get installed to support loadable
builtin development
- examples/loadables/Makefile.inc, support/bash.pc: create
Makefile.in
- INSTALLED_HEADERS, INSTALLED_BUILTINS_HEADERS, INSTALLED_INCFILES,
CREATED_HEADERS: new variables holding names of include files to
install into $(headersdir) for loadable builtin development
- install-headers,install-headers-dirs: new targets to support
installing headers into $(headersdir) and subdirectories for loadable
builtin development
- uninstall-headers: target to uninistall headers in $(headersdir)
- uninstall: call uninstall-headers whether or not install-headers
was done; add uninstall in examples/loadables
- install: add install in examples/loadables
- clean: add clean in examples/loadables
examples/loadables/Makefile.in
- install-supported, install-unsupported: new targets, make install
chooses one based on $(SHOBJ_STATUS)
- install-supported: now cds to the top level build directory and
installs the header files
- install-supported: now installs Makefile.inc to $(loadablesdir) as
an example
- uninstall-supported,uninistall-unsupported: uninstall targets,
make uninstall chooses one based on $(SHOBJ_STATUS)
8/31
----
lib/glob/Makefile.in
- CPPFLAGS: move after ${INCLUDES} so library-specific include paths
take precedence. This is what the other parts of the shell do.
Report from Poor Yorick <org.gnu.lists.bug-bash@pooryorick.com>
builtins/read.def
- reset_alarm: cancel alarm before restoring signal handler to avoid
possible race condition. Report and fix from Oleg Popov
<dev-random@mail.ru>
subst.c
- string_extract_verbatim: if SEPARATORS is "'", don't short-circuit
to string_extract_single_quoted unless the SX_NOCTLESC flag is set.
Callers expect this function to honor CTLESC, even to quote a single
quote. Fixes bug reported by isabella parakiss <izaberina@gmail.com>
and several others
9/2
---
include/chartypes.h
- TOCTRL: handle '?' by special-casing it to 0x7f. Fixes a problem
with $'\c?' reported by Helmut Karlowski <helmut.karlowski@ish.de>
redir.c
- write_here_string: don't word-split the here string document. The
bash documentation has always said this doesn't happen, even though
bash has done so for years, and other shells that implement here-
strings don't perform any word splitting. The practical effect is
that sequences of IFS characters are collapsed to spaces. Fixes
bug reported by Clint Hepner <clint.hepner@gmail.com>
9/3
---
doc/{bash.1,bashref.texi}
- add \? to the list of backslash escapes expanded by $'...' ANSI-C
quoting. It was expanded but not documented
lib/readline/util.c
- _rl_audit_tty: updated from Red Hat patch
lib/readline/readline.c
- HAVE_DECL_AUDIT_USER_TTY: correct #define check
9/13
----
shell.c
- read_from_stdin: make sure value set to 1 appropriately if the shell
is reading from standard input, as Posix seems to specify (?)
lib/readline/kill.c
- _rl_copy_to_kill_ring: don't assume that rl_kill_ring has been
allocated if _rl_last_command_was_kill is non-zero; make sure it's
non-null before indexing into it
9/15
----
variables.c
- initialize_shell_variables: cope with a NULL env pointer. Fixes bug
reported by ziyunfei <446240525@qq.com>
9/16
----
builtins/exec.def
- exec_builtin: if -c is supplied, pass an empty array instead of a NULL
pointer to shell_execve
variables.c
- set_pwd: only believe $PWD if it begins with a slash; try to
canonicalize it and set it to physical path if canonicalization fails.
Reported by ziyunfei <446240525@qq.com>
9/17
----
subst.c
- do_compound_assignment: make sure to dispose of word list generated by
expand_compound_array_assignment; fixes memory leak reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1264101
variables.c
- adjust_shell_level: clamp the value of shell_level at 1000 and reset
there, instead of > 1000, since the itos replacement code doesn't
handle the value 1000. Fixes bug reported by ziyunfei
<446240525@qq.com>
shell.h,parse.y
- save_parser_state,restore_parser_state: now save and restore
redir_stack, short-circuiting if need_here_doc == 0. If we save a
non-zero value for need_here_doc, we have to make sure there is
something valid for gather_here_documents to work on. Fixes bug
reported by Brian Carpenter <brian.carpenter@gmail.com>
9/18
----
array.c
- array_to_assign: use ansic_shouldquote to check whether each element
value contains non-printable characters and use ansic_quote to
generate the value instead of using sh_double_quote unconditionally
assoc.c
- assoc_to_assign: if either the key or the value of an associative array
element contains non-printable characters (ansic_shouldquote returns
true), use ansic_quote to quote them instead of using double quotes
unconditionally
9/19
----
subst.c
- pat_subst: handle REP being NULL. Fixes bug reported by Brian
Carpenter <brian.carpenter@gmail.com>
builtins/evalstring.c
- parse_string: if we get a longjmp to top_level with DISCARD as the
code (in which case we are going to go on), return -DISCARD to our
caller (always xparse_dolparen) after doing our own cleanup instead
of calling jump_to_top_level
parse.y
- xparse_dolparen: if parse_string returns < 0, do the appropriate
cleanup and then jump_to_top_level with the negative of the return
value. This allows us to do the appropriate parser cleanup in
case we're not going to exit the shell. Fixes bug reported by Brian
Carpenter <brian.carpenter@gmail.com>
subst.c
- extract_delimited_string: if a recursive call to one of the extract_
functions or a call to ADVANCE_CHAR leaves i past the end of the
string, cut the loop off at the end of the string. Fixes bug
reported by Brian Carpenter <brian.carpenter@gmail.com>
9/20
----
subst.c
- get_var_and_type: return appropriate values if variable indirection
results in a NULL variable. Fixes bug reported by Brian Carpenter
<brian.carpenter@gmail.com>
lib/readline/history.c
- history_get_time: handle strtol overflows caused by malicious
modifications to timestamps in the history file. Fixes issue
reported by rens@endoria.net
9/21
----
lib/readline/rlconf.h
- ENABLE_AUDIT_TTY_SUPPORT: now undefined (off) by default
9/24
----
jobs.c
- waitchld: if we get a SIGINT while waiting for a child to exit, but the
kernel doesn't interrupt the waitpid(2) call, assume the child caught
SIGINT if it exited for some reason other than SIGINT. Fix suggested
by Stephane Chazelas <stephane.chazelas@gmail.com>
input.c
- make_buffered_stream: use B_TEXT in buffered stream flags instead
of (typo) O_TEXT. Report and fix from Eric Blake <eblake@redhat.com>
9/27
----
execute_cmd.c
- shell_execve: call reset_parser before calling initialize_subshell,
which calls delete_all_aliases. reset_parser wants to free the
pushed string list, which has pointers back into the alias table
(use after free)
- execute_simple_command: if we fork for an async command, make sure
the child process increments shell_level before performing any
word expansions, so $BASH_SUBSHELL is incremented. Fixes issue
reported by ziyunfei <446240525@qq.com>
10/1
----
builtins/kill.def
- kill_builtin: make -L equivalent to -l for compatibility with other (Linux)
versions of kill
doc/{bash.1,bashref.texi}
- kill: document new `-L' option
10/2
----
[bash-4.4-beta frozen]
+13
View File
@@ -529,6 +529,8 @@ po/ja.po f
po/lt.gmo f
po/lt.po f
po/nl.gmo f
po/nb.po f
po/nb.gmo f
po/nl.po f
po/pl.gmo f
po/pl.po f
@@ -609,6 +611,7 @@ doc/rose94.pdf f
doc/aosa-bash.pdf f
#
support/Makefile.in f
support/bash.pc.in f
support/bashversion.c f
support/checkbashisms f 755
support/config.guess f
@@ -654,7 +657,9 @@ examples/complete/complete-examples f
examples/complete/bashcc-1.0.1.tar.gz f
examples/loadables/README f
examples/loadables/template.c f
examples/loadables/loadables.h f
examples/loadables/Makefile.in f
examples/loadables/Makefile.inc.in f
examples/loadables/necho.c f
examples/loadables/hello.c f
examples/loadables/print.c f
@@ -849,6 +854,7 @@ tests/assoc4.sub f
tests/assoc5.sub f
tests/assoc6.sub f
tests/assoc7.sub f
tests/assoc8.sub f
tests/braces.tests f
tests/braces.right f
tests/builtins.tests f
@@ -909,6 +915,7 @@ tests/dollar-at-star2.sub f
tests/dollar-at-star3.sub f
tests/dollar-at-star4.sub f
tests/dollar-at-star5.sub f
tests/dollar-at-star6.sub f
tests/dollar-at1.sub f
tests/dollar-at2.sub f
tests/dollar-at3.sub f
@@ -934,6 +941,7 @@ tests/errors2.sub f
tests/errors3.sub f
tests/errors4.sub f
tests/errors5.sub f
tests/errors6.sub f
tests/execscript f
tests/exec.right f
tests/exec1.sub f 755
@@ -947,6 +955,7 @@ tests/exec8.sub f
tests/exec9.sub f
tests/exec10.sub f
tests/exec11.sub f
tests/exec12.sub f
tests/exp.tests f
tests/exp.right f
tests/exp1.sub f
@@ -956,6 +965,7 @@ tests/exp4.sub f
tests/exp5.sub f
tests/exp6.sub f
tests/exp7.sub f
tests/exp8.sub f
tests/exportfunc.tests f
tests/exportfunc.right f
tests/exportfunc1.sub f
@@ -1001,7 +1011,9 @@ tests/heredoc2.sub f
tests/heredoc3.sub f
tests/herestr.tests f
tests/herestr.right f
tests/herestr1.sub f
tests/histexp.tests f
tests/histexp1.sub f
tests/histexp.right f
tests/history.tests f
tests/history.right f
@@ -1070,6 +1082,7 @@ tests/nquote.tests f
tests/nquote.right f
tests/nquote1.sub f
tests/nquote2.sub f
tests/nquote3.sub f
tests/nquote1.tests f
tests/nquote1.right f
tests/nquote2.tests f
+65 -5
View File
@@ -1,4 +1,4 @@
# Makefile for bash-4.4, version 4.14
# Makefile for bash-4.4, version 4.17
#
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
@@ -42,6 +42,9 @@ includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
loadablesdir = @loadablesdir@
headersdir = @headersdir@
docdir = @docdir@
mandir = @mandir@
@@ -443,6 +446,19 @@ HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \
SOURCES = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS)
# headers in top-level source directory that get installed by install-headers
INSTALLED_HEADERS = shell.h bashjmp.h command.h syntax.h general.h error.h \
variables.h array.h assoc.h arrayfunc.h quit.h dispose_cmd.h \
make_cmd.h subst.h sig.h externs.h builtins.h \
bashtypes.h xmalloc.h config-top.h config-bot.h \
bashintl.h bashansi.h bashjmp.h alias.h hashlib.h \
conftypes.h unwind_prot.h jobs.h siglist.h
INSTALLED_BUILTINS_HEADERS = bashgetopt.h common.h getopt.h
INSTALLED_INCFILES = posixstat.h ansi_stdlib.h filecntl.h posixdir.h \
memalloc.h stdc.h posixjmp.h posixwait.h posixtime.h systimes.h \
unionwait.h maxpath.h shtty.h typemax.h ocache.h chartypes.h gettext.h \
posixstat.h shmbchar.h shmbutil.h stat-time.h
# header files chosen based on running of configure
SIGNAMES_H = @SIGNAMES_H@
@@ -521,7 +537,7 @@ PO_DIR = $(dot)/po/
SIGNAMES_SUPPORT = $(SUPPORT_SRC)mksignames.c
SUPPORT_SRC = $(srcdir)/support/
SDIR = $(dot)/support/
SDIR = $(dot)/support
TESTS_SUPPORT = recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) xcase$(EXEEXT)
CREATED_SUPPORT = signames.h recho$(EXEEXT) zecho$(EXEEXT) printenv$(EXEEXT) \
@@ -536,13 +552,18 @@ CREATED_MAKEFILES = Makefile builtins/Makefile doc/Makefile \
lib/readline/Makefile lib/glob/Makefile \
lib/sh/Makefile lib/tilde/Makefile lib/malloc/Makefile \
lib/termcap/Makefile examples/loadables/Makefile \
examples/loadables/Makefile.inc \
examples/loadables/perl/Makefile support/Makefile \
lib/intl/Makefile po/Makefile po/Makefile.in
CREATED_HEADERS = signames.h config.h pathnames.h version.h y.tab.h \
${DEFDIR}/builtext.h
OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/COMPAT $(srcdir)/NEWS $(srcdir)/POSIX \
$(srcdir)/RBASH $(srcdir)/README
OTHER_INSTALLED_DOCS = CHANGES COMPAT NEWS POSIX RBASH README
LOADABLES_DIR = ${top_builddir}/examples/loadables
# Keep GNU Make from exporting the entire environment for small machines.
.NOEXPORT:
@@ -734,6 +755,9 @@ $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/confi
reconfig: force
sh $(srcdir)/configure -C
loadables:
cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) all
#newversion: mkversion
# $(RM) .build
# ./mkversion -dir $(srcdir) -dist
@@ -774,12 +798,41 @@ install: .made installdirs
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
-( cd $(DEFDIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
install-strip:
$(MAKE) $(MFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
prefix=${prefix} exec_prefix=${exec_prefix} \
DESTDIR=$(DESTDIR) install
install-headers-dirs:
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/builtins
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(headersdir)/include
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
install-headers: install-headers-dirs
@for hf in $(INSTALLED_HEADERS) ; do \
${INSTALL_DATA} $(srcdir)/"$$hf" $(DESTDIR)$(headersdir)/$$hf; \
done
@for hf in $(INSTALLED_INCFILES) ; do \
${INSTALL_DATA} $(BASHINCDIR)/"$$hf" $(DESTDIR)$(headersdir)/include/$$hf; \
done
@for hf in $(INSTALLED_BUILTINS_HEADERS) ; do \
${INSTALL_DATA} $(BUILTIN_SRCDIR)/"$$hf" $(DESTDIR)$(headersdir)/builtins/$$hf; \
done
@for hf in $(CREATED_HEADERS) ; do \
${INSTALL_DATA} $(BUILD_DIR)/"$$hf" $(DESTDIR)$(headersdir)/$$hf; \
done
$(INSTALL_DATA) $(SDIR)/bash.pc $(DESTDIR)$(libdir)/pkgconfig/bash.pc
uninstall-headers:
-( cd $(DESTDIR)$(headersdir) && $(RM) $(INSTALLED_HEADERS) )
-( cd $(DESTDIR)$(headersdir)/include && $(RM) $(INSTALLED_INCFILES) )
-( cd $(DESTDIR)$(headersdir)/builtins && $(RM) $(INSTALLED_BUILTINS_HEADERS) )
-( cd $(DESTDIR)$(headersdir) && $(RM) $(CREATED_HEADERS) )
-( $(RM) $(DESTDIR)$(libdir)/pkgconfig/bash.pc )
uninstall: .made
$(RM) $(DESTDIR)$(bindir)/$(Program) $(DESTDIR)$(bindir)/bashbug
-( cd $(DESTDIR)$(docdir) && ${RM} ${OTHER_INSTALLED_DOCS} )
@@ -788,6 +841,7 @@ uninstall: .made
man3dir=$(man3dir) man3ext=$(man3ext) \
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
.PHONY: basic-clean clean realclean maintainer-clean distclean mostlyclean maybe-clean
@@ -806,6 +860,7 @@ clean: basic-clean
(cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
done
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
$(RM) $(CREATED_SUPPORT)
mostlyclean: basic-clean
@@ -816,6 +871,7 @@ mostlyclean: basic-clean
(cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
done
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
distclean: basic-clean maybe-clean
( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
@@ -825,6 +881,7 @@ distclean: basic-clean maybe-clean
(cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
done
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
$(RM) $(CREATED_CONFIGURE) tags TAGS
$(RM) $(CREATED_SUPPORT) Makefile $(CREATED_MAKEFILES) pathnames.h
@@ -839,6 +896,7 @@ maintainer-clean: basic-clean
(cd $$libdir && test -f Makefile && $(MAKE) $(MFLAGS) $@) ;\
done
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
$(RM) $(CREATED_CONFIGURE) $(CREATED_MAKEFILES)
$(RM) $(CREATED_SUPPORT) Makefile pathnames.h
@@ -871,9 +929,11 @@ symlinks:
dist: force
@echo Bash distributions are created using $(srcdir)/support/mkdist.
@echo Here is a sample of the necessary commands:
@echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${PACKAGE} $(PACKAGE_VERSION)
@echo tar cf $(PACKAGE)-${PACKAGE_VERSION}.tar ${PACKAGE}-$(PACKAGE_VERSION)
@echo gzip $(PACKAGE)-$(PACKAGE_VERSION).tar
@echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${PACKAGE} -t $(PACKAGE_VERSION)
xdist: force
( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
( cd po && $(MAKE) $(MFLAGS) $@ )
depend: depends
+14
View File
@@ -96,6 +96,20 @@ bb. Aliases whose value ends in a shell metacharacter now expand in a way to
allow them to be `pasted' to the next token, which can potentially change
the meaning of a command (e.g., turning `&' into `&&').
cc. `make install' now installs the example loadable builtins and a set of
bash headers to use when developing new loadable builtins.
dd. `enable -f' now attempts to call functions named BUILTIN_builtin_load when
loading BUILTIN, and BUILTIN_builtin_unload when deleting it. This allows
loadable builtins to run initialization and cleanup code.
ee. There is a new BASH_LOADABLES_PATH variable containing a list of directories
where the `enable -f' command looks for shared objects containing loadable
builtins.
ff. The `kill' builtin now has a `-L' option, equivalent to `-l', for compatibility
with Linux standalone versions of kill.
2. New Features in Readline
a. The history truncation code now uses the same error recovery mechansim as
+39 -38
View File
@@ -1,4 +1,3 @@
6.11 Bash POSIX Mode
====================
@@ -62,143 +61,145 @@ The following list is what's changed when 'POSIX mode' is in effect:
14. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
15. Non-interactive shells exit if there is a syntax error in a script
15. Non-interactive shells exit on word expansion errors.
16. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
16. Redirection operators do not perform filename expansion on the
17. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
17. Redirection operators do not perform word splitting on the word in
18. Redirection operators do not perform word splitting on the word in
the redirection.
18. Function names must be valid shell 'name's. That is, they may not
19. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
19. Function names may not be the same as one of the POSIX special
20. Function names may not be the same as one of the POSIX special
builtins.
20. POSIX special builtins are found before shell functions during
21. POSIX special builtins are found before shell functions during
command lookup.
21. Literal tildes that appear as the first character in elements of
22. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
22. The 'time' reserved word may be used by itself as a command. When
23. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
23. When parsing and expanding a ${...} expansion that appears within
24. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
24. The parser does not recognize 'time' as a reserved word if the
25. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
25. If a POSIX special builtin returns an error status, a
26. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
26. A non-interactive shell exits with an error status if a variable
27. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
27. A non-interactive shell exits with an error status if a variable
28. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
28. A non-interactive shell exits with an error status if the
29. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
29. Process substitution is not available.
30. Process substitution is not available.
30. While variable indirection is available, it may not be applied to
31. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
31. Assignment statements preceding POSIX special builtins persist in
32. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
32. Assignment statements preceding shell function calls persist in
33. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
33. The 'export' and 'readonly' builtin commands display their output
34. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
34. The 'trap' builtin displays signal names without the leading
35. The 'trap' builtin displays signal names without the leading
'SIG'.
35. The 'trap' builtin doesn't check the first argument for a possible
36. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
36. The '.' and 'source' builtins do not search the current directory
37. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
37. Subshells spawned to execute command substitutions inherit the
38. Subshells spawned to execute command substitutions inherit the
value of the '-e' option from the parent shell. When not in POSIX
mode, Bash clears the '-e' option in such subshells.
38. Alias expansion is always enabled, even in non-interactive shells.
39. Alias expansion is always enabled, even in non-interactive shells.
39. When the 'alias' builtin displays alias definitions, it does not
40. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
40. When the 'set' builtin is invoked without options, it does not
41. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
41. When the 'set' builtin is invoked without options, it displays
42. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
42. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
43. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
43. The 'pwd' builtin verifies that the value it prints is the same as
44. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
44. When listing the history, the 'fc' builtin does not include an
45. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
45. The default editor used by 'fc' is 'ed'.
46. The default editor used by 'fc' is 'ed'.
46. The 'type' and 'command' builtins will not report a non-executable
47. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
47. The 'vi' editing mode will invoke the 'vi' editor directly when
48. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
48. When the 'xpg_echo' option is enabled, Bash does not attempt to
49. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
49. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
50. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
50. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
51. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
51. The 'read' builtin may be interrupted by a signal for which a trap
52. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
-1
View File
@@ -1,4 +1,3 @@
6.10 The Restricted Shell
=========================
+4 -1
View File
@@ -869,7 +869,10 @@ int quoted;
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
is = inttostr (element_index(ae), indstr, sizeof(indstr));
valstr = element_value (ae) ? sh_double_quote (element_value(ae))
valstr = element_value (ae) ?
(ansic_shouldquote (element_value (ae)) ?
ansic_quote (element_value(ae), 0, (int *)0) :
sh_double_quote (element_value (ae)))
: (char *)NULL;
elen = STRLEN (is) + 8 + STRLEN (valstr);
RESIZE_MALLOCED_BUFFER (result, rlen, (elen + 1), rsize, rsize);
+8 -6
View File
@@ -436,17 +436,19 @@ assoc_to_assign (hash, quoted)
for (i = 0; i < hash->nbuckets; i++)
for (tlist = hash_items (i, hash); tlist; tlist = tlist->next)
{
#if 1
if (sh_contains_shell_metas (tlist->key))
if (ansic_shouldquote (tlist->key))
istr = ansic_quote (tlist->key, 0, (int *)0);
else if (sh_contains_shell_metas (tlist->key))
istr = sh_double_quote (tlist->key);
else if (ALL_ELEMENT_SUB (tlist->key[0]) && tlist->key[1] == '\0')
istr = sh_double_quote (tlist->key);
else
istr = tlist->key;
#else
istr = tlist->key;
#endif
vstr = tlist->data ? sh_double_quote ((char *)tlist->data) : (char *)0;
vstr = tlist->data ? (ansic_shouldquote ((char *)tlist->data) ?
ansic_quote ((char *)tlist->data, 0, (int *)0) :
sh_double_quote ((char *)tlist->data))
: (char *)0;
elen = STRLEN (istr) + 8 + STRLEN (vstr);
RESIZE_MALLOCED_BUFFER (ret, rlen, (elen+1), rsize, rsize);
+16 -3
View File
@@ -226,12 +226,11 @@ bash_history_inhibit_expansion (string, i)
else if (extended_glob && i > 1 && string[i+1] == '(' && member (')', string + i + 2))
return (1);
#endif
#if 0 /* bash-4.4 */
/* Make sure the history expansion should not be skipped by quoting or
command/process substitution. */
else if (t = skip_to_delim (string, 0, hx, SD_NOJMP) > 0 && t > i)
else if ((t = skip_to_delim (string, 0, hx, SD_NOJMP|SD_HISTEXP)) > 0 && t > i)
return (1);
#endif
else
return (0);
}
@@ -317,6 +316,7 @@ bash_clear_history ()
{
clear_history ();
history_lines_this_session = 0;
/* XXX - reset history_lines_read_from_file? */
}
/* Delete and free the history list entry at offset I. */
@@ -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);
+12 -5
View File
@@ -1319,13 +1319,13 @@ find_cmd_start (start)
/* Flags == SD_NOJMP only because we want to skip over command substitutions
in assignment statements. Have to test whether this affects `standalone'
command substitutions as individual words. */
while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP/*|SD_NOSKIPCMD*/)) <= start) &&
while (((s = skip_to_delim (rl_line_buffer, os, COMMAND_SEPARATORS, SD_NOJMP|SD_COMPLETE/*|SD_NOSKIPCMD*/)) <= start) &&
rl_line_buffer[s])
{
/* Handle >| token crudely; treat as > not | */
if (rl_line_buffer[s] == '|' && rl_line_buffer[s-1] == '>')
{
ns = skip_to_delim (rl_line_buffer, s+1, COMMAND_SEPARATORS, SD_NOJMP/*|SD_NOSKIPCMD*/);
ns = skip_to_delim (rl_line_buffer, s+1, COMMAND_SEPARATORS, SD_NOJMP|SD_COMPLETE/*|SD_NOSKIPCMD*/);
if (ns > start || rl_line_buffer[ns] == 0)
return os;
os = ns+1;
@@ -1342,7 +1342,7 @@ find_cmd_end (end)
{
register int e;
e = skip_to_delim (rl_line_buffer, end, COMMAND_SEPARATORS, SD_NOJMP);
e = skip_to_delim (rl_line_buffer, end, COMMAND_SEPARATORS, SD_NOJMP|SD_COMPLETE);
return e;
}
@@ -1358,7 +1358,7 @@ find_cmd_name (start, sp, ep)
;
/* skip until a shell break character */
e = skip_to_delim (rl_line_buffer, s, "()<>;&| \t\n", SD_NOJMP);
e = skip_to_delim (rl_line_buffer, s, "()<>;&| \t\n", SD_NOJMP|SD_COMPLETE);
name = substring (rl_line_buffer, s, e);
@@ -1523,6 +1523,7 @@ attempt_shell_completion (text, start, end)
os = start;
n = 0;
was_assignment = 0;
s = find_cmd_start (os);
e = find_cmd_end (end);
do
@@ -1533,6 +1534,12 @@ attempt_shell_completion (text, start, end)
s1 = s = e1;
break;
}
/* Or past point if point is within an assignment statement */
else if (was_assignment && s > rl_point)
{
s1 = s = e1;
break;
}
/* Skip over assignment statements preceding a command name. If we
don't find a command name at all, we can perform command name
completion. If we find a partial command name, we should perform
@@ -3096,7 +3103,7 @@ directory_exists (dirname)
struct stat sb;
/* First, dequote the directory name */
new_dirname = bash_dequote_filename (dirname, rl_completion_quote_character);
new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
dirlen = STRLEN (new_dirname);
if (new_dirname[dirlen - 1] == '/')
new_dirname[dirlen - 1] = '\0';
+6 -1
View File
@@ -420,7 +420,12 @@ mkseq (start, end, incr, type, width)
do
{
#if defined (SHELL)
QUIT; /* XXX - memory leak here */
if (ISINTERRUPT)
{
strvec_dispose (result);
result = (char **)NULL;
}
QUIT;
#endif
if (type == ST_INT)
result[i++] = t = itos (n);
+2
View File
@@ -45,6 +45,8 @@ includedir = @includedir@
datadir = @datadir@
localedir = @localedir@
loadablesdir = @loadablesdir@
# Support an alternate destination root directory for package building
DESTDIR =
+1
View File
@@ -202,6 +202,7 @@ extern int evalstring __P((char *, const char *, int));
extern void parse_and_execute_cleanup __P((void));
extern int parse_string __P((char *, const char *, int, char **));
extern int should_suppress_fork __P((COMMAND *));
extern void optimize_fork __P((COMMAND *));
/* Functions from evalfile.c */
extern int maybe_execute_file __P((const char *, int));
+1 -1
View File
@@ -654,7 +654,7 @@ print_cmd_completions (list)
$BUILTIN compgen
$DEPENDS_ON PROGRAMMABLE_COMPLETION
$FUNCTION compgen_builtin
$SHORT_DOC compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]
$SHORT_DOC compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]
Display possible completions depending on the options.
Intended to be used from within a shell function generating possible
+13 -6
View File
@@ -289,7 +289,7 @@ declare_internal (list, local_var)
int offset, aflags, wflags;
#if defined (ARRAY_VARS)
int making_array_special, compound_array_assign, simple_array_assign;
int var_exists, array_exists, array_subscript_assignment;
int var_exists, array_exists, creating_array, array_subscript_assignment;
#endif
name = savestring (list->word->word);
@@ -351,7 +351,7 @@ declare_internal (list, local_var)
}
#if defined (ARRAY_VARS)
var_exists = array_exists = 0;
var_exists = array_exists = creating_array = 0;
compound_array_assign = simple_array_assign = 0;
array_subscript_assignment = 0;
subscript_start = (char *)NULL;
@@ -526,6 +526,7 @@ declare_internal (list, local_var)
#if defined (ARRAY_VARS)
var_exists = var != 0;
array_exists = var && (array_p (var) || assoc_p (var));
creating_array = flags_on & (att_array|att_assoc);
#endif
if (var == 0)
@@ -601,9 +602,9 @@ declare_internal (list, local_var)
#if defined (ARRAY_VARS)
/* make declare a[2]=foo as similar to a[2]=foo as possible if
a is already an array or assoc variable. */
if (array_subscript_assignment && array_exists && (flags_on & (att_array|att_assoc)) == 0)
if (array_subscript_assignment && array_exists && creating_array == 0)
simple_array_assign = 1;
else if ((making_array_special || (flags_on & (att_array|att_assoc)) || array_p (var) || assoc_p (var)) && offset)
else if ((making_array_special || creating_array || array_exists) && offset)
{
int vlen;
vlen = STRLEN (value);
@@ -611,8 +612,14 @@ declare_internal (list, local_var)
if (shell_compatibility_level > 43 && (wflags & W_COMPASSIGN) == 0 &&
value[0] == '(' && value[vlen-1] == ')')
{
internal_warning (_("%s: quoted compound array assignment deprecated"), list->word->word);
compound_array_assign = 1;
/* The warning is only printed when using compound assignment
to an array variable that doesn't already exist. We use
creating_array to allow things like
declare -a foo$bar='(abc)' to work. */
if (array_exists == 0 && creating_array == 0)
internal_warning (_("%s: quoted compound array assignment deprecated"), list->word->word);
compound_array_assign = array_exists || creating_array;
simple_array_assign = making_array_special;
}
else if (value[0] == '(' && value[vlen-1] == ')' && (shell_compatibility_level < 44 || (wflags & W_COMPASSIGN)))
compound_array_assign = 1;
+64 -7
View File
@@ -66,6 +66,7 @@ $END
#include "../flags.h"
#include "common.h"
#include "bashgetopt.h"
#include "findcmd.h"
#if defined (PROGRAMMABLE_COMPLETION)
# include "../pcomplete.h"
@@ -92,6 +93,11 @@ static void delete_builtin __P((struct builtin *));
static int local_dlclose __P((void *));
#endif
#define STRUCT_SUFFIX "_struct"
/* for now */
#define LOAD_SUFFIX "_builtin_load"
#define UNLOAD_SUFFIX "_builtin_unload"
static void list_some_builtins __P((int));
static int enable_shell_command __P((char *, int));
@@ -290,9 +296,11 @@ dyn_load_builtin (list, flags, filename)
WORD_LIST *l;
void *handle;
int total, size, new, replaced;
char *struct_name, *name;
int total, size, new, replaced, r;
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);
@@ -301,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 (filename, RTLD_NOW|RTLD_GLOBAL);
handle = dlopen (load_path, RTLD_NOW|RTLD_GLOBAL);
#else
handle = dlopen (filename, RTLD_LAZY);
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);
#else
handle = dlopen (filename, RTLD_LAZY);
#endif /* !_AIX */
if (handle == 0)
@@ -330,7 +359,7 @@ dyn_load_builtin (list, flags, filename)
size = strlen (name);
struct_name = (char *)xmalloc (size + 8);
strcpy (struct_name, name);
strcpy (struct_name + size, "_struct");
strcpy (struct_name + size, STRUCT_SUFFIX);
b = (struct builtin *)dlsym (handle, struct_name);
if (b == 0)
@@ -344,7 +373,22 @@ dyn_load_builtin (list, flags, filename)
continue;
}
free (struct_name);
funcname = xrealloc (struct_name, size + sizeof (LOAD_SUFFIX) + 1);
strcpy (funcname, name);
strcpy (funcname + size, LOAD_SUFFIX);
loadfunc = (sh_load_func_t *)dlsym (handle, funcname);
if (loadfunc)
{
r = (*loadfunc) (name);
if (r == 0)
{
builtin_error (_("load function for %s returns failure (%d): not loaded"), r);
free (funcname);
continue;
}
}
free (funcname);
b->flags &= ~STATIC_BUILTIN;
if (flags & SPECIAL)
@@ -452,7 +496,9 @@ dyn_unload_builtin (name)
{
struct builtin *b;
void *handle;
int ref, i;
char *funcname;
sh_unload_func_t *unloadfunc;
int ref, i, size;
b = builtin_address_internal (name, 1);
if (b == 0)
@@ -473,6 +519,17 @@ dyn_unload_builtin (name)
ref++;
}
/* Call any unload function */
size = strlen (name);
funcname = xmalloc (size + sizeof (UNLOAD_SUFFIX) + 1);
strcpy (funcname, name);
strcpy (funcname + size, UNLOAD_SUFFIX);
unloadfunc = (sh_unload_func_t *)dlsym (handle, funcname);
if (unloadfunc)
(*unloadfunc) (name); /* void function */
free (funcname);
/* Don't remove the shared object unless the reference count of builtins
using it drops to zero. */
if (ref == 1 && local_dlclose (handle) != 0)
+20
View File
@@ -109,6 +109,20 @@ should_suppress_fork (command)
((command->flags & CMD_TIME_PIPELINE) == 0) &&
((command->flags & CMD_INVERT_RETURN) == 0));
}
void
optimize_fork (command)
COMMAND *command;
{
if (command->type == cm_connection &&
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR) &&
should_suppress_fork (command->value.Connection->second))
{
command->value.Connection->second->flags |= CMD_NO_FORK;
command->value.Connection->second->value.Simple->flags |= CMD_NO_FORK;
}
}
/* How to force parse_and_execute () to clean up after itself. */
void
parse_and_execute_cleanup ()
@@ -375,6 +389,8 @@ parse_and_execute (string, from_file, flags)
command->flags |= CMD_NO_FORK;
command->value.Simple->flags |= CMD_NO_FORK;
}
else if (command->type == cm_connection)
optimize_fork (command);
#endif /* ONESHOT */
/* See if this is a candidate for $( <file ). */
@@ -557,10 +573,14 @@ itrace("parse_string: longjmp executed: code = %d", code);
run_unwind_frame (PS_TAG);
/* If we return < 0, the caller (xparse_dolparen) will jump_to_top_level for
us, after doing cleanup */
if (should_jump_to_top_level)
{
if (parse_and_execute_level == 0)
top_level_cleanup ();
if (code == DISCARD)
return -DISCARD;
jump_to_top_level (code);
}
+10 -1
View File
@@ -142,6 +142,7 @@ exec_builtin (list)
#endif /* RESTRICTED_SHELL */
args = strvec_from_word_list (list, 1, 0, (int *)NULL);
env = (char **)0;
/* A command with a slash anywhere in its name is not looked up in $PATH. */
command = absolute_program (args[0]) ? args[0] : search_for_command (args[0], 1);
@@ -193,7 +194,10 @@ exec_builtin (list)
adjust_shell_level (-1);
if (cleanenv)
env = (char **)NULL;
{
env = strvec_create (1);
env[0] = (char *)0;
}
else
{
maybe_make_export_env ();
@@ -210,6 +214,8 @@ exec_builtin (list)
#if defined (JOB_CONTROL)
if (subshell_environment == 0)
end_job_control ();
if (interactive || job_control)
default_tty_job_signals (); /* undo initialize_job_signals */
#endif /* JOB_CONTROL */
exit_value = shell_execve (command, args, env);
@@ -240,6 +246,9 @@ failed_exec:
if (args)
strvec_dispose (args);
if (env && env != export_env)
strvec_dispose (env);
initialize_traps ();
initialize_signals (1);
+26 -14
View File
@@ -374,7 +374,7 @@ dispcolumn (i, buf, bufsize, width, height)
int width, height;
{
int j;
int displen;
int dispcols;
char *helpdoc;
/* first column */
@@ -391,9 +391,9 @@ dispcolumn (i, buf, bufsize, width, height)
return;
}
displen = strlen (buf);
dispcols = strlen (buf);
/* two spaces */
for (j = displen; j < width; j++)
for (j = dispcols; j < width; j++)
putc (' ', stdout);
/* second column */
@@ -416,7 +416,7 @@ wdispcolumn (i, buf, bufsize, width, height)
int width, height;
{
int j;
int displen;
int dispcols, dispchars;
char *helpdoc;
wchar_t *wcstr;
size_t slen, n;
@@ -446,13 +446,18 @@ wdispcolumn (i, buf, bufsize, width, height)
if (wcstr[j] == L'\n' || wcstr[j] == L'\t')
wcstr[j] = L' ';
displen = wcsnwidth (wcstr+1, slen, width - 2) + 1; /* +1 for ' ' or '*' */
/* dispchars == number of characters that will be displayed */
dispchars = wcsnwidth (wcstr+1, slen, width - 2);
/* dispcols == number of columns required to display DISPCHARS */
dispcols = wcswidth (wcstr+1, dispchars) + 1; /* +1 for ' ' or '*' */
wcstr[0] = (shell_builtins[i].flags & BUILTIN_ENABLED) ? L' ' : L'*';
/* This assumes each wide char takes up one column position when displayed */
wcstr[width - 2] = L'>'; /* indicate truncation */
wcstr[width - 1] = L'\0';
if (dispcols >= width-2)
{
wcstr[dispchars] = L'>'; /* indicate truncation */
wcstr[dispchars+1] = L'\0';
}
printf ("%ls", wcstr);
if (((i << 1) >= num_shell_builtins) || (i+height >= num_shell_builtins))
@@ -463,7 +468,7 @@ wdispcolumn (i, buf, bufsize, width, height)
}
/* at least one space */
for (j = displen; j < width; j++)
for (j = dispcols; j < width; j++)
putc (' ', stdout);
/* second column */
@@ -488,13 +493,20 @@ wdispcolumn (i, buf, bufsize, width, height)
if (wcstr[j] == L'\n' || wcstr[j] == L'\t')
wcstr[j] = L' ';
displen = wcsnwidth (wcstr+1, slen, width - 2);
/* dispchars == number of characters that will be displayed */
dispchars = wcsnwidth (wcstr+1, slen, width - 2);
dispcols = wcswidth (wcstr+1, dispchars) + 1; /* +1 for ' ' or '*' */
wcstr[0] = (shell_builtins[i+height].flags & BUILTIN_ENABLED) ? L' ' : L'*';
/* This assumes each wide char takes up one column position when displayed */
wcstr[width - 3] = L'>'; /* indicate truncation */
wcstr[width - 2] = L'\0';
/* The dispchars-1 is there for terminals that behave strangely when you
have \n in the nth column for terminal width n; this is what bash-4.3
did. */
if (dispcols >= width - 2)
{
wcstr[dispchars-1] = L'>'; /* indicate truncation */
wcstr[dispchars] = L'\0';
}
printf ("%ls\n", wcstr);
+3 -2
View File
@@ -1,7 +1,7 @@
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
Copyright (C) 1987-2010 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -34,6 +34,7 @@ Options:
-n sig SIG is a signal number
-l list the signal names; if arguments follow `-l' they are
assumed to be signal numbers for which names should be listed
-L synonym for -l
Kill is a shell builtin for two reasons: it allows job IDs to be used
instead of process IDs, and allows processes to be killed if the limit
@@ -108,7 +109,7 @@ kill_builtin (list)
{
word = list->word->word;
if (ISOPTION (word, 'l'))
if (ISOPTION (word, 'l') || ISOPTION (word, 'L'))
{
listing++;
list = list->next;
+2 -1
View File
@@ -165,8 +165,9 @@ sigalrm (s)
static void
reset_alarm ()
{
set_signal_handler (SIGALRM, old_alrm);
/* Cancel alarm before restoring signal handler. */
falarm (0, 0);
set_signal_handler (SIGALRM, old_alrm);
}
/* Read the value of the shell variables whose names follow.
+2
View File
@@ -932,6 +932,8 @@ unset_builtin (list)
if (tem == -1 && unset_function == 0 && unset_variable == 0)
tem = unbind_func (name);
name = list->word->word; /* reset above for namerefs */
/* SUSv3, POSIX.1-2001 say: ``Unsetting a variable or function that
was not previously set shall not be considered an error.'' */
+6 -1
View File
@@ -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);
+4
View File
@@ -76,6 +76,7 @@ extern int wait_signal_received;
extern int last_command_exit_signal;
procenv_t wait_intr_buf;
int wait_intr_flag;
/* Wait for the pid in LIST to stop or die. If no arguments are given, then
wait for all of the active background processes of the shell and return
@@ -87,6 +88,7 @@ procenv_t wait_intr_buf;
{ \
interrupt_immediately = old_interrupt_immediately;\
wait_signal_received = 0; \
wait_intr_flag = 0; \
return (s);\
} \
while (0)
@@ -131,7 +133,9 @@ wait_builtin (list)
We handle SIGINT here; it's the only one that needs to be treated
specially (I think), since it's handled specially in {no,}jobs.c. */
wait_intr_flag = 1;
code = setjmp_sigs (wait_intr_buf);
if (code)
{
last_command_exit_signal = wait_signal_received;
+1
View File
@@ -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) */
+3
View File
@@ -946,6 +946,9 @@
/* Define if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define if you have the <libaudit.h> header file. */
#undef HAVE_LIBAUDIT_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
Vendored
+38 -12
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 4.4, version 4.071.
# From configure.ac for Bash 4.4, version 4.073.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-alpha.
# Generated by GNU Autoconf 2.69 for bash 4.4-beta.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='4.4-alpha'
PACKAGE_STRING='bash 4.4-alpha'
PACKAGE_VERSION='4.4-beta'
PACKAGE_STRING='bash 4.4-beta'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -635,6 +635,8 @@ DEBUG
RELSTATUS
BASHVERS
ARFLAGS
headersdir
loadablesdir
BUILD_DIR
incdir
PROFILE_FLAGS
@@ -1394,7 +1396,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 4.4-alpha to adapt to many kinds of systems.
\`configure' configures bash 4.4-beta to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1459,7 +1461,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 4.4-alpha:";;
short | recursive ) echo "Configuration of bash 4.4-beta:";;
esac
cat <<\_ACEOF
@@ -1654,7 +1656,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 4.4-alpha
bash configure 4.4-beta
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2363,7 +2365,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 4.4-alpha, which was
It was created by bash $as_me 4.4-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2757,7 +2759,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=4.4
RELSTATUS=alpha
RELSTATUS=beta
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -10155,6 +10157,18 @@ fi
for ac_header in libaudit.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default"
if test "x$ac_cv_header_libaudit_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBAUDIT_H 1
_ACEOF
fi
done
ac_fn_c_check_decl "$LINENO" "AUDIT_USER_TTY" "ac_cv_have_decl_AUDIT_USER_TTY" "#include <linux/audit.h>
"
if test "x$ac_cv_have_decl_AUDIT_USER_TTY" = xyes; then :
@@ -16116,6 +16130,16 @@ fi
# directory where we install dynamically loadable builtins
if test -z "$loadablesdir"; then
loadablesdir='${libdir}/bash'
fi
if test -z "$headersdir"; then
headersdir='$(includedir)/$(PACKAGE_NAME)'
fi
@@ -16137,7 +16161,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/perl/Makefile"
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_commands="$ac_config_commands default"
@@ -16648,7 +16672,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 4.4-alpha, which was
This file was extended by bash $as_me 4.4-beta, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16714,7 +16738,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bash config.status 4.4-alpha
bash config.status 4.4-beta
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -16862,7 +16886,9 @@ do
"support/Makefile") CONFIG_FILES="$CONFIG_FILES support/Makefile" ;;
"po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
"examples/loadables/Makefile") CONFIG_FILES="$CONFIG_FILES examples/loadables/Makefile" ;;
"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" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+16 -3
View File
@@ -21,10 +21,10 @@ 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.073])dnl
define(bashvers, 4.4)
define(relstatus, alpha)
define(relstatus, beta)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -798,6 +798,7 @@ AC_REPLACE_FUNCS(dprintf)
AC_REPLACE_FUNCS(strchrnul)
AC_REPLACE_FUNCS(strdup)
AC_CHECK_HEADERS(libaudit.h)
AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
AC_CHECK_DECLS([confstr])
@@ -1191,6 +1192,16 @@ 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)
if test -z "$headersdir"; then
headersdir='$(includedir)/$(PACKAGE_NAME)'
fi
AC_SUBST(headersdir)
AC_SUBST(YACC)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
@@ -1216,7 +1227,9 @@ AC_OUTPUT([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/perl/Makefile],
examples/loadables/Makefile examples/loadables/Makefile.inc \
examples/loadables/perl/Makefile \
support/bash.pc],
[
# Makefile uses this timestamp file to record whether config.h is up to date.
echo timestamp > stamp-h
+1 -1
View File
@@ -328,4 +328,4 @@ rbash: bashref.texi
cmp -s RBASH ../RBASH || mv RBASH ../RBASH
$(RM) RBASH
xdist: pdf inst posix rbash
xdist: everything inst posix rbash
+541 -524
View File
File diff suppressed because it is too large Load Diff
+40 -15
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Jun 11 16:26:00 EDT 2015
.\" Last Change: Fri Oct 2 07:15:57 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 June 11" "GNU Bash 4.4"
.TH BASH 1 "2015 October 2" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -477,8 +477,8 @@ A character that, when unquoted, separates words. One of the following:
.br
.RS
.PP
.if t \fB| & ; ( ) < > space tab\fP
.if n \fB| & ; ( ) < > space tab\fP
.if t \fB| & ; ( ) < > space tab newline\fP
.if n \fB| & ; ( ) < > space tab newline\fP
.RE
.PP
.TP
@@ -1135,6 +1135,9 @@ single quote
.B \e\(dq
double quote
.TP
.B \e?
question mark
.TP
.B \e\fInnn\fP
the eight-bit character whose value is the octal value \fInnn\fP
(one to three digits)
@@ -1520,6 +1523,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 +1690,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 +1713,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
@@ -3161,7 +3170,8 @@ The expansion is a string that is the result of expanding the value of
\fIparameter\fP as if it were a prompt string (see \fBPROMPTING\fP below).
.TP
.B A
The expansion is a string in the form of a \fBdeclare\fP command that, if
The expansion is a string in the form of
an assignment statement or \fBdeclare\fP command that, if
evaluated, will recreate \fIparameter\fP with its attributes and value.
.TP
.B a
@@ -6698,7 +6708,9 @@ quotes are considered one word.
History expansions are introduced by the appearance of the
history expansion character, which is \^\fB!\fP\^ by default.
Only backslash (\^\fB\e\fP\^) and single quotes can quote
the history expansion character.
the history expansion character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
.PP
Several characters inhibit history expansion if found immediately
following the history expansion character, even if it is unquoted:
@@ -6944,7 +6956,8 @@ accepts
to signify the end of the options.
The \fB:\fP, \fBtrue\fP, \fBfalse\fP, and \fBtest\fP builtins
do not accept options and do not treat \fB\-\-\fP specially.
The \fBexit\fP, \fBlogout\fP, \fBbreak\fP, \fBcontinue\fP, \fBlet\fP,
The \fBexit\fP, \fBlogout\fP, \fBreturn\fP,
\fBbreak\fP, \fBcontinue\fP, \fBlet\fP,
and \fBshift\fP builtins accept and process arguments beginning with
\fB\-\fP without requiring \fB\-\-\fP.
Other builtins that accept arguments but are not specified as accepting
@@ -7588,8 +7601,8 @@ The
option inhibits the display of function definitions; only the
function name and attributes are printed.
If the \fBextdebug\fP shell option is enabled using \fBshopt\fP,
the source file name and line number where the function is defined
are displayed as well. The
the source file name and line number where each \fIname\fP
is defined are displayed as well. The
.B \-F
option implies
.BR \-f .
@@ -7699,6 +7712,7 @@ Directories are added to the list with the
command; the
.B popd
command removes entries from the list.
The current directory is always the first directory in the stack.
.RS
.PD 0
.TP
@@ -8390,7 +8404,7 @@ returning its exit status.
\fBkill\fP [\fB\-s\fP \fIsigspec\fP | \fB\-n\fP \fIsignum\fP | \fB\-\fP\fIsigspec\fP] [\fIpid\fP | \fIjobspec\fP] ...
.PD 0
.TP
\fBkill\fP \fB\-l\fP [\fIsigspec\fP | \fIexit_status\fP]
\fBkill\fP \fB\-l\fP|\fB\-L\fP [\fIsigspec\fP | \fIexit_status\fP]
.PD
Send the signal named by
.I sigspec
@@ -8427,6 +8441,9 @@ The \fIexit_status\fP argument to
.B \-l
is a number specifying either a signal number or the exit status of
a process terminated by a signal.
The
.B \-L
option is equivalent to \fB\-l\fP.
.B kill
returns true if at least one signal was successfully sent, or false
if an error occurs or an invalid option is encountered.
@@ -8655,15 +8672,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
@@ -9462,6 +9479,14 @@ If set,
does not process the replacement string in the pattern substitution word
expansion using quote removal.
.TP 8
.B compat43
If set,
.B bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to \fBdeclare\fP, and makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
.TP 8
.B complete_fullquote
If set,
.B bash
+46 -15
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2015 June 11<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2015 October 2<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -622,7 +622,7 @@ A character that, when unquoted, separates words. One of the following:
<DL COMPACT><DT><DD>
<P>
<B>| &amp; ; ( ) &lt; &gt; space tab</B>
<B>| &amp; ; ( ) &lt; &gt; space tab newline</B>
</DL>
@@ -1453,6 +1453,10 @@ single quote
<DD>
double quote
<DT><B>\?</B>
<DD>
question mark
<DT><B>\</B><I>nnn</I>
<DD>
@@ -1950,6 +1954,14 @@ Use
</FONT>
to obtain the current line number.
<DT><B>BASH_LOADABLES_PATH</B>
<DD>
A colon-separated list of directories in which the shell looks for
dynamically loadable builtins specified by the
<B>enable</B>
command.
<DT><B>BASH_REMATCH</B>
<DD>
@@ -2148,7 +2160,7 @@ Assignments to
<FONT SIZE=-1><B>FUNCNAME</B>
</FONT>
have no effect and return an error status.
have no effect.
If
<FONT SIZE=-1><B>FUNCNAME</B>
@@ -2175,7 +2187,7 @@ Assignments to
<FONT SIZE=-1><B>GROUPS</B>
</FONT>
have no effect and return an error status.
have no effect.
If
<FONT SIZE=-1><B>GROUPS</B>
@@ -3970,7 +3982,8 @@ The expansion is a string that is the result of expanding the value of
<DT><B>A</B>
<DD>
The expansion is a string in the form of a <B>declare</B> command that, if
The expansion is a string in the form of
an assignment statement or <B>declare</B> command that, if
evaluated, will recreate <I>parameter</I> with its attributes and value.
<DT><B>a</B>
@@ -8576,7 +8589,9 @@ quotes are considered one word.
History expansions are introduced by the appearance of the
history expansion character, which is <B>!</B> by default.
Only backslash (<B>\</B>) and single quotes can quote
the history expansion character.
the history expansion character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
<P>
Several characters inhibit history expansion if found immediately
@@ -8919,7 +8934,8 @@ accepts
to signify the end of the options.
The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
do not accept options and do not treat <B>--</B> specially.
The <B>exit</B>, <B>logout</B>, <B>break</B>, <B>continue</B>, <B>let</B>,
The <B>exit</B>, <B>logout</B>, <B>return</B>,
<B>break</B>, <B>continue</B>, <B>let</B>,
and <B>shift</B> builtins accept and process arguments beginning with
<B>-</B> without requiring <B>--</B>.
Other builtins that accept arguments but are not specified as accepting
@@ -9679,8 +9695,8 @@ The
option inhibits the display of function definitions; only the
function name and attributes are printed.
If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
the source file name and line number where the function is defined
are displayed as well. The
the source file name and line number where each <I>name</I>
is defined are displayed as well. The
<B>-F</B>
option implies
@@ -9817,6 +9833,7 @@ command; the
<B>popd</B>
command removes entries from the list.
The current directory is always the first directory in the stack.
<DL COMPACT><DT><DD>
<DL COMPACT>
@@ -10674,7 +10691,7 @@ returning its exit status.
<DT><B>kill</B> [<B>-s</B> <I>sigspec</I> | <B>-n</B> <I>signum</I> | <B>-</B><I>sigspec</I>] [<I>pid</I> | <I>jobspec</I>] ...<DD>
<DT><B>kill</B> <B>-l</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
<DT><B>kill</B> <B>-l</B>|<B>-L</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
Send the signal named by
<I>sigspec</I>
@@ -10724,6 +10741,10 @@ The <I>exit_status</I> argument to
is a number specifying either a signal number or the exit status of
a process terminated by a signal.
The
<B>-L</B>
option is equivalent to <B>-l</B>.
<B>kill</B>
returns true if at least one signal was successfully sent, or false
@@ -11001,7 +11022,7 @@ The return value is zero on success, non-zero on failure.
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, <B>pushd</B> exchanges the top two directories
and returns 0, unless the directory stack is empty.
Arguments, if supplied, have the following meanings:
<DL COMPACT><DT><DD>
@@ -11010,8 +11031,8 @@ Arguments, if supplied, have the following meanings:
<DT><B>-n</B>
<DD>
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.
<DT><B>+</B><I>n</I><DD>
Rotates the stack so that the <I>n</I>th directory
(counting from the left of the list shown by
@@ -12031,6 +12052,16 @@ If set,
does not process the replacement string in the pattern substitution word
expansion using quote removal.
<DT><B>compat43</B>
<DD>
If set,
<B>bash</B>
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to <B>declare</B>, and makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
<DT><B>complete_fullquote</B>
<DD>
@@ -13377,7 +13408,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2015 June 11<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2015 October 2<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -13483,6 +13514,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 10 July 2015 10:23:17 EDT
Time: 02 October 2015 07:16:35 EDT
</BODY>
</HTML>
BIN
View File
Binary file not shown.
+4469 -4441
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+932 -898
View File
File diff suppressed because it is too large Load Diff
+309 -288
View File
@@ -1,10 +1,10 @@
This is bashref.info, produced by makeinfo version 5.2 from
This is bashref.info, produced by makeinfo version 6.0 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 11 June 2015).
Bash shell (version 4.4, 2 October 2015).
This is Edition 4.4, last updated 11 June 2015, of 'The GNU Bash
This is Edition 4.4, last updated 2 October 2015, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
Copyright (C) 1988-2014 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 4.4, 11 June 2015). The Bash home page is
Bash shell (version 4.4, 2 October 2015). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 4.4, last updated 11 June 2015, of 'The GNU Bash
This is Edition 4.4, last updated 2 October 2015, of 'The GNU Bash
Reference Manual', for 'Bash', Version 4.4.
Bash contains features that appear in other popular shells, and some
@@ -199,8 +199,8 @@ These definitions are used throughout the remainder of this manual.
'metacharacter'
A character that, when unquoted, separates words. A metacharacter
is a 'blank' or one of the following characters: '|', '&', ';',
'(', ')', '<', or '>'.
is a 'space', 'tab', 'newline', or one of the following characters:
'|', '&', ';', '(', ')', '<', or '>'.
'name'
A 'word' consisting solely of letters, numbers, and underscores,
@@ -445,6 +445,8 @@ decoded as follows:
single quote
'\"'
double quote
'\?'
question mark
'\NNN'
the eight-bit character whose value is the octal value NNN (one to
three digits)
@@ -1878,9 +1880,9 @@ omitted, the operator tests only for existence.
value of PARAMETER as if it were a prompt string (*note
Controlling the Prompt::).
'A'
The expansion is a string in the form of a 'declare' command
that, if evaluated, will recreate PARAMETER with its
attributes and value.
The expansion is a string in the form of an assignment
statement or 'declare' command that, if evaluated, will
recreate PARAMETER with its attributes and value.
'a'
The expansion is a string consisting of flag values
representing PARAMETER's attributes.
@@ -2765,11 +2767,11 @@ Completion Builtins::).
Unless otherwise noted, each builtin command documented as accepting
options preceded by '-' accepts '--' to signify the end of the options.
The ':', 'true', 'false', and 'test' builtins do not accept options and
do not treat '--' specially. The 'exit', 'logout', 'break', 'continue',
'let', and 'shift' builtins accept and process arguments beginning with
'-' without requiring '--'. Other builtins that accept arguments but
are not specified as accepting options interpret arguments beginning
with '-' as invalid options and require '--' to prevent this
do not treat '--' specially. The 'exit', 'logout', 'return', 'break',
'continue', 'let', and 'shift' builtins accept and process arguments
beginning with '-' without requiring '--'. Other builtins that accept
arguments but are not specified as accepting options interpret arguments
beginning with '-' as invalid options and require '--' to prevent this
interpretation.

@@ -3368,8 +3370,8 @@ standard.
The '-F' option inhibits the display of function definitions; only
the function name and attributes are printed. If the 'extdebug'
shell option is enabled using 'shopt' (*note The Shopt Builtin::),
the source file name and line number where the function is defined
are displayed as well. '-F' implies '-f'.
the source file name and line number where each NAME is defined are
displayed as well. '-F' implies '-f'.
The '-g' option forces variables to be created or modified at the
global scope, even when 'declare' is executed in a shell function.
@@ -4324,6 +4326,13 @@ This builtin allows you to change additional shell optional behavior.
If set, Bash does not process the replacement string in the
pattern substitution word expansion using quote removal.
'compat43'
If set, Bash does not print a warning message if an attempt is
made to use a quoted compound array assignment as an argument
to 'declare', and makes word expansion errors non-fatal errors
that cause the current command to fail (the default behavior
is to make them fatal errors that cause the shell to exit).
'complete_fullquote'
If set, Bash quotes all shell metacharacters in filenames and
directory names when performing completion. If not set, Bash
@@ -4737,6 +4746,10 @@ Variables::).
'${BASH_LINENO[$i-1]}' if referenced within another shell
function). Use 'LINENO' to obtain the current line number.
'BASH_LOADABLES_PATH'
A colon-separated list of directories in which the shell looks for
dynamically loadable builtins specified by the 'enable' command.
'BASH_REMATCH'
An array variable whose members are assigned by the '=~' binary
operator to the '[[' conditional command (*note Conditional
@@ -4912,9 +4925,8 @@ Variables::).
the name of any currently-executing shell function. The
bottom-most element (the one with the highest index) is '"main"'.
This variable exists only when a shell function is executing.
Assignments to 'FUNCNAME' have no effect and return an error
status. If 'FUNCNAME' is unset, it loses its special properties,
even if it is subsequently reset.
Assignments to 'FUNCNAME' have no effect. If 'FUNCNAME' is unset,
it loses its special properties, even if it is subsequently reset.
This variable can be used with 'BASH_LINENO' and 'BASH_SOURCE'.
Each element of 'FUNCNAME' has corresponding elements in
@@ -4937,9 +4949,9 @@ Variables::).
'GROUPS'
An array variable containing the list of groups of which the
current user is a member. Assignments to 'GROUPS' have no effect
and return an error status. If 'GROUPS' is unset, it loses its
special properties, even if it is subsequently reset.
current user is a member. Assignments to 'GROUPS' have no effect.
If 'GROUPS' is unset, it loses its special properties, even if it
is subsequently reset.
'histchars'
Up to three characters which control history expansion, quick
@@ -6083,7 +6095,8 @@ The directory stack is a list of recently-visited directories. The
'pushd' builtin adds directories to the stack as it changes the current
directory, and the 'popd' builtin removes specified directories from the
stack and changes the current directory to the directory removed. The
'dirs' builtin displays the contents of the directory stack.
'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 as the value of
the 'DIRSTACK' shell variable.
@@ -6099,7 +6112,8 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
Display the list of currently remembered directories. Directories
are added to the list with the 'pushd' command; the 'popd' command
removes directories from the list.
removes directories from the list. The current directory is always
the first directory in the stack.
'-c'
Clears the directory stack by deleting all of the elements.
@@ -6124,12 +6138,10 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
'popd'
popd [-n] [+N | -N]
Remove the top entry from the directory stack, and 'cd' to the new
top directory. When no arguments are given, 'popd' removes the top
directory from the stack and performs a 'cd' to the new top
directory. The elements are numbered from 0 starting at the first
directory listed with 'dirs'; that is, 'popd' is equivalent to
'popd +0'.
When no arguments are given, 'popd' removes the top directory from
the stack and performs a 'cd' to the new top directory. The
elements are numbered from 0 starting at the first directory listed
with 'dirs'; that is, 'popd' is equivalent to 'popd +0'.
'-n'
Suppresses the normal change of directory when removing
@@ -6147,11 +6159,11 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
Save the current directory on the top of the directory stack and
then 'cd' to DIR. With no arguments, 'pushd' exchanges the top two
directories.
directories and makes the new top the current directory.
'-n'
Suppresses the normal change of directory when adding
directories to the stack, so that only the stack is
Suppresses the normal change of directory when rotating or
adding directories to the stack, so that only the stack is
manipulated.
'+N'
Brings the Nth directory (counting from the left of the list
@@ -6162,9 +6174,9 @@ File: bashref.info, Node: Directory Stack Builtins, Up: The Directory Stack
printed by 'dirs', starting with zero) to the top of the list
by rotating the stack.
'DIR'
Makes the current working directory be the top of the stack,
making it the new current directory as if it had been supplied
as an argument to the 'cd' builtin.
Makes DIR be the top of the stack, making it the new current
directory as if it had been supplied as an argument to the
'cd' builtin.

File: bashref.info, Node: Controlling the Prompt, Next: The Restricted Shell, Prev: The Directory Stack, Up: Bash Features
@@ -6356,143 +6368,145 @@ startup files.
14. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
15. Non-interactive shells exit if there is a syntax error in a script
15. Non-interactive shells exit on word expansion errors.
16. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
16. Redirection operators do not perform filename expansion on the
17. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
17. Redirection operators do not perform word splitting on the word in
18. Redirection operators do not perform word splitting on the word in
the redirection.
18. Function names must be valid shell 'name's. That is, they may not
19. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
19. Function names may not be the same as one of the POSIX special
20. Function names may not be the same as one of the POSIX special
builtins.
20. POSIX special builtins are found before shell functions during
21. POSIX special builtins are found before shell functions during
command lookup.
21. Literal tildes that appear as the first character in elements of
22. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
22. The 'time' reserved word may be used by itself as a command. When
23. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
23. When parsing and expanding a ${...} expansion that appears within
24. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
24. The parser does not recognize 'time' as a reserved word if the
25. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
25. If a POSIX special builtin returns an error status, a
26. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
26. A non-interactive shell exits with an error status if a variable
27. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
27. A non-interactive shell exits with an error status if a variable
28. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command.
28. A non-interactive shell exits with an error status if the
29. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
29. Process substitution is not available.
30. Process substitution is not available.
30. While variable indirection is available, it may not be applied to
31. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
31. Assignment statements preceding POSIX special builtins persist in
32. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
32. Assignment statements preceding shell function calls persist in
33. Assignment statements preceding shell function calls persist in
the shell environment after the function returns, as if a POSIX
special builtin command had been executed.
33. The 'export' and 'readonly' builtin commands display their output
34. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
34. The 'trap' builtin displays signal names without the leading
35. The 'trap' builtin displays signal names without the leading
'SIG'.
35. The 'trap' builtin doesn't check the first argument for a possible
36. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
36. The '.' and 'source' builtins do not search the current directory
37. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
37. Subshells spawned to execute command substitutions inherit the
38. Subshells spawned to execute command substitutions inherit the
value of the '-e' option from the parent shell. When not in POSIX
mode, Bash clears the '-e' option in such subshells.
38. Alias expansion is always enabled, even in non-interactive shells.
39. Alias expansion is always enabled, even in non-interactive shells.
39. When the 'alias' builtin displays alias definitions, it does not
40. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
40. When the 'set' builtin is invoked without options, it does not
41. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
41. When the 'set' builtin is invoked without options, it displays
42. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
42. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
43. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to PHYSICAL mode.
43. The 'pwd' builtin verifies that the value it prints is the same as
44. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
44. When listing the history, the 'fc' builtin does not include an
45. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
45. The default editor used by 'fc' is 'ed'.
46. The default editor used by 'fc' is 'ed'.
46. The 'type' and 'command' builtins will not report a non-executable
47. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
47. The 'vi' editing mode will invoke the 'vi' editor directly when
48. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
48. When the 'xpg_echo' option is enabled, Bash does not attempt to
49. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
49. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
50. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
50. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
51. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
51. The 'read' builtin may be interrupted by a signal for which a trap
52. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
@@ -6674,7 +6688,7 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables,
'kill'
kill [-s SIGSPEC] [-n SIGNUM] [-SIGSPEC] JOBSPEC or PID
kill -l [EXIT_STATUS]
kill -l|-L [EXIT_STATUS]
Send a signal specified by SIGSPEC or SIGNUM to the process named
by job specification JOBSPEC or process ID PID. SIGSPEC is either
@@ -6685,9 +6699,10 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables,
'-l' is given, the names of the signals corresponding to the
arguments are listed, and the return status is zero. EXIT_STATUS
is a number specifying a signal number or the exit status of a
process terminated by a signal. The return status is zero if at
least one signal was successfully sent, or non-zero if an error
occurs or an invalid option is encountered.
process terminated by a signal. The '-L' option is equivalent to
'-l'. The return status is zero if at least one signal was
successfully sent, or non-zero if an error occurs or an invalid
option is encountered.
'wait'
wait [-n] [JOBSPEC or PID ...]
@@ -8962,6 +8977,9 @@ input stream, making it easy to repeat commands, insert the arguments to
a previous command into the current input line, or fix errors in
previous commands quickly.
History expansion is performed immediately after a complete line is
read, before the shell breaks it into words.
History expansion takes place in two parts. The first is to
determine which line from the history list should be used during
substitution. The second is to select portions of that line for
@@ -8972,7 +8990,9 @@ selected words. The line is broken into words in the same fashion that
Bash does, so that several words surrounded by quotes are considered one
word. History expansions are introduced by the appearance of the
history expansion character, which is '!' by default. Only '\' and '''
may be used to escape the history expansion character.
may be used to escape the history expansion character, but the history
expansion character is also treated as quoted if it immediately precedes
the closing double quote in a double-quoted string.
Several shell options settable with the 'shopt' builtin (*note Bash
Builtins::) may be used to tailor the behavior of history expansion. If
@@ -10563,7 +10583,7 @@ D.1 Index of Shell Builtin Commands
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 88)
(line 89)
* echo: Bash Builtins. (line 244)
* enable: Bash Builtins. (line 293)
* eval: Bourne Shell Builtins.
@@ -10594,10 +10614,10 @@ D.1 Index of Shell Builtin Commands
* logout: Bash Builtins. (line 363)
* mapfile: Bash Builtins. (line 368)
* popd: Directory Stack Builtins.
(line 34)
(line 35)
* printf: Bash Builtins. (line 413)
* pushd: Directory Stack Builtins.
(line 54)
(line 53)
* pwd: Bourne Shell Builtins.
(line 205)
* read: Bash Builtins. (line 458)
@@ -10612,7 +10632,7 @@ D.1 Index of Shell Builtin Commands
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 557)
* suspend: Job Control Builtins.
(line 100)
(line 101)
* test: Bourne Shell Builtins.
(line 268)
* times: Bourne Shell Builtins.
@@ -10628,7 +10648,7 @@ D.1 Index of Shell Builtin Commands
* unset: Bourne Shell Builtins.
(line 416)
* wait: Job Control Builtins.
(line 75)
(line 76)

File: bashref.info, Node: Reserved Word Index, Next: Variable Index, Prev: Builtin Index, Up: Indexes
@@ -10713,12 +10733,13 @@ D.3 Parameter and Variable Index
* BASH_ENV: Bash Variables. (line 84)
* BASH_EXECUTION_STRING: Bash Variables. (line 90)
* BASH_LINENO: Bash Variables. (line 93)
* BASH_REMATCH: Bash Variables. (line 101)
* BASH_SOURCE: Bash Variables. (line 109)
* BASH_SUBSHELL: Bash Variables. (line 116)
* BASH_VERSINFO: Bash Variables. (line 121)
* BASH_VERSION: Bash Variables. (line 144)
* BASH_XTRACEFD: Bash Variables. (line 147)
* BASH_LOADABLES_PATH: Bash Variables. (line 101)
* BASH_REMATCH: Bash Variables. (line 105)
* BASH_SOURCE: Bash Variables. (line 113)
* BASH_SUBSHELL: Bash Variables. (line 120)
* BASH_VERSINFO: Bash Variables. (line 125)
* BASH_VERSION: Bash Variables. (line 148)
* BASH_XTRACEFD: Bash Variables. (line 151)
* bell-style: Readline Init File Syntax.
(line 38)
* bind-tty-special-chars: Readline Init File Syntax.
@@ -10727,12 +10748,12 @@ D.3 Parameter and Variable Index
(line 50)
* CDPATH: Bourne Shell Variables.
(line 9)
* CHILD_MAX: Bash Variables. (line 158)
* CHILD_MAX: Bash Variables. (line 162)
* colored-completion-prefix: Readline Init File Syntax.
(line 55)
* colored-stats: Readline Init File Syntax.
(line 62)
* COLUMNS: Bash Variables. (line 165)
* COLUMNS: Bash Variables. (line 169)
* comment-begin: Readline Init File Syntax.
(line 68)
* completion-display-width: Readline Init File Syntax.
@@ -10745,87 +10766,87 @@ D.3 Parameter and Variable Index
(line 91)
* completion-query-items: Readline Init File Syntax.
(line 98)
* COMPREPLY: Bash Variables. (line 217)
* COMP_CWORD: Bash Variables. (line 171)
* COMP_KEY: Bash Variables. (line 200)
* COMP_LINE: Bash Variables. (line 177)
* COMP_POINT: Bash Variables. (line 182)
* COMP_TYPE: Bash Variables. (line 190)
* COMP_WORDBREAKS: Bash Variables. (line 204)
* COMP_WORDS: Bash Variables. (line 210)
* COMPREPLY: Bash Variables. (line 221)
* COMP_CWORD: Bash Variables. (line 175)
* COMP_KEY: Bash Variables. (line 204)
* COMP_LINE: Bash Variables. (line 181)
* COMP_POINT: Bash Variables. (line 186)
* COMP_TYPE: Bash Variables. (line 194)
* COMP_WORDBREAKS: Bash Variables. (line 208)
* COMP_WORDS: Bash Variables. (line 214)
* convert-meta: Readline Init File Syntax.
(line 108)
* COPROC: Bash Variables. (line 223)
* DIRSTACK: Bash Variables. (line 227)
* COPROC: Bash Variables. (line 227)
* DIRSTACK: Bash Variables. (line 231)
* disable-completion: Readline Init File Syntax.
(line 114)
* echo-control-characters: Readline Init File Syntax.
(line 135)
* editing-mode: Readline Init File Syntax.
(line 119)
* EMACS: Bash Variables. (line 237)
* EMACS: Bash Variables. (line 241)
* emacs-mode-string: Readline Init File Syntax.
(line 125)
* enable-bracketed-paste: Readline Init File Syntax.
(line 140)
* enable-keypad: Readline Init File Syntax.
(line 148)
* ENV: Bash Variables. (line 242)
* EUID: Bash Variables. (line 246)
* EXECIGNORE: Bash Variables. (line 250)
* ENV: Bash Variables. (line 246)
* EUID: Bash Variables. (line 250)
* EXECIGNORE: Bash Variables. (line 254)
* expand-tilde: Readline Init File Syntax.
(line 159)
* FCEDIT: Bash Variables. (line 260)
* FIGNORE: Bash Variables. (line 264)
* FUNCNAME: Bash Variables. (line 270)
* FUNCNEST: Bash Variables. (line 288)
* GLOBIGNORE: Bash Variables. (line 293)
* GROUPS: Bash Variables. (line 299)
* histchars: Bash Variables. (line 305)
* HISTCMD: Bash Variables. (line 320)
* HISTCONTROL: Bash Variables. (line 325)
* HISTFILE: Bash Variables. (line 341)
* HISTFILESIZE: Bash Variables. (line 345)
* HISTIGNORE: Bash Variables. (line 356)
* FCEDIT: Bash Variables. (line 264)
* FIGNORE: Bash Variables. (line 268)
* FUNCNAME: Bash Variables. (line 274)
* FUNCNEST: Bash Variables. (line 291)
* GLOBIGNORE: Bash Variables. (line 296)
* GROUPS: Bash Variables. (line 302)
* histchars: Bash Variables. (line 308)
* HISTCMD: Bash Variables. (line 323)
* HISTCONTROL: Bash Variables. (line 328)
* HISTFILE: Bash Variables. (line 344)
* HISTFILESIZE: Bash Variables. (line 348)
* HISTIGNORE: Bash Variables. (line 359)
* history-preserve-point: Readline Init File Syntax.
(line 163)
* history-size: Readline Init File Syntax.
(line 169)
* HISTSIZE: Bash Variables. (line 375)
* HISTTIMEFORMAT: Bash Variables. (line 382)
* HISTSIZE: Bash Variables. (line 378)
* HISTTIMEFORMAT: Bash Variables. (line 385)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 176)
* HOSTFILE: Bash Variables. (line 390)
* HOSTNAME: Bash Variables. (line 401)
* HOSTTYPE: Bash Variables. (line 404)
* HOSTFILE: Bash Variables. (line 393)
* HOSTNAME: Bash Variables. (line 404)
* HOSTTYPE: Bash Variables. (line 407)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 407)
* IGNOREEOF: Bash Variables. (line 410)
* input-meta: Readline Init File Syntax.
(line 183)
* INPUTRC: Bash Variables. (line 417)
* INPUTRC: Bash Variables. (line 420)
* isearch-terminators: Readline Init File Syntax.
(line 190)
* keymap: Readline Init File Syntax.
(line 197)
* LANG: Bash Variables. (line 421)
* LC_ALL: Bash Variables. (line 425)
* LC_COLLATE: Bash Variables. (line 429)
* LC_CTYPE: Bash Variables. (line 436)
* LANG: Bash Variables. (line 424)
* LC_ALL: Bash Variables. (line 428)
* LC_COLLATE: Bash Variables. (line 432)
* LC_CTYPE: Bash Variables. (line 439)
* LC_MESSAGES: Locale Translation. (line 11)
* LC_MESSAGES <1>: Bash Variables. (line 441)
* LC_NUMERIC: Bash Variables. (line 445)
* LINENO: Bash Variables. (line 449)
* LINES: Bash Variables. (line 453)
* MACHTYPE: Bash Variables. (line 459)
* LC_MESSAGES <1>: Bash Variables. (line 444)
* LC_NUMERIC: Bash Variables. (line 448)
* LINENO: Bash Variables. (line 452)
* LINES: Bash Variables. (line 456)
* MACHTYPE: Bash Variables. (line 462)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 463)
* MAILCHECK: Bash Variables. (line 466)
* MAILPATH: Bourne Shell Variables.
(line 27)
* MAPFILE: Bash Variables. (line 471)
* MAPFILE: Bash Variables. (line 474)
* mark-modified-lines: Readline Init File Syntax.
(line 226)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -10836,41 +10857,41 @@ D.3 Parameter and Variable Index
(line 243)
* meta-flag: Readline Init File Syntax.
(line 183)
* OLDPWD: Bash Variables. (line 475)
* OLDPWD: Bash Variables. (line 478)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 478)
* OPTERR: Bash Variables. (line 481)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 482)
* OSTYPE: Bash Variables. (line 485)
* output-meta: Readline Init File Syntax.
(line 248)
* page-completions: Readline Init File Syntax.
(line 253)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 485)
* POSIXLY_CORRECT: Bash Variables. (line 490)
* PPID: Bash Variables. (line 499)
* PROMPT_COMMAND: Bash Variables. (line 503)
* PROMPT_DIRTRIM: Bash Variables. (line 507)
* PIPESTATUS: Bash Variables. (line 488)
* POSIXLY_CORRECT: Bash Variables. (line 493)
* PPID: Bash Variables. (line 502)
* PROMPT_COMMAND: Bash Variables. (line 506)
* PROMPT_DIRTRIM: Bash Variables. (line 510)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 513)
* PS4: Bash Variables. (line 518)
* PWD: Bash Variables. (line 524)
* RANDOM: Bash Variables. (line 527)
* READLINE_LINE: Bash Variables. (line 532)
* READLINE_POINT: Bash Variables. (line 536)
* REPLY: Bash Variables. (line 540)
* PS3: Bash Variables. (line 516)
* PS4: Bash Variables. (line 521)
* PWD: Bash Variables. (line 527)
* RANDOM: Bash Variables. (line 530)
* READLINE_LINE: Bash Variables. (line 535)
* READLINE_POINT: Bash Variables. (line 539)
* REPLY: Bash Variables. (line 543)
* revert-all-at-newline: Readline Init File Syntax.
(line 263)
* SECONDS: Bash Variables. (line 543)
* SHELL: Bash Variables. (line 549)
* SHELLOPTS: Bash Variables. (line 554)
* SHLVL: Bash Variables. (line 563)
* SECONDS: Bash Variables. (line 546)
* SHELL: Bash Variables. (line 552)
* SHELLOPTS: Bash Variables. (line 557)
* SHLVL: Bash Variables. (line 566)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 269)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -10881,10 +10902,10 @@ D.3 Parameter and Variable Index
(line 290)
* TEXTDOMAIN: Locale Translation. (line 11)
* TEXTDOMAINDIR: Locale Translation. (line 11)
* TIMEFORMAT: Bash Variables. (line 568)
* TMOUT: Bash Variables. (line 606)
* TMPDIR: Bash Variables. (line 618)
* UID: Bash Variables. (line 622)
* TIMEFORMAT: Bash Variables. (line 571)
* TMOUT: Bash Variables. (line 609)
* TMPDIR: Bash Variables. (line 621)
* UID: Bash Variables. (line 625)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 303)
* vi-ins-mode-string: Readline Init File Syntax.
@@ -11252,134 +11273,134 @@ D.5 Concept Index

Tag Table:
Node: Top889
Node: Introduction2801
Node: What is Bash?3017
Node: What is a shell?4131
Node: Definitions6669
Node: Basic Shell Features9588
Node: Shell Syntax10807
Node: Shell Operation11833
Node: Quoting13126
Node: Escape Character14426
Node: Single Quotes14911
Node: Double Quotes15259
Node: ANSI-C Quoting16384
Node: Locale Translation17613
Node: Comments18509
Node: Shell Commands19127
Node: Simple Commands19999
Node: Pipelines20630
Node: Lists23373
Node: Compound Commands25102
Node: Looping Constructs26105
Node: Conditional Constructs28568
Node: Command Grouping39489
Node: Coprocesses40968
Node: GNU Parallel42800
Node: Shell Functions46773
Node: Shell Parameters51979
Node: Positional Parameters56381
Node: Special Parameters57281
Node: Shell Expansions60618
Node: Brace Expansion62555
Node: Tilde Expansion65336
Node: Shell Parameter Expansion67684
Node: Command Substitution81791
Node: Arithmetic Expansion83121
Node: Process Substitution84053
Node: Word Splitting85097
Node: Filename Expansion86745
Node: Pattern Matching89029
Node: Quote Removal92727
Node: Redirections93022
Node: Executing Commands102245
Node: Simple Command Expansion102915
Node: Command Search and Execution104845
Node: Command Execution Environment107181
Node: Environment110165
Node: Exit Status111824
Node: Signals113494
Node: Shell Scripts115461
Node: Shell Builtin Commands117976
Node: Bourne Shell Builtins120000
Node: Bash Builtins140602
Node: Modifying Shell Behavior169196
Node: The Set Builtin169541
Node: The Shopt Builtin179954
Node: Special Builtins194583
Node: Shell Variables195562
Node: Bourne Shell Variables195999
Node: Bash Variables198030
Node: Bash Features225430
Node: Invoking Bash226329
Node: Bash Startup Files232278
Node: Interactive Shells237381
Node: What is an Interactive Shell?237791
Node: Is this Shell Interactive?238440
Node: Interactive Shell Behavior239255
Node: Bash Conditional Expressions242554
Node: Shell Arithmetic246555
Node: Aliases249332
Node: Arrays251880
Node: The Directory Stack256964
Node: Directory Stack Builtins257681
Node: Controlling the Prompt260640
Node: The Restricted Shell263386
Node: Bash POSIX Mode265211
Node: Job Control274805
Node: Job Control Basics275265
Node: Job Control Builtins279984
Node: Job Control Variables284455
Node: Command Line Editing285611
Node: Introduction and Notation287282
Node: Readline Interaction288905
Node: Readline Bare Essentials290096
Node: Readline Movement Commands291879
Node: Readline Killing Commands292839
Node: Readline Arguments294757
Node: Searching295801
Node: Readline Init File297987
Node: Readline Init File Syntax299134
Node: Conditional Init Constructs318859
Node: Sample Init File321384
Node: Bindable Readline Commands324501
Node: Commands For Moving325705
Node: Commands For History326848
Node: Commands For Text331137
Node: Commands For Killing334526
Node: Numeric Arguments337007
Node: Commands For Completion338146
Node: Keyboard Macros342337
Node: Miscellaneous Commands343024
Node: Readline vi Mode348828
Node: Programmable Completion349735
Node: Programmable Completion Builtins357196
Node: A Programmable Completion Example367082
Node: Using History Interactively372334
Node: Bash History Facilities373018
Node: Bash History Builtins376017
Node: History Interaction380014
Node: Event Designators382720
Node: Word Designators383939
Node: Modifiers385576
Node: Installing Bash386978
Node: Basic Installation388115
Node: Compilers and Options390806
Node: Compiling For Multiple Architectures391547
Node: Installation Names393210
Node: Specifying the System Type394028
Node: Sharing Defaults394744
Node: Operation Controls395417
Node: Optional Features396375
Node: Reporting Bugs406632
Node: Major Differences From The Bourne Shell407826
Node: GNU Free Documentation License424678
Node: Indexes449855
Node: Builtin Index450309
Node: Reserved Word Index457136
Node: Variable Index459584
Node: Function Index474824
Node: Concept Index488044
Node: Top893
Node: Introduction2809
Node: What is Bash?3025
Node: What is a shell?4139
Node: Definitions6677
Node: Basic Shell Features9615
Node: Shell Syntax10834
Node: Shell Operation11860
Node: Quoting13153
Node: Escape Character14453
Node: Single Quotes14938
Node: Double Quotes15286
Node: ANSI-C Quoting16411
Node: Locale Translation17664
Node: Comments18560
Node: Shell Commands19178
Node: Simple Commands20050
Node: Pipelines20681
Node: Lists23424
Node: Compound Commands25153
Node: Looping Constructs26156
Node: Conditional Constructs28619
Node: Command Grouping39540
Node: Coprocesses41019
Node: GNU Parallel42851
Node: Shell Functions46824
Node: Shell Parameters52030
Node: Positional Parameters56432
Node: Special Parameters57332
Node: Shell Expansions60669
Node: Brace Expansion62606
Node: Tilde Expansion65387
Node: Shell Parameter Expansion67735
Node: Command Substitution81867
Node: Arithmetic Expansion83197
Node: Process Substitution84129
Node: Word Splitting85173
Node: Filename Expansion86821
Node: Pattern Matching89105
Node: Quote Removal92803
Node: Redirections93098
Node: Executing Commands102321
Node: Simple Command Expansion102991
Node: Command Search and Execution104921
Node: Command Execution Environment107257
Node: Environment110241
Node: Exit Status111900
Node: Signals113570
Node: Shell Scripts115537
Node: Shell Builtin Commands118052
Node: Bourne Shell Builtins120086
Node: Bash Builtins140688
Node: Modifying Shell Behavior169279
Node: The Set Builtin169624
Node: The Shopt Builtin180037
Node: Special Builtins195042
Node: Shell Variables196021
Node: Bourne Shell Variables196458
Node: Bash Variables198489
Node: Bash Features225994
Node: Invoking Bash226893
Node: Bash Startup Files232842
Node: Interactive Shells237945
Node: What is an Interactive Shell?238355
Node: Is this Shell Interactive?239004
Node: Interactive Shell Behavior239819
Node: Bash Conditional Expressions243118
Node: Shell Arithmetic247119
Node: Aliases249896
Node: Arrays252444
Node: The Directory Stack257528
Node: Directory Stack Builtins258312
Node: Controlling the Prompt261280
Node: The Restricted Shell264026
Node: Bash POSIX Mode265851
Node: Job Control275506
Node: Job Control Basics275966
Node: Job Control Builtins280685
Node: Job Control Variables285204
Node: Command Line Editing286360
Node: Introduction and Notation288031
Node: Readline Interaction289654
Node: Readline Bare Essentials290845
Node: Readline Movement Commands292628
Node: Readline Killing Commands293588
Node: Readline Arguments295506
Node: Searching296550
Node: Readline Init File298736
Node: Readline Init File Syntax299883
Node: Conditional Init Constructs319608
Node: Sample Init File322133
Node: Bindable Readline Commands325250
Node: Commands For Moving326454
Node: Commands For History327597
Node: Commands For Text331886
Node: Commands For Killing335275
Node: Numeric Arguments337756
Node: Commands For Completion338895
Node: Keyboard Macros343086
Node: Miscellaneous Commands343773
Node: Readline vi Mode349577
Node: Programmable Completion350484
Node: Programmable Completion Builtins357945
Node: A Programmable Completion Example367831
Node: Using History Interactively373083
Node: Bash History Facilities373767
Node: Bash History Builtins376766
Node: History Interaction380763
Node: Event Designators383727
Node: Word Designators384946
Node: Modifiers386583
Node: Installing Bash387985
Node: Basic Installation389122
Node: Compilers and Options391813
Node: Compiling For Multiple Architectures392554
Node: Installation Names394217
Node: Specifying the System Type395035
Node: Sharing Defaults395751
Node: Operation Controls396424
Node: Optional Features397382
Node: Reporting Bugs407639
Node: Major Differences From The Bourne Shell408833
Node: GNU Free Documentation License425685
Node: Indexes450862
Node: Builtin Index451316
Node: Reserved Word Index458143
Node: Variable Index460591
Node: Function Index475904
Node: Concept Index489124

End Tag Table
BIN
View File
Binary file not shown.
+2609 -2573
View File
File diff suppressed because it is too large Load Diff
+37 -16
View File
@@ -243,7 +243,7 @@ A mechanism by which users can selectively stop (suspend) and restart
@item metacharacter
@cindex metacharacter
A character that, when unquoted, separates words. A metacharacter is
a @code{blank} or one of the following characters:
a @code{space}, @code{tab}, @code{newline}, or one of the following characters:
@samp{|}, @samp{&}, @samp{;}, @samp{(}, @samp{)}, @samp{<}, or
@samp{>}.
@@ -500,6 +500,8 @@ backslash
single quote
@item \"
double quote
@item \?
question mark
@item \@var{nnn}
the eight-bit character whose value is the octal value @var{nnn}
(one to three digits)
@@ -2207,7 +2209,8 @@ escape sequences expanded as with the @code{$'@dots{}'} quoting mechansim.
The expansion is a string that is the result of expanding the value of
@var{parameter} as if it were a prompt string (@pxref{Controlling the Prompt}).
@item A
The expansion is a string in the form of a @code{declare} command that, if
The expansion is a string in the form of
an assignment statement or @code{declare} command that, if
evaluated, will recreate @var{parameter} with its attributes and value.
@item a
The expansion is a string consisting of flag values representing
@@ -3236,7 +3239,8 @@ options preceded by @samp{-} accepts @samp{--}
to signify the end of the options.
The @code{:}, @code{true}, @code{false}, and @code{test}
builtins do not accept options and do not treat @samp{--} specially.
The @code{exit}, @code{logout}, @code{break}, @code{continue}, @code{let},
The @code{exit}, @code{logout}, @code{return},
@code{break}, @code{continue}, @code{let},
and @code{shift} builtins accept and process arguments beginning
with @samp{-} without requiring @samp{--}.
Other builtins that accept arguments but are not specified as accepting
@@ -3997,7 +4001,7 @@ The @option{-F} option inhibits the display of function definitions;
only the function name and attributes are printed.
If the @code{extdebug} shell option is enabled using @code{shopt}
(@pxref{The Shopt Builtin}), the source file name and line number where
the function is defined are displayed as well.
each @var{name} is defined are displayed as well.
@option{-F} implies @option{-f}.
The @option{-g} option forces variables to be created or modified at
@@ -5062,6 +5066,13 @@ If set, Bash
does not process the replacement string in the pattern substitution word
expansion using quote removal.
@item compat43
If set, Bash
does not print a warning message if an attempt is made to use a quoted compound
array assignment as an argument to @code{declare}, and makes word expansion errors
non-fatal errors that cause the current command to fail (the default behavior is
to make them fatal errors that cause the shell to exit).
@item complete_fullquote
If set, Bash
quotes all shell metacharacters in filenames and directory names when
@@ -5502,6 +5513,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
@@ -5697,7 +5713,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.
@@ -5724,7 +5740,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.
@@ -6991,6 +7007,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
@@ -7010,6 +7027,7 @@ dirs [-clpv] [+@var{N} | -@var{N}]
Display the list of currently remembered directories. Directories
are added to the list with the @code{pushd} command; the
@code{popd} command removes directories from the list.
The current directory is always the first directory in the stack.
@table @code
@item -c
@@ -7039,13 +7057,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
@@ -7067,12 +7083,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
@@ -7082,7 +7099,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
@@ -7306,6 +7323,9 @@ is not found.
Non-interactive shells exit if a syntax error in an arithmetic expansion
results in an invalid expression.
@item
Non-interactive shells exit on word expansion errors.
@item
Non-interactive shells exit if there is a syntax error in a script read
with the @code{.} or @code{source} builtins, or in a string processed by
@@ -7701,7 +7721,7 @@ passing it @var{argument}s, returning its exit status.
@btindex kill
@example
kill [-s @var{sigspec}] [-n @var{signum}] [-@var{sigspec}] @var{jobspec} or @var{pid}
kill -l [@var{exit_status}]
kill -l|-L [@var{exit_status}]
@end example
Send a signal specified by @var{sigspec} or @var{signum} to the process
@@ -7716,6 +7736,7 @@ signals corresponding to the arguments are listed, and the return status
is zero.
@var{exit_status} is a number specifying a signal number or the exit
status of a process terminated by a signal.
The @option{-L} option is equivalent to @option{-l}.
The return status is zero if at least one signal was successfully sent,
or non-zero if an error occurs or an invalid option is encountered.
+522 -512
View File
File diff suppressed because it is too large Load Diff
+1225 -1214
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Fri Jul 10 10:23:01 2015
%%CreationDate: Fri Oct 2 07:16:22 2015
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2015 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Jun 11 16:25:43 EDT 2015
@set LASTCHANGE Fri Oct 2 07:15:33 EDT 2015
@set EDITION 4.4
@set VERSION 4.4
@set UPDATED 11 June 2015
@set UPDATED-MONTH June 2015
@set UPDATED 2 October 2015
@set UPDATED-MONTH October 2015
+50 -6
View File
@@ -1,7 +1,7 @@
#
# Simple makefile for the sample loadable builtins
#
# Copyright (C) 1996-2009 Free Software Foundation, Inc.
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
# Include some boilerplate Gnu makefile definitions.
prefix = @prefix@
@@ -28,11 +31,23 @@ includedir = @includedir@
datarootdir = @datarootdir@
loadablesdir = @loadablesdir@
headersdir = @headersdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
srcdir = @srcdir@
VPATH = @srcdir@
# Support an alternate destination root directory for package building
DESTDIR =
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
INSTALLMODE= -m 0755
@SET_MAKE@
CC = @CC@
RM = rm -f
@@ -52,6 +67,8 @@ CPPFLAGS = @CPPFLAGS@
BASHINCDIR = ${topdir}/include
SUPPORT_SRC = $(topdir)/support/
LIBBUILD = ${BUILD_DIR}/lib
INTL_LIBSRC = ${topdir}/lib/intl
@@ -75,7 +92,7 @@ SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
SHOBJ_LIBS = @SHOBJ_LIBS@
SHOBJ_STATUS = @SHOBJ_STATUS@
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
-I$(BASHINCDIR) -I$(BUILD_DIR) -I$(LIBBUILD) \
-I$(BUILD_DIR)/builtins $(INTL_INC)
@@ -83,10 +100,10 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins \
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
ALLPROG = print truefalse sleep pushd finfo logname basename dirname \
ALLPROG = print truefalse sleep finfo logname basename dirname \
tty pathchk tee head mkdir rmdir printenv id whoami \
uname sync push ln unlink realpath strftime mypid
OTHERPROG = necho hello cat
OTHERPROG = necho hello cat pushd
all: $(SHOBJ_STATUS)
@@ -98,7 +115,7 @@ unsupported:
@echo "${topdir}/support/shobj-conf script."
@echo "If your operating system provides facilities for dynamic"
@echo "loading of shared objects using the dlopen(3) interface,"
@echo "please update the script and re-run configure.
@echo "please update the script and re-run configure."
@echo "Please send the changes you made to bash-maintainers@gnu.org"
@echo "for inclusion in future bash releases."
@@ -207,9 +224,36 @@ mostlyclean: clean
-( cd perl && ${MAKE} ${MFLAGS} $@ )
distclean maintainer-clean: clean
$(RM) Makefile pushd.c
$(RM) Makefile Makefile.inc pushd.c
-( cd perl && ${MAKE} ${MFLAGS} $@ )
installdirs:
@${SHELL} $(SUPPORT_SRC)mkinstalldirs $(DESTDIR)$(loadablesdir)
install-dev:
@$(INSTALL_DATA) Makefile.inc $(DESTDIR)$(loadablesdir)/Makefile.inc
@( cd $(BUILD_DIR) && ${MAKE} ${MFLAGS} DESTDIR="$(DESTDIR)" install-headers)
install-supported: all installdirs install-dev
@echo installing example loadable builtins in $(DESTDIR)${loadablesdir}
@for prog in ${ALLPROG}; do \
echo $$prog ; \
$(INSTALL_PROGRAM) $(INSTALLMODE) $$prog $(DESTDIR)$(loadablesdir)/$$prog ;\
done
uninstall-dev:
-$(RM) $(DESTDIR)$(loadablesdir)/Makefile.inc
-( cd $(BUILD_DIR) && ${MAKE} ${MFLAGS} DESTDIR="$(DESTDIR)" uninstall-headers)
uninstall-supported: uninstall-dev
-( cd $(DESTDIR)${loadablesdir} && $(RM) ${ALLPROG} )
install-unsupported:
uninstall-unsupported:
install: install-$(SHOBJ_STATUS)
uninstall: uninstall-$(SHOBJ_STATUS)
print.o: print.c
truefalse.o: truefalse.c
sleep.o: sleep.c
+108
View File
@@ -0,0 +1,108 @@
#
# Sample makefile for bash loadable builtin development
#
# Copyright (C) 2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
# Include some boilerplate Gnu makefile definitions.
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
infodir = @infodir@
includedir = @includedir@
datarootdir = @datarootdir@
loadablesdir = @loadablesdir@
headersdir = @headersdir@
topdir = @top_srcdir@
BUILD_DIR = @BUILD_DIR@
srcdir = @srcdir@
VPATH = @srcdir@
# Support an alternate destination root directory for package building
DESTDIR =
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
INSTALLMODE= -m 0755
@SET_MAKE@
CC = @CC@
RM = rm -f
SHELL = @MAKE_SHELL@
host_os = @host_os@
host_cpu = @host_cpu@
host_vendor = @host_vendor@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
CPPFLAGS = @CPPFLAGS@
BASHINCDIR = ${topdir}/include
SUPPORT_SRC = $(topdir)/support/
LIBBUILD = ${BUILD_DIR}/lib
INTL_LIBSRC = ${topdir}/lib/intl
INTL_BUILDDIR = ${LIBBUILD}/intl
INTL_INC = @INTL_INC@
LIBINTL_H = @LIBINTL_H@
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
#
# These values are generated for configure by ${topdir}/support/shobj-conf.
# If your system is not supported by that script, but includes facilities for
# dynamic loading of shared objects, please update the script and send the
# changes to bash-maintainers@gnu.org.
#
SHOBJ_CC = @SHOBJ_CC@
SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
SHOBJ_LD = @SHOBJ_LD@
SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ @LDFLAGS@
SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
SHOBJ_LIBS = @SHOBJ_LIBS@
SHOBJ_STATUS = @SHOBJ_STATUS@
INC = -I$(headersdir) -I$(headersdir)/include -I$(headersdir)/builtins
.c.o:
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
all: example
example: example.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ example.o $(SHOBJ_LIBS)
example.o: example.c
+2 -3
View File
@@ -34,18 +34,17 @@ new loadable builtins.
basename.c Return non-directory portion of pathname.
cat.c cat(1) replacement with no options - the way cat was intended.
cut.c cut(1) replacement.
dirname.c Return directory portion of pathname.
finfo.c Print file info.
getconf.c POSIX.2 getconf utility.
getconf.h Replacement definitions for ones the system doesn't provide.
head.c Copy first part of files.
hello.c Obligatory "Hello World" / sample loadable.
id.c POSIX.2 user identity.
ln.c Make links.
loadables.h Start at a file loadable builtins can include for shell definitions
logname.c Print login name of current user.
Makefile.in Simple makefile for the sample loadable builtins.
mkdir.c Make directories.
mypid.c Add $MYPID variable, demonstrate use of unload hook function
necho.c echo without options or argument interpretation.
pathchk.c Check pathnames for validity and portability.
print.c Loadable ksh-93 style print builtin.
+1
View File
@@ -31,6 +31,7 @@
#include "shell.h"
#include "common.h"
int
basename_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -31,6 +31,7 @@
#include "shell.h"
#include "common.h"
int
dirname_builtin (list)
WORD_LIST *list;
{
+6 -3
View File
@@ -39,6 +39,7 @@
#include "shell.h"
#include "builtins.h"
#include "common.h"
#include "getopt.h"
#ifndef errno
extern int errno;
@@ -46,8 +47,10 @@ extern int errno;
extern char **make_builtin_argv ();
static void perms();
static int printst();
static int printsome();
static void printmode();
static int printfinfo();
static int finfo_main();
@@ -192,7 +195,7 @@ int m;
return (m & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID));
}
static int
static void
perms(m)
int m;
{
@@ -236,7 +239,7 @@ int m;
printf ("u=%s,g=%s,o=%s", ubits, gbits, obits);
}
static int
static void
printmode(mode)
int mode;
{
@@ -262,7 +265,7 @@ int mode;
printf("\n");
}
static int
static int
printst(st)
struct stat *st;
{
+2
View File
@@ -88,8 +88,10 @@ file_head (fp, cnt)
break;
}
}
return (EXECUTION_SUCCESS);
}
int
head_builtin (list)
WORD_LIST *list;
{
+18 -3
View File
@@ -29,9 +29,7 @@
#include <stdio.h>
#include "builtins.h"
#include "shell.h"
#include "bashgetopt.h"
#include "loadables.h"
/* A builtin `xxx' is normally implemented with an `xxx_builtin' function.
If you're converting a command that uses the normal Unix argc/argv
@@ -58,6 +56,23 @@ hello_builtin (list)
return (EXECUTION_SUCCESS);
}
int
hello_builtin_load (s)
char *s;
{
printf ("hello builtin loaded\n");
fflush (stdout);
return (1);
}
void
hello_builtin_unload (s)
char *s;
{
printf ("hello builtin unloaded\n");
fflush (stdout);
}
/* An array of strings forming the `long' documentation for a builtin xxx,
which is printed by `help xxx'. It must end with a NULL. By convention,
the first line is a short description. */
+12 -3
View File
@@ -46,10 +46,12 @@ typedef int unix_link_syscall_t __P((const char *, const char *));
#define LN_SYMLINK 0x01
#define LN_UNLINK 0x02
#define LN_NOFOLLOW 0x04
static unix_link_syscall_t *linkfn;
static int dolink ();
int
ln_builtin (list)
WORD_LIST *list;
{
@@ -70,6 +72,10 @@ ln_builtin (list)
case 's':
flags |= LN_SYMLINK;
break;
case 'h':
case 'n':
flags |= LN_NOFOLLOW;
break;
default:
builtin_usage ();
return (EX_USAGE);
@@ -138,8 +144,10 @@ mkdirpath (dir, file)
#if defined (HAVE_LSTAT)
# define LSTAT lstat
# define LSTAT_OR_STAT_IF(c, f, b) ((c) ? lstat((f), (b)) : stat((f), (b)))
#else
# define LSTAT stat
# define LSTAT_OR_STAT_IF(c, f, b) (stat((f), (b)))
#endif
static int
@@ -171,7 +179,7 @@ dolink (src, dst, flags)
/* If the destination is a directory, create the final filename by appending
the basename of the source to the destination. */
dst_path = 0;
if ((stat (dst, &dsb) == 0) && S_ISDIR (dsb.st_mode))
if ((LSTAT_OR_STAT_IF((flags & LN_NOFOLLOW), dst, &dsb) == 0) && S_ISDIR (dsb.st_mode))
{
if ((p = strrchr (src, '/')) == 0)
p = src;
@@ -210,7 +218,8 @@ char *ln_doc[] = {
"Create a new directory entry with the same modes as the original",
"file. The -f option means to unlink any existing file, permitting",
"the link to occur. The -s option means to create a symbolic link.",
"By default, ln makes hard links.",
"By default, ln makes hard links. Specifying -n or its synonym -h",
"causes ln to not resolve symlinks in the target file or directory.",
(char *)NULL
};
@@ -221,6 +230,6 @@ struct builtin ln_struct = {
ln_builtin, /* function implementing the builtin */
BUILTIN_ENABLED, /* initial flags for builtin */
ln_doc, /* array of long documentation strings. */
"ln [-fs] file1 [file2] OR ln [-fs] file ... directory", /* usage synopsis; becomes short_doc */
"ln [-fhns] file1 [file2] OR ln [-fhns] file ... directory", /* usage synopsis; becomes short_doc */
0 /* reserved for internal use */
};
+34
View File
@@ -0,0 +1,34 @@
/* loadables.h -- Include files needed by all loadable builtins */
/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LOADABLES_H_
#define __LOADABLES_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "builtins.h"
#include "shell.h"
#include "bashgetopt.h"
#include "common.h"
#endif
+1
View File
@@ -35,6 +35,7 @@
extern int errno;
#endif
int
logname_builtin (list)
WORD_LIST *list;
{
+11
View File
@@ -5,6 +5,11 @@
* Then, from within bash, enable -f ./mypid enable_mypid, where ./mypid
* is the binary obtained from running make. Hereafter, `${MYPID}'
* is a shell builtin variable.
*
* This defines an unload hook function that is called when the builtin is
* deleted with enable -d that will unbind the MYPID variable so future
* references to it do not attempt to access memory that is no longer part
* of this process's address space.
*/
#include <stdio.h>
@@ -56,6 +61,12 @@ enable_mypid_builtin(WORD_LIST *list)
return 0;
}
void
enable_mypid_builtin_unload (char *s)
{
unbind_variable ("MYPID");
}
char const *enable_mypid_doc[] = {
"Enable $MYPID.",
"",
+1
View File
@@ -25,6 +25,7 @@
#include "builtins.h"
#include "shell.h"
int
necho_builtin (list)
WORD_LIST *list;
{
+4 -3
View File
@@ -98,6 +98,7 @@ extern char *strerror ();
static int validate_path ();
int
pathchk_builtin (list)
WORD_LIST *list;
{
@@ -323,7 +324,7 @@ validate_path (path, portability)
if (!last_elem)
{
exists = dir_ok (path);
if (dir_ok == 0)
if (exists == 0)
{
free (parent);
return 1;
@@ -370,8 +371,8 @@ validate_path (path, portability)
free (parent);
if (strlen (path) > path_max)
{
builtin_error ("path `%s' has length %d; exceeds limit of %d",
path, strlen (path), path_max);
builtin_error ("path `%s' has length %lu; exceeds limit of %d",
path, (unsigned long)strlen (path), path_max);
return 1;
}
+1
View File
@@ -60,6 +60,7 @@ extern int errno;
extern char *sh_realpath();
int
realpath_builtin(list)
WORD_LIST *list;
{
+1
View File
@@ -32,6 +32,7 @@
extern int errno;
#endif
int
rmdir_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -28,6 +28,7 @@
#include "shell.h"
#include "bashgetopt.h"
int
sync_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -60,6 +60,7 @@ extern int interrupt_immediately;
extern char *strerror ();
int
tee_builtin (list)
WORD_LIST *list;
{
+18 -3
View File
@@ -11,9 +11,7 @@
#include <stdio.h>
#include <errno.h>
#include "builtins.h"
#include "shell.h"
#include "bashgetopt.h"
#include "loadables.h"
#if !defined (errno)
extern int errno;
@@ -21,6 +19,7 @@ extern int errno;
extern char *strerror ();
int
template_builtin (list)
WORD_LIST *list;
{
@@ -42,6 +41,22 @@ template_builtin (list)
return (rval);
}
/* Called when `template' is enabled and loaded from the shared object. If this
function returns 0, the load fails. */
int
template_builtin_load (name)
char *name;
{
return (1);
}
/* Called when `template' is disabled. */
void
template_builtin_unload (name)
char *name;
{
}
char *template_doc[] = {
"Short description.",
""
+2
View File
@@ -25,12 +25,14 @@
#include "builtins.h"
#include "common.h"
int
true_builtin (list)
WORD_LIST *list;
{
return EXECUTION_SUCCESS;
}
int
false_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -30,6 +30,7 @@
extern char *ttyname ();
int
tty_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -63,6 +63,7 @@ static void uprint();
static int uname_flags;
int
uname_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -38,6 +38,7 @@
extern int errno;
#endif
int
unlink_builtin (list)
WORD_LIST *list;
{
+1
View File
@@ -28,6 +28,7 @@
#include "bashgetopt.h"
#include "common.h"
int
whoami_builtin (list)
WORD_LIST *list;
{
+20 -14
View File
@@ -875,13 +875,11 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
last_command_exit_value = exec_result;
run_pending_traps ();
#if 0 /* XXX - bash-4.4 or bash-5.0 */
/* Undo redirections before running exit trap on the way out of
set -e. Report by Mark Farrell 5/19/2014 */
if (exit_immediately_on_error && signal_is_trapped (0) &&
unwind_protect_tag_on_stack ("saved-redirects"))
run_unwind_frame ("saved-redirects");
#endif
jump_to_top_level (ERREXIT);
}
@@ -1306,11 +1304,12 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
int asynchronous, pipe_in, pipe_out;
struct fd_bitmap *fds_to_close;
{
int rv, posix_time, old_flags, nullcmd;
int rv, posix_time, old_flags, nullcmd, code;
time_t rs, us, ss;
int rsf, usf, ssf;
int cpu;
char *time_format;
volatile procenv_t save_top_level;
#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
struct timeval real, user, sys;
@@ -1357,9 +1356,13 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
}
old_flags = command->flags;
COPY_PROCENV (top_level, save_top_level);
command->flags &= ~(CMD_TIME_PIPELINE|CMD_TIME_POSIX);
rv = execute_command_internal (command, asynchronous, pipe_in, pipe_out, fds_to_close);
code = setjmp_nosigs (top_level);
if (code == NOT_JUMPED)
rv = execute_command_internal (command, asynchronous, pipe_in, pipe_out, fds_to_close);
command->flags = old_flags;
COPY_PROCENV (save_top_level, top_level);
rs = us = ss = 0;
rsf = usf = ssf = cpu = 0;
@@ -1418,6 +1421,9 @@ time_command (command, asynchronous, pipe_in, pipe_out, fds_to_close)
if (time_format && *time_format)
print_formatted_time (stderr, time_format, rs, rsf, us, usf, ss, ssf, cpu);
if (code)
sh_longjmp (top_level, code);
return rv;
}
#endif /* COMMAND_TIMING */
@@ -2629,11 +2635,6 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
second = command->value.Connection->second;
if (ignore_return && second)
second->flags |= CMD_IGNORE_RETURN;
if (should_suppress_fork (second))
{
second->flags |= CMD_NO_FORK;
second->value.Simple->flags |= CMD_NO_FORK;
}
exec_result = execute_command (second);
}
@@ -4045,6 +4046,9 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
last_asynchronous_pid = old_last_async_pid;
CHECK_SIGTERM;
if (async)
subshell_level++; /* not for pipes yet */
}
else
{
@@ -4066,6 +4070,8 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
}
}
QUIT; /* XXX */
/* If we are re-running this as the result of executing the `command'
builtin, do not expand the command words a second time. */
if ((simple_command->flags & CMD_INHIBIT_EXPANSION) == 0)
@@ -4236,7 +4242,8 @@ run_builtin:
setup_async_signals ();
}
subshell_level++;
if (async == 0)
subshell_level++;
execute_subshell_builtin_or_function
(words, simple_command->redirects, builtin, func,
pipe_in, pipe_out, async, fds_to_close,
@@ -4608,7 +4615,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
{
error_trap = savestring (error_trap);
add_unwind_protect (xfree, error_trap);
add_unwind_protect (set_error_trap, error_trap);
add_unwind_protect (maybe_set_error_trap, error_trap);
}
restore_default_signal (ERROR_TRAP);
}
@@ -4625,7 +4632,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
{
return_trap = savestring (return_trap);
add_unwind_protect (xfree, return_trap);
add_unwind_protect (set_return_trap, return_trap);
add_unwind_protect (maybe_set_return_trap, return_trap);
}
restore_default_signal (RETURN_TRAP);
}
@@ -5463,6 +5470,7 @@ shell_execve (command, args, env)
/* We have committed to attempting to execute the contents of this file
as shell commands. */
reset_parser ();
initialize_subshell ();
set_sigint_handler ();
@@ -5507,8 +5515,6 @@ shell_execve (command, args, env)
clear_fifo_list (); /* pipe fds are what they are now */
#endif
reset_parser ();
sh_longjmp (subshell_top_level, 1);
/*NOTREACHED*/
}
+3
View File
@@ -219,6 +219,9 @@ typedef int sh_ignore_func_t __P((const char *)); /* sh_icpfunc_t */
typedef int sh_assign_func_t __P((const char *));
typedef int sh_wassign_func_t __P((WORD_DESC *, int));
typedef int sh_load_func_t __P((char *));
typedef void sh_unload_func_t __P((char *));
typedef int sh_builtin_func_t __P((WORD_LIST *)); /* sh_wlist_func_t */
#endif /* SH_FUNCTION_TYPEDEF */
+1 -1
View File
@@ -103,7 +103,7 @@
#ifndef TOCTRL
/* letter to control char -- ASCII. The TOUPPER is in there so \ce and
\cE will map to the same character in $'...' expansions. */
# define TOCTRL(x) (TOUPPER(x) & 037)
# define TOCTRL(x) ((x) == '?' ? 0x7f : (TOUPPER(x) & 0x1f))
#endif
#ifndef UNCTRL
/* control char to letter -- ASCII */
+2 -2
View File
@@ -205,7 +205,7 @@ make_buffered_stream (fd, buffer, bufsize)
if (bufsize == 1)
bp->b_flag |= B_UNBUFF;
if (O_TEXT && (fcntl (fd, F_GETFL) & O_TEXT) != 0)
bp->b_flag |= O_TEXT;
bp->b_flag |= B_TEXT;
return (bp);
}
@@ -272,7 +272,7 @@ save_bash_input (fd, new_fd)
return -1;
}
if (buffers[nfd])
if (nfd < nbuffers && buffers[nfd])
{
/* What's this? A stray buffer without an associated open file
descriptor? Free up the buffer and report the error. */
+40 -7
View File
@@ -165,9 +165,12 @@ extern sh_builtin_func_t *this_shell_builtin;
extern char *shell_name, *this_command_name;
extern sigset_t top_level_mask;
extern procenv_t wait_intr_buf;
extern int wait_intr_flag;
extern int wait_signal_received;
extern WORD_LIST *subst_assign_varlist;
extern SigHandler **original_signals;
static struct jobstats zerojs = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
struct jobstats js = { -1L, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NO_JOB, NO_JOB, 0, 0 };
@@ -320,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
@@ -432,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;
@@ -452,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);
@@ -1840,6 +1862,8 @@ make_child (command, async_p)
unset_bash_input (0);
#endif /* BUFFERED_INPUT */
CLRINTERRUPT; /* XXX - children have their own interrupt state */
/* Restore top-level signal mask. */
sigprocmask (SIG_SETMASK, &top_level_mask, (sigset_t *)NULL);
@@ -2742,8 +2766,6 @@ if (job == NO_JOB)
something like a while loop or a for loop, simulate getting
and being killed by the SIGINT to pass the status back to our
parent. */
s = job_signal_status (job);
if (child_caught_sigint == 0 && signal_is_trapped (SIGINT) == 0)
{
UNBLOCK_CHILD (oset);
@@ -3371,6 +3393,13 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
if (pid <= 0)
continue; /* jumps right to the test */
/* Linux kernels appear to signal the parent but not interrupt the
waitpid() (or restart it even without SA_RESTART) on SIGINT, so if
we saw a SIGINT and the process exited or died due to some other
signal, assume the child caught the SIGINT. */
if (wait_sigint_received && (WIFSIGNALED (status) == 0 || WTERMSIG (status) != SIGINT))
child_caught_sigint = 1;
/* If the child process did die due to SIGINT, forget our assumption
that it caught or otherwise handled it. */
if (WIFSIGNALED (status) && WTERMSIG (status) == SIGINT)
@@ -3602,13 +3631,17 @@ set_job_status_and_cleanup (job)
seen it, and wait_sigint_received is non-zero, because keyboard
signals are sent to process groups) or via kill(2) to the foreground
process by another process (or itself). If the shell did receive the
SIGINT, it needs to perform normal SIGINT processing. */
SIGINT, it needs to perform normal SIGINT processing. XXX - should
this change its behavior depending on whether the last command in an
pipeline exited due to SIGINT, or any process in the pipeline? Right
now it does this if any process in the pipeline exits due to SIGINT. */
else if (wait_sigint_received &&
child_caught_sigint == 0 &&
IS_FOREGROUND (job) && IS_JOBCONTROL (job) == 0)
{
int old_frozen;
itrace("waitchld: special handling for SIGINT");
wait_sigint_received = 0;
/* If SIGINT is trapped, set the exit status so that the trap
@@ -3642,7 +3675,7 @@ set_job_status_and_cleanup (job)
In this case, we have to fix things up. What a crock. */
if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0)
temp_handler = trap_to_sighandler (SIGINT);
restore_sigint_handler ();
restore_sigint_handler ();
if (temp_handler == SIG_DFL)
termsig_handler (SIGINT); /* XXX */
else if (temp_handler != SIG_IGN)
+5
View File
@@ -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)
+1 -1
View File
@@ -52,7 +52,7 @@ BASHINCDIR = ${topdir}/include
INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib
CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \
CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) ${INCLUDES} $(CPPFLAGS) \
$(LOCAL_CFLAGS) $(CFLAGS)
# Here is a rule for making .o files from .c files that doesn't force
+2 -2
View File
@@ -866,8 +866,8 @@ internal_free (mem, file, line, flags)
p = (union mhead *) ap - 1;
}
#if defined (MALLOC_TRACE) || defined (MALLOC_REGISTER)
if (malloc_trace || malloc_register)
#if defined (MALLOC_TRACE) || defined (MALLOC_REGISTER) || defined (MALLOC_WATCH)
if (malloc_trace || malloc_register || _malloc_nwatch > 0)
ubytes = p->mh_nbytes;
#endif
+1 -1
View File
@@ -340,7 +340,7 @@ mlocation_register_alloc (file, line)
int line;
{
ma_table_t *lentry;
char *nfile;
const char *nfile;
if (file == 0)
{
+1 -1
View File
@@ -65,7 +65,7 @@ extern void mregister_dump_table __P((void));
extern void mregister_table_init __P((void));
typedef struct ma_table {
char *file;
const char *file;
int line;
int nalloc;
} ma_table_t;
+32
View File
@@ -161,6 +161,36 @@ rl_callback_read_char ()
CALLBACK_READ_RETURN ();
}
#if defined (VI_MODE)
/* States that can occur while in state VIMOTION have to be checked
before RL_STATE_VIMOTION */
else if (RL_ISSTATE (RL_STATE_CHARSEARCH))
{
int k;
k = _rl_callback_data->i2;
eof = (*_rl_callback_func) (_rl_callback_data);
/* If the function `deregisters' itself, make sure the data is
cleaned up. */
if (_rl_callback_func == 0) /* XXX - just sanity check */
{
if (_rl_callback_data)
{
_rl_callback_data_dispose (_rl_callback_data);
_rl_callback_data = 0;
}
}
/* Messy case where vi motion command can be char search */
if (RL_ISSTATE (RL_STATE_VIMOTION))
{
_rl_vi_domove_motion_cleanup (k, _rl_vimvcxt);
_rl_internal_char_cleanup ();
CALLBACK_READ_RETURN ();
}
_rl_internal_char_cleanup ();
}
else if (RL_ISSTATE (RL_STATE_VIMOTION))
{
eof = _rl_vi_domove_callback (_rl_vimvcxt);
@@ -311,6 +341,8 @@ rl_callback_sigcleanup ()
}
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
RL_UNSETSTATE (RL_STATE_MULTIKEY);
if (RL_ISSTATE (RL_STATE_CHARSEARCH))
RL_UNSETSTATE (RL_STATE_CHARSEARCH);
_rl_callback_func = 0;
}
+1 -1
View File
@@ -120,7 +120,7 @@ _rl_print_prefix_color (void)
/* Returns whether any color sequence was printed. */
bool
_rl_print_color_indicator (char *f)
_rl_print_color_indicator (const char *f)
{
enum indicator_no colored_filetype;
COLOR_EXT_TYPE *ext; /* Color extension */
+3 -3
View File
@@ -114,13 +114,13 @@ enum filetype
arg_directory
};
/* Prefix color, currently same as directory */
#define C_PREFIX C_DIR
/* Prefix color, currently same as socket */
#define C_PREFIX C_SOCK
extern void _rl_put_indicator (const struct bin_str *ind);
extern void _rl_set_normal_color (void);
extern bool _rl_print_prefix_color (void);
extern bool _rl_print_color_indicator (char *f);
extern bool _rl_print_color_indicator (const char *f);
extern void _rl_prep_non_filename_text (void);
#endif /* !_COLORS_H_ */
+33 -18
View File
@@ -111,7 +111,7 @@ static int stat_char PARAMS((char *));
#endif
#if defined (COLOR_SUPPORT)
static int colored_stat_start PARAMS((char *));
static int colored_stat_start PARAMS((const char *));
static void colored_stat_end PARAMS((void));
static int colored_prefix_start PARAMS((void));
static void colored_prefix_end PARAMS((void));
@@ -128,7 +128,7 @@ static int get_y_or_n PARAMS((int));
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
static int fnprint PARAMS((const char *, int));
static int fnprint PARAMS((const char *, int, const char *));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
@@ -212,6 +212,8 @@ int rl_visible_stats = 0;
completions. The colors used are taken from $LS_COLORS, if set. */
int _rl_colored_stats = 0;
/* Non-zero means to use a color (currently magenta) to indicate the common
prefix of a set of possible word completions. */
int _rl_colored_completion_prefix = 1;
#endif
@@ -674,7 +676,7 @@ stat_char (filename)
#if defined (COLOR_SUPPORT)
static int
colored_stat_start (filename)
char *filename;
const char *filename;
{
_rl_set_normal_color ();
return (_rl_print_color_indicator (filename));
@@ -726,6 +728,8 @@ printable_part (pathname)
if (temp == 0 || *temp == '\0')
return (pathname);
else if (temp[1] == 0 && temp == pathname)
return (pathname);
/* If the basename is NULL, we might have a pathname like '/usr/src/'.
Look for a previous slash and, if one is found, return the portion
following that slash. If there's no previous slash, just return the
@@ -796,9 +800,10 @@ fnwidth (string)
#define ELLIPSIS_LEN 3
static int
fnprint (to_print, prefix_bytes)
fnprint (to_print, prefix_bytes, real_pathname)
const char *to_print;
int prefix_bytes;
const char *real_pathname;
{
int printed_len, w;
const char *s;
@@ -817,10 +822,17 @@ fnprint (to_print, prefix_bytes)
printed_len = common_prefix_len = 0;
/* Don't print only the ellipsis if the common prefix is one of the
possible completions */
if (to_print[prefix_bytes] == '\0')
possible completions. Only cut off prefix_bytes if we're going to be
printing the ellipsis, which takes precedence over coloring the
completion prefix (see print_filename() below). */
if (_rl_completion_prefix_display_length > 0 && to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats && (prefix_bytes == 0 || _rl_colored_completion_prefix <= 0))
colored_stat_start (real_pathname);
#endif
if (prefix_bytes && _rl_completion_prefix_display_length > 0)
{
char ellipsis;
@@ -891,13 +903,23 @@ fnprint (to_print, prefix_bytes)
}
if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
{
#if defined (COLOR_SUPPORT)
/* printed bytes = s - to_print */
/* printed bytes should never be > but check for paranoia's sake */
colored_prefix_end ();
if (_rl_colored_stats)
colored_stat_start (real_pathname); /* XXX - experiment */
#endif
common_prefix_len = 0;
}
}
#if defined (COLOR_SUPPORT)
/* XXX - unconditional for now */
if (_rl_colored_stats)
colored_stat_end ();
#endif
return printed_len;
}
@@ -918,7 +940,7 @@ print_filename (to_print, full_pathname, prefix_bytes)
/* Defer printing if we want to prefix with a color indicator */
if (_rl_colored_stats == 0 || rl_filename_completion_desired == 0)
#endif
printed_len = fnprint (to_print, prefix_bytes);
printed_len = fnprint (to_print, prefix_bytes, to_print);
if (rl_filename_completion_desired && (
#if defined (VISIBLE_STATS)
@@ -987,13 +1009,10 @@ print_filename (to_print, full_pathname, prefix_bytes)
extension_char = '/';
}
/* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
{
colored_stat_start (new_full_pathname);
printed_len = fnprint (to_print, prefix_bytes);
colored_stat_end ();
}
printed_len = fnprint (to_print, prefix_bytes, new_full_pathname);
#endif
xfree (new_full_pathname);
@@ -1010,15 +1029,11 @@ print_filename (to_print, full_pathname, prefix_bytes)
if (_rl_complete_mark_directories && path_isdir (s))
extension_char = '/';
/* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
{
colored_stat_start (s);
printed_len = fnprint (to_print, prefix_bytes);
colored_stat_end ();
}
printed_len = fnprint (to_print, prefix_bytes, s);
#endif
}
xfree (s);
+1 -1
View File
@@ -83,8 +83,8 @@ struct line_state
int *lbreaks;
int lbsize;
#if defined (HANDLE_MULTIBYTE)
int *wrapped_line;
int wbsize;
int *wrapped_line;
#endif
};
+8 -1
View File
@@ -249,6 +249,11 @@ the input stream, making it easy to repeat commands, insert the
arguments to a previous command into the current input line, or
fix errors in previous commands quickly.
@ifset BashFeatures
History expansion is performed immediately after a complete line
is read, before the shell breaks it into words.
@end ifset
History expansion takes place in two parts. The first is to determine
which line from the history list should be used during substitution.
The second is to select portions of that line for inclusion into the
@@ -262,7 +267,9 @@ History expansions are introduced by the appearance of the
history expansion character, which is @samp{!} by default.
@ifset BashFeatures
Only @samp{\} and @samp{'} may be used to escape the history expansion
character.
character, but the history expansion character is
also treated as quoted if it immediately precedes the closing double quote
in a double-quoted string.
@end ifset
@ifset BashFeatures
+18
View File
@@ -63,6 +63,12 @@
extern char *xmalloc PARAMS((size_t));
void initialize_readline PARAMS((void));
void too_dangerous PARAMS((char *));
int execute_line PARAMS((char *));
int valid_argument PARAMS((char *, char *));
/* The names of functions that actually do the manipulation. */
int com_list PARAMS((char *));
int com_view PARAMS((char *));
@@ -119,6 +125,7 @@ dupstr (s)
return (r);
}
int
main (argc, argv)
int argc;
char **argv;
@@ -241,6 +248,7 @@ char **fileman_completion PARAMS((const char *, int, int));
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
void
initialize_readline ()
{
/* Allow conditional parsing of the ~/.inputrc file. */
@@ -317,6 +325,7 @@ command_generator (text, state)
static char syscom[1024];
/* List the file(s) named in arg. */
int
com_list (arg)
char *arg;
{
@@ -327,6 +336,7 @@ com_list (arg)
return (system (syscom));
}
int
com_view (arg)
char *arg;
{
@@ -342,6 +352,7 @@ com_view (arg)
return (system (syscom));
}
int
com_rename (arg)
char *arg;
{
@@ -349,6 +360,7 @@ com_rename (arg)
return (1);
}
int
com_stat (arg)
char *arg;
{
@@ -377,6 +389,7 @@ com_stat (arg)
return (0);
}
int
com_delete (arg)
char *arg;
{
@@ -386,6 +399,7 @@ com_delete (arg)
/* Print out help for ARG, or for all of the commands if ARG is
not present. */
int
com_help (arg)
char *arg;
{
@@ -425,6 +439,7 @@ com_help (arg)
}
/* Change to the directory ARG. */
int
com_cd (arg)
char *arg;
{
@@ -439,6 +454,7 @@ com_cd (arg)
}
/* Print out the current working directory. */
int
com_pwd (ignore)
char *ignore;
{
@@ -456,6 +472,7 @@ com_pwd (ignore)
}
/* The user wishes to quit using this program. Just set DONE non-zero. */
int
com_quit (arg)
char *arg;
{
@@ -464,6 +481,7 @@ com_quit (arg)
}
/* Function which tells you that you can't do this. */
void
too_dangerous (caller)
char *caller;
{
+1
View File
@@ -28,6 +28,7 @@
# include <config.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
+11 -2
View File
@@ -43,11 +43,17 @@
# include <unistd.h>
#endif
#include <errno.h>
#include "history.h"
#include "histlib.h"
#include "xmalloc.h"
#if !defined (errno)
extern int errno;
#endif
/* How big to make the_history when we first allocate it. */
#define DEFAULT_HISTORY_INITIAL_SIZE 502
@@ -239,7 +245,10 @@ history_get_time (hist)
ts = hist->timestamp;
if (ts[0] != history_comment_char)
return 0;
errno = 0;
t = (time_t) strtol (ts + 1, (char **)NULL, 10); /* XXX - should use strtol() here */
if (errno == ERANGE)
return (time_t)0;
return t;
}
@@ -316,7 +325,7 @@ add_history (string)
}
}
temp = alloc_history_entry (string, hist_inittime ());
temp = alloc_history_entry ((char *)string, hist_inittime ());
the_history[history_length] = (HIST_ENTRY *)NULL;
the_history[history_length - 1] = temp;
@@ -405,7 +414,7 @@ replace_history_entry (which, line, data)
WHICH >= 0 means to replace that particular history entry's data, as
long as it matches OLD. */
void
replace_history_data (which, old, new)
_hs_replace_history_data (which, old, new)
int which;
histdata_t *old, *new;
{
+8
View File
@@ -91,6 +91,13 @@ extern void add_history_time PARAMS((const char *));
elements are numbered from 0. */
extern HIST_ENTRY *remove_history PARAMS((int));
/* Allocate a history entry consisting of STRING and TIMESTAMP and return
a pointer to it. */
extern HIST_ENTRY *alloc_history_entry PARAMS((char *, char *));
/* Copy the history entry H, but not the (opaque) data pointer */
extern HIST_ENTRY *copy_history_entry PARAMS((HIST_ENTRY *));
/* Free the history entry H and return any application-specific data
associated with it. */
extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
@@ -241,6 +248,7 @@ extern char **history_tokenize PARAMS((const char *));
extern int history_base;
extern int history_length;
extern int history_max_entries;
extern int history_offset;
extern int history_lines_read_from_file;
extern int history_lines_written_to_file;
+5 -3
View File
@@ -1,6 +1,6 @@
/* input.c -- character input functions for readline. */
/* Copyright (C) 1994-2013 Free Software Foundation, Inc.
/* Copyright (C) 1994-2015 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -216,8 +216,8 @@ rl_gather_tyi ()
#endif
result = -1;
#if defined (FIONREAD)
errno = 0;
#if defined (FIONREAD)
result = ioctl (tty, FIONREAD, &chars_avail);
if (result == -1 && errno == EIO)
return -1;
@@ -236,6 +236,8 @@ rl_gather_tyi ()
fcntl (tty, F_SETFL, tem);
if (chars_avail == -1 && errno == EAGAIN)
return 0;
if (chars_avail == -1 && errno == EIO)
return -1;
if (chars_avail == 0) /* EOF */
{
rl_stuff_char (EOF);
@@ -464,7 +466,7 @@ rl_read_key ()
if ((r = rl_gather_tyi ()) < 0) /* XXX - EIO */
{
rl_done = 1;
return ('\n');
return (errno == EIO ? (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF) : '\n');
}
else if (r > 0) /* read something */
continue;
+1 -1
View File
@@ -97,7 +97,7 @@ _rl_copy_to_kill_ring (text, append)
int slot;
/* First, find the slot to work with. */
if (_rl_last_command_was_kill == 0)
if (_rl_last_command_was_kill == 0 || rl_kill_ring == 0)
{
/* Get a new slot. */
if (rl_kill_ring == 0)
+3 -1
View File
@@ -128,7 +128,7 @@ _rl_arg_dispatch (cxt, c)
/* If we see a key bound to `universal-argument' after seeing digits,
it ends the argument but is otherwise ignored. */
if (_rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
{
if ((cxt & NUM_SAWDIGITS) == 0)
{
@@ -268,6 +268,8 @@ _rl_arg_callback (cxt)
int c, r;
c = _rl_arg_getchar ();
if (c < 0)
return (1); /* EOF */
if (_rl_argcxt & NUM_READONE)
{
+23 -8
View File
@@ -151,7 +151,7 @@ static int running_in_emacs;
#endif
/* Flags word encapsulating the current readline state. */
int rl_readline_state = RL_STATE_NONE;
unsigned long rl_readline_state = RL_STATE_NONE;
/* The current offset in the current input line. */
int rl_point;
@@ -386,7 +386,7 @@ readline (prompt)
RL_SETSTATE (RL_STATE_CALLBACK);
#endif
#if HAVE_DECL_AUDIT_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT)
#if HAVE_DECL_AUDIT_USER_TTY && defined (HAVE_LIBAUDIT_H) && defined (ENABLE_TTY_AUDIT_SUPPORT)
if (value)
_rl_audit_tty (value);
#endif
@@ -846,7 +846,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
/* Special case rl_do_lowercase_version (). */
if (func == rl_do_lowercase_version)
/* Should we do anything special if key == ANYOTHERKEY? */
return (_rl_dispatch (_rl_to_lower (key), map));
return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
rl_executing_keymap = map;
rl_executing_key = key;
@@ -916,8 +916,10 @@ _rl_dispatch_subseq (key, map, got_subseq)
default) or a timeout determined by the value of `keyseq-timeout' */
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
takes microseconds, so multiply by 1000 */
if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap
&& _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap &&
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
_rl_pushed_input_available () == 0 &&
_rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
#endif
@@ -928,6 +930,16 @@ _rl_dispatch_subseq (key, map, got_subseq)
/* Allocate new context here. Use linked contexts (linked through
cxt->ocxt) to simulate recursion */
#if defined (READLINE_CALLBACKS)
# if defined (VI_MODE)
/* If we're redoing a vi mode command and we know there is a shadowed
function corresponding to this key, just call it -- all the redoable
vi mode commands already have all the input they need, and rl_vi_redo
assumes that one call to rl_dispatch is sufficient to complete the
command. */
if (_rl_vi_redoing && RL_ISSTATE (RL_STATE_CALLBACK) &&
map[ANYOTHERKEY].function != 0)
return (_rl_subseq_result (-2, map, key, got_subseq));
# endif
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
/* Return 0 only the first time, to indicate success to
@@ -954,7 +966,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
/* Tentative inter-character timeout for potential multi-key
sequences? If no input within timeout, abort sequence and
act as if we got non-matching input. */
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued[B
takes microseconds, so multiply by 1000 */
if (_rl_keyseq_timeout > 0 &&
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
@@ -990,6 +1002,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
}
break;
}
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
key != ANYOTHERKEY &&
@@ -1022,7 +1035,7 @@ _rl_subseq_result (r, map, key, got_subseq)
type = m[ANYOTHERKEY].type;
func = m[ANYOTHERKEY].function;
if (type == ISFUNC && func == rl_do_lowercase_version)
r = _rl_dispatch (_rl_to_lower (key), map);
r = _rl_dispatch (_rl_to_lower ((unsigned char)key), map);
else if (type == ISFUNC)
{
/* If we shadowed a function, whatever it is, we somehow need a
@@ -1035,7 +1048,9 @@ _rl_subseq_result (r, map, key, got_subseq)
m[key].type = type;
m[key].function = func;
r = _rl_dispatch (key, m);
/* Don't change _rl_dispatching_keymap, set it here */
_rl_dispatching_keymap = map; /* previous map */
r = _rl_dispatch_subseq (key, m, 0);
m[key].type = nt;
m[key].function = nf;
}
+7 -5
View File
@@ -493,7 +493,7 @@ extern int rl_readline_version; /* e.g., 0x0402 */
extern int rl_gnu_readline_p;
/* Flags word encapsulating the current readline state. */
extern int rl_readline_state;
extern unsigned long rl_readline_state;
/* Says which editing mode readline is currently using. 1 means emacs mode;
0 means vi mode. */
@@ -870,9 +870,10 @@ extern int rl_inhibit_completion;
#define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
#define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
#define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
#define RL_STATE_REDISPLAYING 0x0800000 /* updating terminal display */
#define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
#define RL_STATE_DONE 0x1000000 /* done; accepted line */
#define RL_STATE_DONE 0x2000000 /* done; accepted line */
#define RL_SETSTATE(x) (rl_readline_state |= (x))
#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
@@ -883,8 +884,8 @@ struct readline_state {
int point;
int end;
int mark;
char *buffer;
int buflen;
char *buffer;
UNDO_LIST *ul;
char *prompt;
@@ -899,9 +900,10 @@ struct readline_state {
int edmode;
char *kseq;
int kseqlen;
int pendingin;
FILE *inf;
FILE *outf;
int pendingin;
char *macro;
/* signal state */
+1 -1
View File
@@ -64,7 +64,7 @@
/* Define this if you want to enable code that talks to the Linux kernel
tty auditing system. */
#define ENABLE_TTY_AUDIT_SUPPORT
/* #define ENABLE_TTY_AUDIT_SUPPORT */
/* Defaults for the various editing mode indicators, inserted at the beginning
of the last (maybe only) line of the prompt if show-mode-in-prompt is on */
+6 -3
View File
@@ -125,10 +125,11 @@ typedef struct __rl_keyseq_context
int flags;
int subseq_arg;
int subseq_retval; /* XXX */
Keymap dmap;
Keymap oldmap;
int okey;
Keymap dmap;
Keymap oldmap;
struct __rl_keyseq_context *ocxt;
int childval;
} _rl_keyseq_cxt;
@@ -427,6 +428,7 @@ extern int _rl_vi_textmod_command PARAMS((int));
extern int _rl_vi_motion_command PARAMS((int));
extern void _rl_vi_done_inserting PARAMS((void));
extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
extern int _rl_vi_domove_motion_cleanup PARAMS((int, _rl_vimotion_cxt *));
/*************************************************************************
* Undocumented private variables *
@@ -556,6 +558,7 @@ extern int _rl_undo_group_level;
/* vi_mode.c */
extern int _rl_vi_last_command;
extern int _rl_vi_redoing;
extern _rl_vimotion_cxt *_rl_vimvcxt;
#endif /* _RL_PRIVATE_H_ */
+1 -1
View File
@@ -58,7 +58,7 @@ _rl_search_cxt *_rl_nscxt = 0;
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Functions imported from the rest of the library. */
extern int _rl_free_history_entry PARAMS((HIST_ENTRY *));
extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
+9 -2
View File
@@ -610,7 +610,7 @@ rl_skip_csi_sequence (count, key)
while (ch >= 0x20 && ch < 0x40);
RL_UNSETSTATE (RL_STATE_MOREINPUT);
return 0;
return (ch < 0);
}
int
@@ -622,6 +622,8 @@ rl_arrow_keys (count, c)
RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (ch < 0)
return (1);
switch (_rl_to_upper (ch))
{
@@ -925,7 +927,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;
}
+3 -3
View File
@@ -50,7 +50,7 @@
#include "rlprivate.h"
#include "xmalloc.h"
extern void replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
@@ -129,7 +129,7 @@ rl_free_undo_list ()
orig_list = rl_undo_list;
_rl_free_undo_list (rl_undo_list);
rl_undo_list = (UNDO_LIST *)NULL;
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
_hs_replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
}
UNDO_LIST *
@@ -245,7 +245,7 @@ rl_do_undo ()
xfree (temp);
}
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
xfree (release);
}

Some files were not shown because too many files have changed in this diff Show More