commit bash-20110107 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 22:13:10 -05:00
parent 54a1fa7c24
commit 9fc76425ef
15 changed files with 907 additions and 1030 deletions
+21
View File
@@ -11,8 +11,29 @@ b. Fixed a bug that caused unary `+' and `-' arithmetic operators to have a
c. Fixed a bug that caused simple commands in a pipeline to affect the exit
status ($?) seen by subsequent pipeline commands.
d. A number of cygwin-specific changes to avoid the use of text-mode files
and file access, and to make sure that \r is handled correctly.
e. Fixed a bug that caused the read builtin to not return failure if an
attempt is made to assign to a readonly variable.
f. Fixed a bug that caused some builtin usage messages to not be translated.
g. Fixed a bug that caused the getopts builtin to not return failure if an
attempt is made to assign to a readonly variable. Now it returns 2.
h. Fixed the cd and pwd builtins to return failure if PWD is readonly and
cannot be assigned to.
i. Added code to check the return value of access(2) on Solaris systems,
since it returns success for executable tests (e.g., `test -x') when
run by root, even if the file permissions don't allow execution.
2. Changes to Readline
a. Fixed a bug that caused directory names in words to be completed to not
be dequoted correctly.
3. New Features in Bash
4. New Features in Readline
+21
View File
@@ -11,8 +11,29 @@ b. Fixed a bug that caused unary `+' and `-' arithmetic operators to have a
c. Fixed a bug that caused simple commands in a pipeline to affect the exit
status ($?) seen by subsequent pipeline commands.
d. A number of cygwin-specific changes to avoid the use of text-mode files
and file access, and to make sure that \r is handled correctly.
e. Fixed a bug that caused the read builtin to not return failure if an
attempt is made to assign to a readonly variable.
f. Fixed a bug that caused some builtin usage messages to not be translated.
g. Fixed a bug that caused the getopts builtin to not return failure if an
attempt is made to assign to a readonly variable. Now it returns 2.
h. Fixed the cd and pwd builtins to return failure if PWD is readonly and
cannot be assigned to.
i. Added code to check the return value of access(2) on Solaris systems,
since it returns success for executable tests (e.g., `test -x') when
run by root, even if the file permissions don't allow execution.
2. Changes to Readline
a. Fixed a bug that caused directory names in words to be completed to not
be dequoted correctly.
3. New Features in Bash
4. New Features in Readline
+66
View File
@@ -1,3 +1,69 @@
This document details the changes between this version, bash-4.2-rc1,
and the previous version, bash-4.2-beta.
1. Changes to Bash
a. Fixed a bug that caused some redirection errors to leak file descriptors.
b. Fixed a bug that caused unary `+' and `-' arithmetic operators to have a
higher precedence than unary `!' and `~'.
c. Fixed a bug that caused simple commands in a pipeline to affect the exit
status ($?) seen by subsequent pipeline commands.
d. A number of cygwin-specific changes to avoid the use of text-mode files
and file access, and to make sure that \r is handled correctly.
e. Fixed a bug that caused the read builtin to not return failure if an
attempt is made to assign to a readonly variable.
f. Fixed a bug that caused some builtin usage messages to not be translated.
g. Fixed a bug that caused the getopts builtin to not return failure if an
attempt is made to assign to a readonly variable. Now it returns 2.
h. Fixed the cd and pwd builtins to return failure if PWD is readonly and
cannot be assigned to.
2. Changes to Readline
a. Fixed a bug that caused directory names in words to be completed to not
be dequoted correctly.
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.2-beta,
and the previous version, bash-4.2-alpha.
1. Changes to Bash
a. Fixed a bug that caused the \W prompt string escape to not add a closing
NULL.
b. Fixed a bug that caused partially-quoted words that were not subject to
word splitting to retained quoted NULLs.
c. Added considerable efficiency speedups when pattern matching in multibyte
locales by skipping multibyte character functions where possible.
d. Added considerable speedups to variable expansion when in multibyte locales.
e. Fixed a bug that caused the expansion of $* when there are no positional
parameters to cause the shell to dump core when used in a pattern
matching context.
f. Fixed a bug that caused variable expansions preceding regular builtins to
not change the shell environment during their execution.
2. Changes to Readline
a. Fixed a bug that made an explicit argument of 0 to yank-last-arg behave
as if it were a negative argument.
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.2-alpha,
and the previous version, bash-4.1-release.
+43 -1
View File
@@ -1,3 +1,44 @@
This document details the changes between this version, bash-4.2-rc1,
and the previous version, bash-4.2-beta.
1. Changes to Bash
a. Fixed a bug that caused some redirection errors to leak file descriptors.
b. Fixed a bug that caused unary `+' and `-' arithmetic operators to have a
higher precedence than unary `!' and `~'.
c. Fixed a bug that caused simple commands in a pipeline to affect the exit
status ($?) seen by subsequent pipeline commands.
d. A number of cygwin-specific changes to avoid the use of text-mode files
and file access, and to make sure that \r is handled correctly.
e. Fixed a bug that caused the read builtin to not return failure if an
attempt is made to assign to a readonly variable.
f. Fixed a bug that caused some builtin usage messages to not be translated.
g. Fixed a bug that caused the getopts builtin to not return failure if an
attempt is made to assign to a readonly variable. Now it returns 2.
h. Fixed the cd and pwd builtins to return failure if PWD is readonly and
cannot be assigned to.
i. Added code to check the return value of access(2) on Solaris systems,
since it returns success for executable tests (e.g., `test -x') when
run by root, even if the file permissions don't allow execution.
2. Changes to Readline
a. Fixed a bug that caused directory names in words to be completed to not
be dequoted correctly.
3. New Features in Bash
4. New Features in Readline
------------------------------------------------------------------------------
This document details the changes between this version, bash-4.2-beta,
and the previous version, bash-4.2-alpha.
@@ -15,7 +56,8 @@ c. Added considerable efficiency speedups when pattern matching in multibyte
d. Added considerable speedups to variable expansion when in multibyte locales.
e. Fixed a bug that caused the expansion of $* when there are no positional
parameters to cause the shell to dump core.
parameters to cause the shell to dump core when used in a pattern
matching context.
f. Fixed a bug that caused variable expansions preceding regular builtins to
not change the shell environment during their execution.
+47
View File
@@ -10908,3 +10908,50 @@ subst.c
doc/{bash.1,bashref.texi}
- changes to the readonly documentation suggested by Jan Schampera
<jan.schampera@web.de>
1/4
---
builtins/read.def
- change bind_read_variable to consistently return NULL if there is some
kind of variable assignment error (e.g., assigning to a readonly or
noassign var)
- change read builtin to only call stupidly_hack_special_variables if
bind_read_variable returns non-NULL
- change read_builtin to return EXECUTION_FAILURE if there is an
assignment error (e.g., assigning to a readonly or noassign var).
Fixes bug reported by Jan Schampera <jan.schampera@web.de>
1/5
---
builtins/{help.def,common.c}
- change uses of a builtin's `short_doc' member to go through gettext
for possible translation before being displayed. Suggestion from
<goeran@uddeborg.se>
1/6
---
shell.h
- new exit status define: EX_MISCERROR (2)
builtins/getopts.def
- change getopts_bind_variable to return error if an attempt is made
to assign to a variable with the `noassign' attribute
- change getopts_bind_variable to return EX_MISCERROR if attempt is
made to assign to readonly or noassign variable
builtins/cd.def
- change setpwd to return an int and return failure when PWD is
readonly; success otherwise
- change bindpwd to return failure if setpwd returns EXECUTION_FAILURE.
Inspired by message from Eric Blake <eblake@redhat.com>
- change pwd builtin to return failure if PWD is readonly (and setpwd
returns EXECUTION_FAILURE)
1/8
---
lib/sh/eaccess.c
- on FreeBSD and Solaris, check the result of access(2) with mode X_OK
for root by checking sh_stataccess(). Same code as was added to
check result of eaccess(). Fixes Solaris 11 problem reported by
<cloyce@headgear.org>
+44
View File
@@ -10902,3 +10902,47 @@ subst.c
- when creating pipes for command substitution, make sure to
tell stdio that the mode of the underlying file descriptor may have
changed from text to binary
1/3
---
doc/{bash.1,bashref.texi}
- changes to the readonly documentation suggested by Jan Schampera
<jan.schampera@web.de>
1/4
---
builtins/read.def
- change bind_read_variable to consistently return NULL if there is some
kind of variable assignment error (e.g., assigning to a readonly or
noassign var)
- change read builtin to only call stupidly_hack_special_variables if
bind_read_variable returns non-NULL
- change read_builtin to return EXECUTION_FAILURE if there is an
assignment error (e.g., assigning to a readonly or noassign var).
Fixes bug reported by Jan Schampera <jan.schampera@web.de>
1/5
---
builtins/{help.def,common.c}
- change uses of a builtin's `short_doc' member to go through gettext
for possible translation before being displayed. Suggestion from
<goeran@uddeborg.se>
1/6
---
shell.h
- new exit status define: EX_MISCERROR (2)
builtins/getopts.def
- change getopts_bind_variable to return error if an attempt is made
to assign to a variable with the `noassign' attribute
- change getopts_bind_variable to return EX_MISCERROR if attempt is
made to assign to readonly or noassign variable
builtins/cd.def
- change setpwd to return an int and return failure when PWD is
readonly; success otherwise
- change bindpwd to return failure if setpwd returns EXECUTION_FAILURE.
Inspired by message from Eric Blake <eblake@redhat.com>
- change pwd builtin to return failure if PWD is readonly (and setpwd
returns EXECUTION_FAILURE)
+14 -6
View File
@@ -58,7 +58,7 @@ extern int array_needs_making;
extern const char * const bash_getcwd_errstr;
static int bindpwd __P((int));
static void setpwd __P((char *));
static int setpwd __P((char *));
static char *resetpwd __P((char *));
static int change_to_directory __P((char *, int));
@@ -101,7 +101,7 @@ Returns 0 if the directory is changed, and if $PWD is set successfully when
$END
/* Just set $PWD, don't change OLDPWD. Used by `pwd -P' in posix mode. */
static void
static int
setpwd (dirname)
char *dirname;
{
@@ -110,11 +110,14 @@ setpwd (dirname)
old_anm = array_needs_making;
tvar = bind_variable ("PWD", dirname ? dirname : "", 0);
if (old_anm == 0 && array_needs_making && exported_p (tvar))
if (tvar && readonly_p (tvar))
return EXECUTION_FAILURE;
if (tvar && old_anm == 0 && array_needs_making && exported_p (tvar))
{
update_export_env_inplace ("PWD=", 4, dirname ? dirname : "");
array_needs_making = 0;
}
return EXECUTION_SUCCESS;
}
static int
@@ -136,13 +139,17 @@ bindpwd (no_symlinks)
pwdvar = get_string_value ("PWD");
tvar = bind_variable ("OLDPWD", pwdvar, 0);
if (tvar && readonly_p (tvar))
r = EXECUTION_FAILURE;
if (old_anm == 0 && array_needs_making && exported_p (tvar))
{
update_export_env_inplace ("OLDPWD=", 7, pwdvar);
array_needs_making = 0;
}
setpwd (dirname);
if (setpwd (dirname) == EXECUTION_FAILURE)
r = EXECUTION_FAILURE;
if (dirname == 0 && eflag)
r = EXECUTION_FAILURE;
@@ -404,13 +411,14 @@ pwd_builtin (list)
if (directory)
{
opt = EXECUTION_SUCCESS;
printf ("%s\n", directory);
/* This is dumb but posix-mandated. */
if (posixly_correct && pflag)
setpwd (directory);
opt = setpwd (directory);
if (directory != the_current_working_directory)
free (directory);
return (sh_chkwrite (EXECUTION_SUCCESS));
return (sh_chkwrite (opt));
}
else
return (EXECUTION_FAILURE);
+1 -1
View File
@@ -151,7 +151,7 @@ builtin_usage ()
{
if (this_command_name && *this_command_name)
fprintf (stderr, _("%s: usage: "), this_command_name);
fprintf (stderr, "%s\n", current_builtin->short_doc);
fprintf (stderr, "%s\n", _(current_builtin->short_doc));
fflush (stderr);
}
+3 -1
View File
@@ -108,7 +108,9 @@ getopts_bind_variable (name, value)
if (legal_identifier (name))
{
v = bind_variable (name, value, 0);
return (v && (readonly_p (v) == 0)) ? EXECUTION_SUCCESS : EXECUTION_FAILURE;
if (v && (readonly_p (v) || noassign_p (v)))
return (EX_MISCERROR);
return (v ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
else
{
+4 -4
View File
@@ -155,7 +155,7 @@ help_builtin (list)
continue;
}
printf ("%s: %s\n", name, shell_builtins[i].short_doc);
printf ("%s: %s\n", name, _(shell_builtins[i].short_doc));
if (sflag == 0)
show_longdoc (i);
@@ -288,7 +288,7 @@ show_manpage (name, i)
/* SYNOPSIS */
printf ("SYNOPSIS\n");
printf ("%*s%s\n\n", BASE_INDENT, " ", shell_builtins[i].short_doc);
printf ("%*s%s\n\n", BASE_INDENT, " ", _(shell_builtins[i].short_doc));
/* DESCRIPTION */
printf ("DESCRIPTION\n");
@@ -360,7 +360,7 @@ A star (*) next to a name means that the command is disabled.\n\
/* first column */
blurb[0] = (shell_builtins[i].flags & BUILTIN_ENABLED) ? ' ' : '*';
strncpy (blurb + 1, shell_builtins[i].short_doc, width - 2);
strncpy (blurb + 1, _(shell_builtins[i].short_doc), width - 2);
blurb[width - 2] = '>'; /* indicate truncation */
blurb[width - 1] = '\0';
printf ("%s", blurb);
@@ -376,7 +376,7 @@ A star (*) next to a name means that the command is disabled.\n\
/* second column */
blurb[0] = (shell_builtins[i+height].flags & BUILTIN_ENABLED) ? ' ' : '*';
strncpy (blurb + 1, shell_builtins[i+height].short_doc, width - 3);
strncpy (blurb + 1, _(shell_builtins[i+height].short_doc), width - 3);
blurb[width - 3] = '>'; /* indicate truncation */
blurb[width - 2] = '\0';
printf ("%s\n", blurb);
+14 -6
View File
@@ -793,11 +793,16 @@ assign_vars:
}
else
var = bind_read_variable (list->word->word, input_string);
stupidly_hack_special_variables (list->word->word);
FREE (tofree);
if (var)
VUNSETATTR (var, att_invisible);
{
stupidly_hack_special_variables (list->word->word);
VUNSETATTR (var, att_invisible);
}
else
retval = EXECUTION_FAILURE;
FREE (tofree);
xfree (orig_input_string);
return (retval);
@@ -807,14 +812,17 @@ static SHELL_VAR *
bind_read_variable (name, value)
char *name, *value;
{
SHELL_VAR *v;
#if defined (ARRAY_VARS)
if (valid_array_reference (name) == 0)
return (bind_variable (name, value, 0));
v = bind_variable (name, value, 0);
else
return (assign_array_element (name, value, 0));
v = assign_array_element (name, value, 0);
#else /* !ARRAY_VARS */
return bind_variable (name, value, 0);
v = bind_variable (name, value, 0);
#endif /* !ARRAY_VARS */
return (v == 0 ? v
: ((readonly_p (v) || noassign_p (v)) ? (SHELL_VAR *)NULL : v));
}
#if defined (HANDLE_MULTIBYTE)
+9 -1
View File
@@ -224,7 +224,15 @@ sh_eaccess (path, mode)
# endif
if (current_user.uid == current_user.euid && current_user.gid == current_user.egid)
return (access (path, mode));
{
ret = access (path, mode);
#if defined (__FreeBSD__) || defined (SOLARIS)
if (ret == 0 && current_user.euid == 0 && mode == X_OK)
return (sh_stataccess (path, mode));
#endif
return ret;
}
return (sh_stataccess (path, mode));
#endif
+6 -2
View File
@@ -1,6 +1,6 @@
/* eaccess.c - eaccess replacement for the shell, plus other access functions. */
/* Copyright (C) 2006 Free Software Foundation, Inc.
/* Copyright (C) 2006-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -224,7 +224,11 @@ sh_eaccess (path, mode)
# endif
if (current_user.uid == current_user.euid && current_user.gid == current_user.egid)
return (access (path, mode));
{
ret = access (path, mode);
if (ret == 0 && current_user.euid == 0 && mode == X_OK)
return (sh_stataccess (path, mode));
}
return (sh_stataccess (path, mode));
#endif
+612 -1008
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -55,6 +55,8 @@ extern int EOF_Reached;
/* Usage messages by builtins result in a return status of 2. */
#define EX_BADUSAGE 2
#define EX_MISCERROR 2
/* Special exit statuses used by the shell, internally and externally. */
#define EX_RETRYFAIL 124
#define EX_WEXPCOMSUB 125