From: Chet Ramey Date: Tue, 13 Dec 2011 03:08:43 +0000 (-0500) Subject: commit bash-20101022 snapshot X-Git-Tag: bash-4.3-alpha~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf19c529dd3f03b0dfc500900484c2d9fa221e23;p=thirdparty%2Fbash.git commit bash-20101022 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 95e30415f..c00f5381c 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10474,45 +10474,3 @@ execute_cmd.c saved_redirects is non-null in the `command exec' case. Fixes sh -c 'command exec; exit 1' hanging bug uncovered by FreeBSD sh test cases - - 10/18 - ----- -subst.c - - when in posix mode, shell should not exit if a variable assignment - error (e.g., assigning to readonly variable) occurs preceding a - command that is not a special builtin. Fixes bug uncovered by - FreeBSD sh test cases - - when in posix mode, the ${!?} and ${!#} expansions are not indirect - expansions, but posix word expansions involving the `!' variable - -parse.y - - fix parse_comsub so that it does not skip backslash-newline when - parsing a comment - - 10/19 - ----- -subst.c - - fix parameter_brace_expand so that an attempt to use the % or # - expansions on an unset variable with -u set will cause a non- - interactive shell to abort. Posix change - - fix parameter_brace_expand so that an attempt to use pattern - substitution or case modification expansions on an unset variable - with -u set will cause and unbound variable error and make a - non-interactive shell abort - - change parameter_brace_expand_length to return INTMAX_MIN if a - positional parameter is unset and -u is set - - if parameter_brace_expand_length returns INTMAX_MIN when -u is set, - treat it as an unbound variable error and make a non-interactive - shell abort. Posix change - - change parameter_brace_expand_length to return INTMAX_MIN if an - implicit reference to array[0] is made ${#array} and array[0] is - not set when -u is set - - 10/20 - ----- -builtins/cd.def - - Posix 2008 says that if no matching directories are found in $CDPATH, - use the directory name passed as an operand and go on. Posix change - -doc/bashref.texi - - change Posix mode section with latest additions and removals diff --git a/builtins/cd.def b/builtins/cd.def index 148c59db2..5526c4dfb 100644 --- a/builtins/cd.def +++ b/builtins/cd.def @@ -283,7 +283,6 @@ cd_builtin (list) free (temp); } -#if 0 /* changed for bash-4.2 Posix cd description steps 5-6 */ /* POSIX.2 says that if `.' does not appear in $CDPATH, we don't try the current directory, so we just punt now with an error message if POSIXLY_CORRECT is non-zero. The check for cdpath[0] @@ -294,7 +293,6 @@ cd_builtin (list) builtin_error ("%s: %s", dirname, strerror (ENOENT)); return (EXECUTION_FAILURE); } -#endif } else dirname = list->word->word; diff --git a/builtins/trap.def b/builtins/trap.def index 2119f5b3c..9523cfc3c 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -35,11 +35,7 @@ value. If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes. If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. If -a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If -a SIGNAL_SPEC is RETURN, ARG is executed each time a shell function or a -script run by the . or source builtins finishes executing. A SIGNAL_SPEC -of ERR means to execute ARG each time a command's failure would cause the -shell to exit when the -e option is enabled. +a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If no arguments are supplied, trap prints the list of commands associated with each signal. diff --git a/doc/bash.1 b/doc/bash.1 index 9a01d6e61..ad7985925 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -9366,8 +9366,8 @@ is .BR RETURN , the command .I arg -is executed each time a shell function or a script executed with -the \fB.\fP or \fBsource\fP builtins finishes executing. +is executed each time a shell function or a script executed with the +\fB.\fP or \fBsource\fP builtins finishes executing. .if t .sp 0.5 .if n .sp 1 If a diff --git a/doc/bashref.texi b/doc/bashref.texi index a299899b5..2f457515b 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -6694,6 +6694,14 @@ the @sc{posix} standard, and include things like passing incorrect options, redirection errors, variable assignment errors for assignments preceding the command name, and so on. +@item +If @env{CDPATH} is set, the @code{cd} builtin will not implicitly +append the current directory to it. This means that @code{cd} will +fail if no valid directory name can be constructed from +any of the entries in @env{$CDPATH}, even if the a directory with +the same name as the name given as an argument to @code{cd} exists +in the current directory. + @item A non-interactive shell exits with an error status if a variable assignment error occurs when no command name follows the assignment @@ -6701,11 +6709,6 @@ statements. A variable assignment error occurs, for example, when trying to assign a value to a readonly variable. -@item -A non-interactive shell exists 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. - @item A non-interactive shell exits with an error status if the iteration variable in a @code{for} statement or the selection variable in a @@ -6771,6 +6774,10 @@ constructed from @code{$PWD} and the directory name supplied as an argument does not refer to an existing directory, @code{cd} will fail instead of falling back to @var{physical} mode. +@item +When the @code{pwd} builtin is supplied the @option{-P} option, it resets +@code{$PWD} to a pathname containing no symlinks. + @item The @code{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 diff --git a/doc/version.texi b/doc/version.texi index cc4b015c8..a68f5e796 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,9 +2,9 @@ Copyright (C) 1988-2010 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Wed Oct 20 21:37:22 EDT 2010 +@set LASTCHANGE Mon Sep 6 22:08:10 EDT 2010 @set EDITION 4.2 @set VERSION 4.2 -@set UPDATED 20 October 2010 -@set UPDATED-MONTH October 2010 +@set UPDATED 6 September 2010 +@set UPDATED-MONTH September 2010 diff --git a/include/chartypes.h b/include/chartypes.h index 77bcad976..389d4fd34 100644 --- a/include/chartypes.h +++ b/include/chartypes.h @@ -103,6 +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. */ + /* XXX - should this be TOUPPER(x) ^ x040 ? */ # define TOCTRL(x) (TOUPPER(x) & 037) #endif #ifndef UNCTRL diff --git a/parse.y b/parse.y index 449f0c67d..4760befb2 100644 --- a/parse.y +++ b/parse.y @@ -3165,7 +3165,7 @@ parse_matched_pair (qc, open, close, lenp, flags) start_lineno = line_number; while (count) { - ch = shell_getc (qc != '\'' && (tflags & (LEX_PASSNEXT)) == 0); + ch = shell_getc (qc != '\'' && (tflags & LEX_PASSNEXT) == 0); if (ch == EOF) { @@ -3434,7 +3434,7 @@ parse_comsub (qc, open, close, lenp, flags) while (count) { comsub_readchar: - ch = shell_getc (qc != '\'' && (tflags & (LEX_INCOMMENT|LEX_PASSNEXT)) == 0); + ch = shell_getc (qc != '\'' && (tflags & LEX_PASSNEXT) == 0); if (ch == EOF) { diff --git a/po/cs.po b/po/cs.po index f918a90db..4851c3481 100644 --- a/po/cs.po +++ b/po/cs.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: bash 4.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-12-30 08:25-0500\n" -"PO-Revision-Date: 2010-01-03 22:30+0100\n" +"PO-Revision-Date: 2010-10-18 22:31+0200\n" "Last-Translator: Petr Pisar \n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" @@ -411,7 +411,7 @@ msgstr "toto není login shell: použijte „exit“" #: builtins/exit.def:120 #, c-format msgid "There are stopped jobs.\n" -msgstr "Jsou zde pozastavení úlohy.\n" +msgstr "Jsou zde pozastavené úlohy.\n" #: builtins/exit.def:122 #, c-format diff --git a/po/ja.po b/po/ja.po index 13b1c9608..3c9a120fb 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: GNU bash 4.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-12-30 08:25-0500\n" -"PO-Revision-Date: 2010-08-19 15:21+0900\n" +"PO-Revision-Date: 2010-10-17 19:38+0900\n" "Last-Translator: Yasuaki Taniguchi \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" @@ -67,7 +67,7 @@ msgstr "%s: 区切り文字コロン(:)がありません" #: builtins/alias.def:132 #, c-format msgid "`%s': invalid alias name" -msgstr "%s: 無効なエイリアス名です" +msgstr "`%s': 無効なエイリアス名です" #: builtins/bind.def:120 builtins/bind.def:123 msgid "line editing not enabled" @@ -362,7 +362,7 @@ msgstr "%s: 動的にロードされていません" #: builtins/enable.def:474 #, c-format msgid "%s: cannot delete: %s" -msgstr "%s: %s を削除できません" +msgstr "%s: 削除できません: %s" #: builtins/evalfile.c:134 builtins/hash.def:169 execute_cmd.c:4794 #: shell.c:1452 @@ -389,7 +389,7 @@ msgstr "%s: バイナリファイルを実行できません" #: builtins/exec.def:212 #, c-format msgid "%s: cannot execute: %s" -msgstr "%s: %s を実行できません" +msgstr "%s: 実行できません: %s" #: builtins/exit.def:65 #, c-format @@ -421,7 +421,7 @@ msgstr "ヒストリ指定" #: builtins/fc.def:370 #, c-format msgid "%s: cannot open temp file: %s" -msgstr "%s: 一時ファイル %s を開くことができません" +msgstr "%s: 一時ファイルを開くことができません: %s" #: builtins/fg_bg.def:149 builtins/jobs.def:282 msgid "current" @@ -470,7 +470,7 @@ msgstr "`%s' に一致するヘルプ項目がありません。`help help'、`m #: builtins/help.def:185 #, c-format msgid "%s: cannot open: %s" -msgstr "%s: %s を開くことができません" +msgstr "%s: 開くことができません: %s" #: builtins/help.def:337 #, c-format @@ -534,7 +534,7 @@ msgstr "%s: インデックス配列ではありません" #: builtins/mapfile.def:249 builtins/read.def:279 #, c-format msgid "%s: invalid file descriptor specification" -msgstr "%s: 指定したファイル記述子は無効です" +msgstr "%s: 無効なファイル記述子指定です" #: builtins/mapfile.def:257 builtins/read.def:286 #, c-format @@ -817,7 +817,7 @@ msgstr "%s は %s です\n" #: builtins/type.def:337 #, c-format msgid "%s is hashed (%s)\n" -msgstr "%s はハッシュされている (%s)\n" +msgstr "%s はハッシュされています (%s)\n" #: builtins/ulimit.def:372 #, c-format @@ -827,7 +827,7 @@ msgstr "%s: limit の無効な引数です" #: builtins/ulimit.def:398 #, c-format msgid "`%c': bad command" -msgstr "`%c': 誤った指定です" +msgstr "`%c': 誤ったコマンドです" #: builtins/ulimit.def:427 #, c-format @@ -900,7 +900,7 @@ msgstr "\a入力待ちがタイムアウトしました: 自動ログアウト\n #: execute_cmd.c:497 #, c-format msgid "cannot redirect standard input from /dev/null: %s" -msgstr "/dev/null を入力にリダイレクトできません: %s" +msgstr "/dev/null から標準入力に対してリダイレクトできません: %s" #: execute_cmd.c:1162 #, c-format @@ -914,7 +914,7 @@ msgstr "パイプエラー" #: execute_cmd.c:4481 #, c-format msgid "%s: restricted: cannot specify `/' in command names" -msgstr "%s: 制限されています: `/' をコマンド名に指定できません" +msgstr "%s: 制限されています: `/' をコマンド名の中に指定できません" #: execute_cmd.c:4572 #, c-format @@ -953,7 +953,7 @@ msgstr "0 による除算です" #: expr.c:471 msgid "bug: bad expassign token" -msgstr "bug: 誤った式のトークンです" +msgstr "バグ: 誤った式のトークンです" #: expr.c:513 msgid "`:' expected for conditional expression" @@ -1038,7 +1038,7 @@ msgstr "add_process: プロセス %5ld (%s) が the_pipeline にあります" #: jobs.c:1113 #, c-format msgid "add_process: pid %5ld (%s) marked as still alive" -msgstr "add_process: pid %5ld (%s) はまだ存在しています" +msgstr "add_process: pid %5ld (%s) はまだ存在しているとマークされています" #: jobs.c:1401 #, c-format @@ -1159,7 +1159,7 @@ msgstr "端末プロセスグループを設定できません (%d)" #: jobs.c:3682 msgid "no job control in this shell" -msgstr "このシェルにはジョブ制御がありません" +msgstr "このシェルではジョブ制御が無効になっています" #: lib/malloc/malloc.c:296 #, c-format @@ -1172,8 +1172,8 @@ msgid "" "\r\n" "malloc: %s:%d: assertion botched\r\n" msgstr "" -"\\r\n" -"malloc: %s:%d: アサーション失敗\\r\n" +"\r\n" +"malloc: %s:%d: アサーション失敗\r\n" #: lib/malloc/malloc.c:313 msgid "unknown" @@ -1181,7 +1181,7 @@ msgstr "不明" #: lib/malloc/malloc.c:797 msgid "malloc: block on free list clobbered" -msgstr "malloc: block on free リストにあるブロックが壊れています" +msgstr "malloc: free ブロックリストが壊れています" #: lib/malloc/malloc.c:874 msgid "free: called with already freed block argument" diff --git a/subst.c b/subst.c index ea607b40c..0b3e062fb 100644 --- a/subst.c +++ b/subst.c @@ -108,7 +108,7 @@ extern int errno; /* Evaluates to 1 if C is one of the shell's special parameters for which an indirect variable reference may be made. */ #define VALID_INDIR_PARAM(c) \ - ((posixly_correct == 0 && (c) == '#') || (posixly_correct == 0 && (c) == '?') || (c) == '@' || (c) == '*') + ((c) == '#' || (c) == '?' || (c) == '@' || (c) == '*') /* Evaluates to 1 if C is one of the OP characters that follows the parameter in ${parameter[:]OPword}. */ @@ -5907,7 +5907,7 @@ parameter_brace_expand_length (name) break; case '!': if (last_asynchronous_pid == NO_PID) - t = (char *)NULL; /* XXX - error if set -u set? */ + t = (char *)NULL; else t = itos (last_asynchronous_pid); break; @@ -5929,8 +5929,6 @@ parameter_brace_expand_length (name) if (legal_number (name + 1, &arg_index)) /* ${#1} */ { t = get_dollar_var_value (arg_index); - if (t == 0 && unbound_vars_is_error) - return INTMAX_MIN; number = MB_STRLEN (t); FREE (t); } @@ -5941,8 +5939,6 @@ parameter_brace_expand_length (name) t = assoc_reference (assoc_cell (var), "0"); else t = array_reference (array_cell (var), 0); - if (t == 0 && unbound_vars_is_error) - return INTMAX_MIN; number = MB_STRLEN (t); } #endif @@ -6944,8 +6940,15 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta /* If the name really consists of a special variable, then make sure that we have the entire name. We don't allow indirect references to special variables except `#', `?', `@' and `*'. */ - if ((sindex == t_index && VALID_SPECIAL_LENGTH_PARAM (string[t_index])) || - (sindex == t_index - 1 && string[sindex] == '!' && VALID_INDIR_PARAM (string[t_index]))) + if ((sindex == t_index && + (string[t_index] == '-' || + string[t_index] == '?' || + string[t_index] == '#')) || + (sindex == t_index - 1 && string[sindex] == '!' && + (string[t_index] == '#' || + string[t_index] == '?' || + string[t_index] == '@' || + string[t_index] == '*'))) { t_index++; free (name); @@ -7040,13 +7043,6 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta } number = parameter_brace_expand_length (name); - if (number == INTMAX_MIN && unbound_vars_is_error) - { - last_command_exit_value = EXECUTION_FAILURE; - err_unboundvar (name+1); - free (name); - return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); - } free (name); *indexp = sindex; @@ -7182,21 +7178,6 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta *indexp = sindex; - /* All the cases where an expansion can possibly generate an unbound - variable error. */ - if (want_substring || want_patsub || want_casemod || c == '#' || c == '%' || c == RBRACE) - { - if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1])) - { - last_command_exit_value = EXECUTION_FAILURE; - err_unboundvar (name); - FREE (value); - FREE (temp); - free (name); - return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); - } - } - /* If this is a substring spec, process it and add the result. */ if (want_substring) { @@ -7270,6 +7251,15 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta return &expand_wdesc_error; case RBRACE: + if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1])) + { + last_command_exit_value = EXECUTION_FAILURE; + err_unboundvar (name); + FREE (value); + FREE (temp); + free (name); + return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal); + } break; case '#': /* ${param#[#]pattern} */ @@ -9334,7 +9324,6 @@ expand_word_list_internal (list, eflags) if ((eflags & WEXP_VARASSIGN) && subst_assign_varlist) { sh_wassign_func_t *assign_func; - int is_special_builtin; /* If the remainder of the words expand to nothing, Posix.2 requires that the variable and environment assignments affect the shell's @@ -9342,10 +9331,6 @@ expand_word_list_internal (list, eflags) assign_func = new_list ? assign_in_env : do_word_assignment; tempenv_assign_error = 0; - /* Posix says that special builtins exit if a variable assignment error - occurs in an assignment preceding it. */ - is_special_builtin = (posixly_correct && new_list && find_special_builtin (new_list->word->word)); - for (temp_list = subst_assign_varlist; temp_list; temp_list = temp_list->next) { this_command_name = (char *)NULL; @@ -9359,7 +9344,7 @@ expand_word_list_internal (list, eflags) if (assign_func == do_word_assignment) { last_command_exit_value = EXECUTION_FAILURE; - if (interactive_shell == 0 && posixly_correct && is_special_builtin) + if (interactive_shell == 0 && posixly_correct) exp_jump_to_top_level (FORCE_EOF); else exp_jump_to_top_level (DISCARD); diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 72ec06a2c..3efcf32d6 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/bash/bash-current +BUILD_DIR=/usr/local/build/chet/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR