summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2015-12-01 11:28:48 -0500
committerChet Ramey <chet.ramey@case.edu>2015-12-01 11:28:48 -0500
commite6f5e0c858b7c0839d346d7d55e56894648c5a33 (patch)
tree1ffb73557ab57fea0617d63d3fd14ee3b5c94eed
parentf9b024c839a3bbb9c6c2a98a16b1cf362010340a (diff)
downloadbash-e6f5e0c858b7c0839d346d7d55e56894648c5a33.tar.gz
commit bash-20151120 snapshot
-rw-r--r--COMPAT2
-rw-r--r--CWRU/CWRU.chlog79
-rw-r--r--builtins/evalfile.c5
-rw-r--r--builtins/fc.def1
-rw-r--r--builtins/jobs.def2
-rw-r--r--builtins/set.def2
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rw-r--r--doc/bash.121
-rw-r--r--doc/bashref.texi96
-rw-r--r--doc/version.texi4
-rw-r--r--findcmd.c2
-rw-r--r--lib/readline/display.c53
-rw-r--r--lib/readline/mbutil.c2
-rw-r--r--po/nb.po2
-rw-r--r--subst.c5
-rw-r--r--tests/jobs.right2
-rw-r--r--trap.c9
-rw-r--r--variables.c13
20 files changed, 232 insertions, 79 deletions
diff --git a/COMPAT b/COMPAT
index 866660b..528d8be 100644
--- a/COMPAT
+++ b/COMPAT
@@ -411,7 +411,7 @@ compat40 set
compat41 set
- interrupting a command list such as "a ; b ; c" causes the execution
- of the entire list to be aborted (in versions before bash-4.1,
+ of the entire list to be aborted (in versions before bash-4.0,
interrupting one command in a list caused the next to be executed)
- when in posix mode, single quotes in the `word' portion of a
double-quoted parameter expansion define a new quoting context and
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index 1ca1ead..060b377 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -9940,7 +9940,6 @@ subst.c
double quotes to quote the history expansion character. TENTATIVE
CHANGE, inspired by
https://savannah.gnu.org/support/index.php?108491
- NEEDS DOCUMENTATION
11/14
-----
@@ -9949,3 +9948,81 @@ jobs.c
shell_pgrp if not running in the background and subshell_environment
indicates we're not in a pipeline and not an async command. Fixes
bug reported by konsolebox <konsolebox@gmail.com>
+
+ 11/16
+ -----
+doc/{bash.1,bashref.texi}
+ - document new posix-mode behavior of not giving ! special meaning
+ within double quotes, even if histexpand is enabled
+
+ 11/17
+ -----
+builtins/evalfile.c
+ - fc_execute_file: pass FEVAL_BUILTIN flag to _evalfile so it returns
+ the value of parse_and_execute after executing the commands in the
+ file. Fixes bug reported by Chris Marusich <cmmarusich@gmail.com>
+
+ 11/20
+ -----
+subst.c
+ - process_substitute: don't unconditionally set pipeline_pgrp to
+ shell_pgrp; do that only if pipeline_pgrp == 0 (we haven't forked
+ yet) or if we know we haven't forked for a command, a pipeline,
+ or an async command. Fixes bug reported by
+ <gnu.20.drkshadow@spamgourmet.com>
+ as https://savannah.gnu.org/support/index.php?108593
+
+ 11/24
+ -----
+variables.c
+ - set_pwd: inherit the value of OLDPWD from the initial environment
+ if it names a directory. From a report from John Wiersba
+ <jrw32982@yahoo.com>
+
+builtins/set.def
+ - -T: fix help text to note that the DEBUG and RETURN traps are both
+ inherited if this is set. Report from Grisha Levin
+ <grishalevit@gmail.com>
+
+doc/{bash.1,bashref.texi}
+ - HISTIGNORE,GLOBIGNORE: note that the pattern matching is subject to
+ the setting of the `extglob' variable. Clarification raised by
+ Aharon Robbins <arnold@skeeve.com>
+
+builtins/jobs.def,doc/{bash.1,bashref.texi}
+ - disown: add text to synopsis making it clear that disown takes a
+ pid argument. From a report from Matthew Stanfield
+ <matthew@i-dig.info>
+
+findcmd.c,doc/{bash.1,bashref.texi}
+ - EXECIGNORE: change pattern matching to use FNMATCH_EXTFLAG like other
+ IGNORE variables. From a report from Aharon Robbins <arnold@skeeve.com>
+
+trap.c
+ - _run_trap_internal: make sure to catch and use return values supplied
+ as arguments to `return'; instead of just catching return, make sure
+ we use return_catch_value as well. Fixes bug reported by
+ Grisha Levit <grishalevit@gmail.com>, affects RETURN, DEBUG, ERROR
+ traps
+
+ 11/30
+ -----
+lib/readline/display.c
+ - rl_redisplay: fix code that deals with prompts that contain
+ multibyte characters whose physical length is longer than the screen
+ width (so the prompt line wraps) to deal with invisible characters
+ in the prompt and set the inv_lbreaks offsets correctly and set
+ lpos appropriately
+ - _rl_move_cursor_relative: always called with either visible line or
+ invisible line. Decide whether we are being called with the invisible
+ line (or a portion thereof) as the DATA argument; make sure to account
+ for invisible characters in the last line of the prompt by offsetting
+ the desired buffer offset (NEW) by where DATA starts in invisible line
+ and checking whether that is past the last invisible character in
+ the prompt
+ - _rl_move_cursor_relative: do the same for the visible line by using
+ the visible line lbreaks array instead of _rl_screenwidth, since
+ that fails in the presence of multibyte characters (buffer offset
+ vs. physical screen position). These fix bug with prompts with
+ multibyte characters and invisible characters that are longer than
+ the screen width reported by Ryo Furue <ryofurue@gmail.com>
diff --git a/builtins/evalfile.c b/builtins/evalfile.c
index 558970f..eb51c27 100644
--- a/builtins/evalfile.c
+++ b/builtins/evalfile.c
@@ -355,8 +355,9 @@ fc_execute_file (filename)
int flags;
/* We want these commands to show up in the history list if
- remember_on_history is set. */
- flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE;
+ remember_on_history is set. We use FEVAL_BUILTIN to return
+ the result of parse_and_execute. */
+ flags = FEVAL_ENOENTOK|FEVAL_HISTORY|FEVAL_REGFILE|FEVAL_BUILTIN;
return (_evalfile (filename, flags));
}
#endif /* HISTORY */
diff --git a/builtins/fc.def b/builtins/fc.def
index 92b1877..cd989e9 100644
--- a/builtins/fc.def
+++ b/builtins/fc.def
@@ -462,7 +462,6 @@ fc_builtin (list)
echo_input_at_read = 1;
retval = fc_execute_file (fn);
-
run_unwind_frame ("fc builtin");
return (retval);
diff --git a/builtins/jobs.def b/builtins/jobs.def
index 60bbadc..22dbf2f 100644
--- a/builtins/jobs.def
+++ b/builtins/jobs.def
@@ -213,7 +213,7 @@ execute_list_with_replacements (list)
$BUILTIN disown
$FUNCTION disown_builtin
$DEPENDS_ON JOB_CONTROL
-$SHORT_DOC disown [-h] [-ar] [jobspec ...]
+$SHORT_DOC disown [-h] [-ar] [jobspec ... | pid ...]
Remove jobs from current shell.
Removes each JOBSPEC argument from the table of active jobs. Without
diff --git a/builtins/set.def b/builtins/set.def
index 68491d3..829c659 100644
--- a/builtins/set.def
+++ b/builtins/set.def
@@ -141,7 +141,7 @@ Options:
#endif /* BANG_HISTORY */
-P If set, do not resolve symbolic links when executing commands
such as cd which change the current directory.
- -T If set, the DEBUG trap is inherited by shell functions.
+ -T If set, the DEBUG and RETURN traps are inherited by shell functions.
-- Assign any remaining arguments to the positional parameters.
If there are no remaining arguments, the positional parameters
are unset.
diff --git a/config.h.in b/config.h.in
index a5bdfa9..894892f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -748,6 +748,9 @@
/* Define if you have the raise function. */
#undef HAVE_RAISE
+/* Define if you have the random function. */
+#undef HAVE_RANDOM
+
/* Define if you have the readlink function. */
#undef HAVE_READLINK
diff --git a/configure b/configure
index 3bd5c9b..52f6f5c 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac for Bash 4.4, version 4.075.
+# From configure.ac for Bash 4.4, version 4.076.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 4.4-beta.
#
@@ -9865,7 +9865,7 @@ fi
for ac_func in bcopy bzero confstr faccessat fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
- imaxdiv memmove pathconf putenv raise regcomp regexec \
+ imaxdiv memmove pathconf putenv raise random regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf syslog tcgetattr times ttyname tzset unsetenv
do :
diff --git a/configure.ac b/configure.ac
index 1c96be8..f0d4aee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Bash 4.4, version 4.075])dnl
+AC_REVISION([for Bash 4.4, version 4.076])dnl
define(bashvers, 4.4)
define(relstatus, beta)
@@ -792,7 +792,7 @@ AC_REPLACE_FUNCS(rename)
dnl checks for c library functions
AC_CHECK_FUNCS(bcopy bzero confstr faccessat fnmatch \
getaddrinfo gethostbyname getservbyname getservent inet_aton \
- imaxdiv memmove pathconf putenv raise regcomp regexec \
+ imaxdiv memmove pathconf putenv raise random regcomp regexec \
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
sysconf syslog tcgetattr times ttyname tzset unsetenv)
diff --git a/doc/bash.1 b/doc/bash.1
index 96f4f73..92b507a 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Wed Nov 4 09:56:06 EST 2015
+.\" Last Change: Mon Nov 16 10:54:48 EST 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 November 4" "GNU Bash 4.4"
+.TH BASH 1 "2015 November 16" "GNU Bash 4.4"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1061,6 +1061,8 @@ of all characters within the quotes, with the exception of
.BR \e ,
and, when history expansion is enabled,
.BR ! .
+When the shell is in \fIposix mode\fP, the \fB!\fP has no special meaning
+within double quotes, even when history expansion is enabled.
The characters
.B $
and
@@ -2011,7 +2013,7 @@ Similar to
used when the shell is invoked in POSIX mode.
.TP
.B EXECIGNORE
-A colon-separated list of extended glob patterns (see \fBPattern Matching\fP)
+A colon-separated list of shell patterns (see \fBPattern Matching\fP)
defining the list of filenames to be ignored by command search.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution.
@@ -2019,6 +2021,8 @@ This does not affect the behavior of the \fB[\fP, \fBtest\fP, and \fB[[\fP
commands.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
+The pattern matching honors the setting of the \fBextglob\fP shell
+option.
.TP
.B FCEDIT
The default editor for the
@@ -2120,6 +2124,8 @@ The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
.SM
.BR HISTIGNORE .
+The pattern matching honors the setting of the \fBextglob\fP shell
+option.
.TP
.B HISTSIZE
The number of commands to remember in the command history (see
@@ -3492,6 +3498,8 @@ option is disabled when
.SM
.B GLOBIGNORE
is unset.
+The pattern matching honors the setting of the \fBextglob\fP shell
+option.
.PP
\fBPattern Matching\fP
.PP
@@ -7778,7 +7786,7 @@ invalid option is supplied or \fIn\fP indexes beyond the end
of the directory stack.
.RE
.TP
-\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIjobspec\fP ...]
+\fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIjobspec\fP ... | \fIpid\fP ... ]
Without options, remove each
.I jobspec
from the table of active jobs.
@@ -9480,7 +9488,10 @@ If set,
.B bash
changes its behavior to that of version 3.2 with respect to
locale-specific string comparison when using the \fB[[\fP
-conditional command's \fB<\fP and \fB>\fP operators (see previous item).
+conditional command's \fB<\fP and \fB>\fP operators (see previous item)
+and the effect of interrupting a command list.
+Bash versions 3.2 and earlier continue with the next command in the list
+after one terminates due to an interrupt.
.TP 8
.B compat40
If set,
diff --git a/doc/bashref.texi b/doc/bashref.texi
index efea432..40b2f05 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -450,6 +450,11 @@ Enclosing characters in double quotes (@samp{"}) preserves the literal value
of all characters within the quotes, with the exception of
@samp{$}, @samp{`}, @samp{\},
and, when history expansion is enabled, @samp{!}.
+When the shell is in
+@sc{posix} mode (@pxref{Bash POSIX Mode}),
+the @samp{!} has no special meaning
+within double quotes, even when history expansion is enabled.
+The characters
The characters @samp{$} and @samp{`}
retain their special meaning within double quotes (@pxref{Shell Expansions}).
The backslash retains its special meaning only when followed by one of
@@ -5046,7 +5051,10 @@ bash-4.1 and later use the current locale's collation sequence and strcoll(3).
If set, Bash
changes its behavior to that of version 3.2 with respect to locale-specific
string comparison when using the @code{[[}
-conditional command's @samp{<} and @samp{>} operators (see previous item).
+conditional command's @samp{<} and @samp{>} operators (see previous item)
+and the effect of interrupting a command list.
+Bash versions 3.2 and earlier continue with the next command in the list
+after one terminates due to an interrupt.
@item compat40
If set, Bash
@@ -5704,7 +5712,7 @@ The numeric effective user id of the current user. This variable
is readonly.
@item EXECIGNORE
-A colon-separated list of extended glob patterns (@pxref{Pattern Matching})
+A colon-separated list of shell patterns (@pxref{Pattern Matching})
defining the list of filenames to be ignored by command search.
Files whose full pathnames match one of these patterns are not considered
executable files for the purposes of completion and command execution.
@@ -5712,6 +5720,8 @@ This does not affect the behavior of the @code{[}, @code{test}, and @code{[[}
commands.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
+The pattern matching honors the setting of the @code{extglob} shell
+option.
@item FCEDIT
The editor used as a default by the @option{-e} option to the @code{fc}
@@ -5756,6 +5766,8 @@ be ignored by filename expansion.
If a filename matched by a filename expansion pattern also matches one
of the patterns in @env{GLOBIGNORE}, it is removed from the list
of matches.
+The pattern matching honors the setting of the @code{extglob} shell
+option.
@item GROUPS
An array variable containing the list of groups of which the current
@@ -5832,6 +5844,8 @@ before attempting a match.
The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
@env{HISTIGNORE}.
+The pattern matching honors the setting of the @code{extglob} shell
+option.
@env{HISTIGNORE} subsumes the function of @env{HISTCONTROL}. A
pattern of @samp{&} is identical to @code{ignoredups}, and a
@@ -7305,9 +7319,7 @@ is stopped is `Stopped(@var{signame})', where @var{signame} is, for
example, @code{SIGTSTP}.
@item
-The @code{bg} builtin uses the required format to describe each job placed
-in the background, which does not include an indication of whether the job
-is the current or previous job.
+Alias expansion is always enabled, even in non-interactive shells.
@item
Reserved words appearing in a context where reserved words are recognized
@@ -7328,40 +7340,10 @@ Tilde expansion is only performed on assignments preceding a command
name, rather than on all assignment statements on the line.
@item
-The @code{command} builtin does not prevent builtins that take assignment
-statements as arguments from expanding them as assignment statements;
-when not in @sc{posix} mode, assignment builtins lose their assignment
-statement expansion properties when preceded by @code{command}.
-
-@item
The default history file is @file{~/.sh_history} (this is the
default value of @env{$HISTFILE}).
@item
-The output of @samp{kill -l} prints all the signal names on a single line,
-separated by spaces, without the @samp{SIG} prefix.
-
-@item
-The @code{kill} builtin does not accept signal names with a @samp{SIG}
-prefix.
-
-@item
-Non-interactive shells exit if @var{filename} in @code{.} @var{filename}
-is not found.
-
-@item
-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
-the @code{eval} builtin.
-
-@item
Redirection operators do not perform filename expansion on the word
in the redirection unless the shell is interactive.
@@ -7406,6 +7388,10 @@ The parser does not recognize @code{time} as a reserved word if the next
token begins with a @samp{-}.
@item
+The @samp{!} character does not introduce history expansion within a
+double-quoted string, even if the @code{histexpand} option is enabled.
+
+@item
If a @sc{posix} special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the @sc{posix} standard, and include things like passing incorrect options,
@@ -7430,6 +7416,22 @@ variable in a @code{for} statement or the selection variable in a
@code{select} statement is a readonly variable.
@item
+Non-interactive shells exit if @var{filename} in @code{.} @var{filename}
+is not found.
+
+@item
+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
+the @code{eval} builtin.
+
+@item
Process substitution is not available.
@item
@@ -7446,6 +7448,25 @@ shell environment after the function returns, as if a @sc{posix}
special builtin command had been executed.
@item
+The @code{command} builtin does not prevent builtins that take assignment
+statements as arguments from expanding them as assignment statements;
+when not in @sc{posix} mode, assignment builtins lose their assignment
+statement expansion properties when preceded by @code{command}.
+
+@item
+The @code{bg} builtin uses the required format to describe each job placed
+in the background, which does not include an indication of whether the job
+is the current or previous job.
+
+@item
+The output of @samp{kill -l} prints all the signal names on a single line,
+separated by spaces, without the @samp{SIG} prefix.
+
+@item
+The @code{kill} builtin does not accept signal names with a @samp{SIG}
+prefix.
+
+@item
The @code{export} and @code{readonly} builtin commands display their
output in the format required by @sc{posix}.
@@ -7474,9 +7495,6 @@ When the @code{inherit_errexit} option is not enabled,
Bash clears the @option{-e} option in such subshells.
@item
-Alias expansion is always enabled, even in non-interactive shells.
-
-@item
When the @code{alias} builtin displays alias definitions, it does not
display them with a leading @samp{alias } unless the @option{-p} option
is supplied.
@@ -7793,7 +7811,7 @@ of the shell, the return status is 127.
@item disown
@btindex disown
@example
-disown [-ar] [-h] [@var{jobspec} @dots{}]
+disown [-ar] [-h] [@var{jobspec} @dots{} | @var{pid} @dots{} ]
@end example
Without options, remove each @var{jobspec} from the table of
diff --git a/doc/version.texi b/doc/version.texi
index b84c319..70ddb90 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -2,10 +2,10 @@
Copyright (C) 1988-2015 Free Software Foundation, Inc.
@end ignore
-@set LASTCHANGE Wed Nov 4 09:56:06 EST 2015
+@set LASTCHANGE Mon Nov 16 10:54:23 EST 2015
@set EDITION 4.4
@set VERSION 4.4
-@set UPDATED 4 November 2015
+@set UPDATED 16 November 2015
@set UPDATED-MONTH November 2015
diff --git a/findcmd.c b/findcmd.c
index 44c0271..eab14fc 100644
--- a/findcmd.c
+++ b/findcmd.c
@@ -104,7 +104,7 @@ exec_name_should_ignore (name)
struct ign *p;
for (p = execignore.ignores; p && p->val; p++)
- if (strmatch (p->val, (char *)name, FNM_EXTMATCH|FNM_CASEFOLD) != FNM_NOMATCH)
+ if (strmatch (p->val, (char *)name, FNMATCH_EXTFLAG|FNM_CASEFOLD) != FNM_NOMATCH)
return 1;
return 0;
}
diff --git a/lib/readline/display.c b/lib/readline/display.c
index bce4897..58ae071 100644
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -192,6 +192,8 @@ static int prompt_multibyte_chars;
/* Number of lines currently on screen minus 1. */
int _rl_vis_botlin = 0;
+static int _rl_inv_botlin = 0;
+
/* Variables used only in this file. */
/* The last left edge of text that was displayed. This is used when
doing horizontal scrolling. It shifts in thirds of a screenwidth. */
@@ -737,6 +739,8 @@ rl_redisplay ()
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
+ /* lpos is a physical cursor position, so it needs to be adjusted by the
+ number of invisible characters in the prompt, per line */
lpos = prompt_physical_chars + modmark;
#if defined (HANDLE_MULTIBYTE)
@@ -757,6 +761,16 @@ rl_redisplay ()
while (lpos >= _rl_screenwidth)
{
int z, p;
+ int nocorrect, wadjust;
+
+ nocorrect = 0;
+ /* Adjust depending on the invisible characters in the line. We use a
+ heuristic based on experience: invisible characters nearly always
+ appear in the first and last lines of the prompt */
+ wadjust = (newlines == 0)
+ ? prompt_invis_chars_first_line
+ : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
+
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
prompt_invis_chars_first_line variable could be made into an array
@@ -767,11 +781,14 @@ rl_redisplay ()
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
{
+ nocorrect = 1;
n0 = num;
temp = local_prompt_len;
while (num < temp)
{
- z = _rl_col_width (local_prompt, n0, num, 1);
+ /* This has to take invisible characters in the prompt into
+ account. */
+ z = _rl_col_width (local_prompt, n0, num, 1) - wadjust;
if (z > _rl_screenwidth)
{
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
@@ -798,16 +815,18 @@ rl_redisplay ()
/* Now account for invisible characters in the current line. */
/* XXX - this assumes that the invisible characters may be split, but only
between the first and the last lines. */
- temp += (newlines == 0) ? prompt_invis_chars_first_line
- : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
+ if (nocorrect == 0)
+ temp += wadjust;
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
+ /* lpos is a physical cursor position, so it needs to take the invisible
+ characters into account. */
if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0)
- lpos -= _rl_col_width (local_prompt, n0, num, 1);
+ lpos -= _rl_col_width (local_prompt, n0, num, 1) - wadjust;
else
#endif
- lpos -= _rl_screenwidth;
+ lpos -= _rl_screenwidth - wadjust;
}
prompt_last_screen_line = newlines;
@@ -999,7 +1018,7 @@ rl_redisplay ()
lb_linenum = newlines;
}
- inv_botlin = lb_botlin = newlines;
+ inv_botlin = lb_botlin = _rl_inv_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
@@ -2041,7 +2060,8 @@ rl_redraw_prompt_last_line ()
(Well, when we don't have multibyte characters, _rl_last_c_pos is a
buffer index.)
DATA is the contents of the screen line of interest; i.e., where
- the movement is being done. */
+ the movement is being done.
+ DATA is always the visible line or the invisible line */
void
_rl_move_cursor_relative (new, data)
int new;
@@ -2051,6 +2071,7 @@ _rl_move_cursor_relative (new, data)
int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */
int adjust;
+ int in_invisline;
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
@@ -2089,14 +2110,28 @@ _rl_move_cursor_relative (new, data)
if (displaying_prompt_first_line == 0)
adjust = 0;
+ /* yet another special case: printing the last line of a prompt with
+ multibyte characters and invisible characters whose printable length
+ exceeds the screen width with the last invisible character
+ (prompt_last_invisible) in the last line. IN_INVISLINE is the
+ offset of DATA in invisible_line */
+ in_invisline = 0;
+ if (data > invisible_line && data < invisible_line+inv_lbreaks[_rl_inv_botlin+1])
+ in_invisline = data - invisible_line;
+
/* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
+ /* NEW is relative to the current displayed line, while
+ PROMPT_LAST_INVISIBLE is relative to the entire (wrapped) line.
+ Need a way to reconcile these two variables by turning NEW into a
+ buffer position relative to the start of the line */
if (adjust && ((new > prompt_last_invisible) || /* XXX - don't use woff here */
- (prompt_physical_chars >= _rl_screenwidth &&
+ (new+in_invisline > prompt_last_invisible) || /* invisible line */
+ (prompt_physical_chars >= _rl_screenwidth && /* visible line */
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset >= woff && dpos >= woff &&
- new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset))))
+ new > (prompt_last_invisible-(vis_lbreaks[_rl_last_v_pos])-wrap_offset))))
/* XXX last comparison might need to be >= */
{
dpos -= woff;
diff --git a/lib/readline/mbutil.c b/lib/readline/mbutil.c
index b036e0c..b1befb4 100644
--- a/lib/readline/mbutil.c
+++ b/lib/readline/mbutil.c
@@ -145,7 +145,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
return point;
}
-static int
+/*static*/ int
_rl_find_prev_mbchar_internal (string, seed, find_non_zero)
char *string;
int seed, find_non_zero;
diff --git a/po/nb.po b/po/nb.po
index 7b2f255..ed9519d 100644
--- a/po/nb.po
+++ b/po/nb.po
@@ -3416,7 +3416,7 @@ msgid ""
" Returns success unless an invalid option is given or an error occurs.\n"
" If -x is used, returns the exit status of COMMAND."
msgstr ""
-"VIs status for bakgrunnsjobber.\n"
+"Vis status for bakgrunnsjobber.\n"
" \n"
" Vis aktive bakgrunnsjobber. JOBBSPES begrenser utskrift til valgt jobb.\n"
" Hvis ingenting er valgt, vises status for alle aktive jobber.\n"
diff --git a/subst.c b/subst.c
index 5517fa6..fb808b1 100644
--- a/subst.c
+++ b/subst.c
@@ -1848,7 +1848,7 @@ skip_to_delim (string, start, delims, flags)
else if (c == '\'')
i = skip_single_quoted (string, slen, ++i, 0);
/* The posixly_correct test makes posix-mode shells allow double quotes
- to quote the history expansio character */
+ to quote the history expansion character */
else if (histexp && posixly_correct == 0 && c == '"')
{
dquote = 1 - dquote;
@@ -5538,7 +5538,8 @@ process_substitute (string, open_for_read_in_child)
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
- pipeline_pgrp = shell_pgrp;
+ if (pipeline_pgrp == 0 || (subshell_environment & (SUBSHELL_PIPE|SUBSHELL_FORK|SUBSHELL_ASYNC)) == 0)
+ pipeline_pgrp = shell_pgrp;
save_pipeline (1);
#endif /* JOB_CONTROL */
diff --git a/tests/jobs.right b/tests/jobs.right
index 7af54eb..c3ee944 100644
--- a/tests/jobs.right
+++ b/tests/jobs.right
@@ -61,7 +61,7 @@ fg: usage: fg [job_spec]
./jobs.tests: line 99: bg: -s: invalid option
bg: usage: bg [job_spec ...]
./jobs.tests: line 104: disown: -s: invalid option
-disown: usage: disown [-h] [-ar] [jobspec ...]
+disown: usage: disown [-h] [-ar] [jobspec ... | pid ...]
./jobs.tests: line 108: disown: %1: no such job
./jobs.tests: line 111: disown: %2: no such job
wait-for-non-child
diff --git a/trap.c b/trap.c
index 17ed9ee..5e932be 100644
--- a/trap.c
+++ b/trap.c
@@ -994,9 +994,12 @@ _run_trap_internal (sig, tag)
if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
flags |= SEVAL_RESETLINE;
if (function_code == 0)
- parse_and_execute (trap_command, tag, flags);
-
- trap_exit_value = last_command_exit_value;
+ {
+ parse_and_execute (trap_command, tag, flags);
+ trap_exit_value = last_command_exit_value;
+ }
+ else
+ trap_exit_value = return_catch_value;
#if defined (JOB_CONTROL)
if (sig != DEBUG_TRAP) /* run_debug_trap does this */
diff --git a/variables.c b/variables.c
index 8fb2721..a3661d1 100644
--- a/variables.c
+++ b/variables.c
@@ -884,10 +884,15 @@ set_pwd ()
}
/* According to the Single Unix Specification, v2, $OLDPWD is an
- `environment variable' and therefore should be auto-exported.
- Make a dummy invisible variable for OLDPWD, and mark it as exported. */
- temp_var = bind_variable ("OLDPWD", (char *)NULL, 0);
- VSETATTR (temp_var, (att_exported | att_invisible));
+ `environment variable' and therefore should be auto-exported. If we
+ don't find OLDPWD in the environment, or it doesn't name a directory,
+ make a dummy invisible variable for OLDPWD, and mark it as exported. */
+ temp_var = find_variable ("OLDPWD");
+ if (temp_var == 0 || value_cell (temp_var) == 0 || file_isdir (value_cell (temp_var)) == 0)
+ {
+ temp_var = bind_variable ("OLDPWD", (char *)NULL, 0);
+ VSETATTR (temp_var, (att_exported | att_invisible));
+ }
}
/* Make a variable $PPID, which holds the pid of the shell's parent. */