From d1932ba84461a02d79ddf74147b13e45b97b29ef Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Dec 09 2008 14:54:13 +0000 Subject: Patchlevel 48 --- diff --git a/bash-requires.patch b/bash-requires.patch index 095fbb2..50a19cc 100644 --- a/bash-requires.patch +++ b/bash-requires.patch @@ -1,89 +1,58 @@ -diff -upk.orig bash-3.1.orig/builtins/mkbuiltins.c bash-3.1/builtins/mkbuiltins.c ---- bash-3.1.orig/builtins/mkbuiltins.c 2005-09-10 16:22:12 +0000 -+++ bash-3.1/builtins/mkbuiltins.c 2006-01-06 00:42:16 +0000 -@@ -60,8 +60,13 @@ extern char *strcpy (); - #define whitespace(c) (((c) == ' ') || ((c) == '\t')) - - /* Flag values that builtins can have. */ -+/* These flags are for the C code generator, -+ the C which is produced (./builtin.c) -+ includes the flags definitions found -+ in ../builtins.h */ - #define BUILTIN_FLAG_SPECIAL 0x01 - #define BUILTIN_FLAG_ASSIGNMENT 0x02 -+#define BUILTIN_FLAG_REQUIRES 0x04 - - #define BASE_INDENT 4 - -@@ -145,9 +150,17 @@ char *assignment_builtins[] = - (char *)NULL - }; +diff -up bash-3.2/shell.c.requires bash-3.2/shell.c +--- bash-3.2/shell.c.requires 2006-05-17 14:46:54.000000000 +0200 ++++ bash-3.2/shell.c 2008-12-09 14:02:02.000000000 +0100 +@@ -175,6 +175,9 @@ int running_under_emacs; + /* The name of the .(shell)rc file. */ + static char *bashrc_file = "~/.bashrc"; -+/* The builtin commands that cause requirements on other files. */ -+static char *requires_builtins[] = -+{ -+ ".", "command", "exec", "source", "inlib", -+ (char *)NULL -+}; ++/* Non-zero if we are finding the scripts requirements. */ ++int rpm_requires; + - /* Forward declarations. */ - static int is_special_builtin (); - static int is_assignment_builtin (); -+static int is_requires_builtin (); - - #if !defined (HAVE_RENAME) - static int rename (); -@@ -791,6 +804,8 @@ builtin_handler (self, defs, arg) - new->flags |= BUILTIN_FLAG_SPECIAL; - if (is_assignment_builtin (name)) - new->flags |= BUILTIN_FLAG_ASSIGNMENT; -+ if (is_requires_builtin (name)) -+ new->flags |= BUILTIN_FLAG_REQUIRES; + /* Non-zero means to act more like the Bourne shell on startup. */ + static int act_like_sh; - array_add ((char *)new, defs->builtins); - building_builtin = 1; -@@ -1208,10 +1223,11 @@ write_builtins (defs, structfile, extern - else - fprintf (structfile, "(sh_builtin_func_t *)0x0, "); +@@ -233,6 +236,7 @@ struct { + { "posix", Int, &posixly_correct, (char **)0x0 }, + { "protected", Int, &protected_mode, (char **)0x0 }, + { "rcfile", Charp, (int *)0x0, &bashrc_file }, ++ { "rpm-requires", Int, &rpm_requires, (char **)0x0 }, + #if defined (RESTRICTED_SHELL) + { "restricted", Int, &restricted, (char **)0x0 }, + #endif +@@ -460,6 +464,12 @@ main (argc, argv, env) + if (dump_translatable_strings) + read_but_dont_execute = 1; -- fprintf (structfile, "%s%s%s, %s_doc,\n", -+ fprintf (structfile, "%s%s%s%s, %s_doc,\n", - "BUILTIN_ENABLED | STATIC_BUILTIN", - (builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "", - (builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "", -+ (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "", - document_name (builtin)); ++ if (rpm_requires) ++ { ++ read_but_dont_execute = 1; ++ initialize_shell_builtins (); ++ } ++ + if (running_setuid && privileged_mode == 0) + disable_priv_mode (); - fprintf -@@ -1542,6 +1558,13 @@ is_assignment_builtin (name) - return (_find_in_table (name, assignment_builtins)); - } +diff -up bash-3.2/doc/bashref.texi.requires bash-3.2/doc/bashref.texi +--- bash-3.2/doc/bashref.texi.requires 2008-12-09 14:02:01.000000000 +0100 ++++ bash-3.2/doc/bashref.texi 2008-12-09 14:02:02.000000000 +0100 +@@ -4906,6 +4906,13 @@ standard. @xref{Bash POSIX Mode}, for a + @item --restricted + Make the shell a restricted shell (@pxref{The Restricted Shell}). -+static int -+is_requires_builtin (name) -+ char *name; -+{ -+ return (_find_in_table (name, requires_builtins)); -+} ++@item --rpm-requires ++Produce the list of files that are required for the ++shell script to run. This implies '-n' and is subject ++to the same limitations as compile time error checking checking; ++Backticks, [] tests, and evals are not parsed so some ++dependencies may be missed. + - #if !defined (HAVE_RENAME) - static int - rename (from, to) -diff -upk.orig bash-3.1.orig/builtins.h bash-3.1/builtins.h ---- bash-3.1.orig/builtins.h 2004-12-30 18:59:05 +0000 -+++ bash-3.1/builtins.h 2006-01-06 00:42:16 +0000 -@@ -40,6 +40,7 @@ - #define STATIC_BUILTIN 0x4 /* This builtin is not dynamically loaded. */ - #define SPECIAL_BUILTIN 0x8 /* This is a Posix `special' builtin. */ - #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ -+#define REQUIRES_BUILTIN 0x20 /* This builtin requires other files. */ - - #define BASE_INDENT 4 + @item --verbose + Equivalent to @option{-v}. Print shell input lines as they're read. -diff -upk.orig bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1 ---- bash-3.1.orig/doc/bash.1 2006-01-06 00:41:57 +0000 -+++ bash-3.1/doc/bash.1 2006-01-06 00:42:16 +0000 -@@ -231,6 +231,13 @@ The shell becomes restricted (see +diff -up bash-3.2/doc/bash.1.requires bash-3.2/doc/bash.1 +--- bash-3.2/doc/bash.1.requires 2008-12-09 14:02:01.000000000 +0100 ++++ bash-3.2/doc/bash.1 2008-12-09 14:02:02.000000000 +0100 +@@ -232,6 +232,13 @@ The shell becomes restricted (see .B "RESTRICTED SHELL" below). .TP @@ -97,96 +66,9 @@ diff -upk.orig bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1 .B \-\-verbose Equivalent to \fB\-v\fP. .TP -diff -upk.orig bash-3.1.orig/doc/bashref.texi bash-3.1/doc/bashref.texi ---- bash-3.1.orig/doc/bashref.texi 2006-01-06 00:41:57 +0000 -+++ bash-3.1/doc/bashref.texi 2006-01-06 00:42:16 +0000 -@@ -4898,6 +4898,13 @@ standard. @xref{Bash POSIX Mode}, for a - @item --restricted - Make the shell a restricted shell (@pxref{The Restricted Shell}). - -+@item --rpm-requires -+Produce the list of files that are required for the -+shell script to run. This implies '-n' and is subject -+to the same limitations as compile time error checking checking; -+Backticks, [] tests, and evals are not parsed so some -+dependencies may be missed. -+ - @item --verbose - Equivalent to @option{-v}. Print shell input lines as they're read. - -diff -upk.orig bash-3.1.orig/eval.c bash-3.1/eval.c ---- bash-3.1.orig/eval.c 2006-01-06 00:41:57 +0000 -+++ bash-3.1/eval.c 2006-01-06 00:42:16 +0000 -@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdi - extern int need_here_doc; - extern int current_command_number, current_command_line_count, line_number; - extern int expand_aliases; -+extern int rpm_requires; - - static void send_pwd_to_eterm __P((void)); - static sighandler alrm_catcher __P((int)); -@@ -131,7 +132,7 @@ reader_loop () - - if (read_command () == 0) - { -- if (interactive_shell == 0 && read_but_dont_execute) -+ if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires)) - { - last_command_exit_value = EXECUTION_SUCCESS; - dispose_command (global_command); -diff -upk.orig bash-3.1.orig/execute_cmd.c bash-3.1/execute_cmd.c ---- bash-3.1.orig/execute_cmd.c 2006-01-06 00:41:57 +0000 -+++ bash-3.1/execute_cmd.c 2006-01-06 00:42:16 +0000 -@@ -473,6 +473,8 @@ async_redirect_stdin () - - #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0) - -+extern int rpm_requires; -+ - /* Execute the command passed in COMMAND, perhaps doing it asynchrounously. - COMMAND is exactly what read_command () places into GLOBAL_COMMAND. - ASYNCHROUNOUS, if non-zero, says to do this command in the background. -@@ -498,7 +500,15 @@ execute_command_internal (command, async - volatile int last_pid; - volatile int save_line_number; - -- if (command == 0 || breaking || continuing || read_but_dont_execute) -+ if (command == 0 || breaking || continuing || (read_but_dont_execute && !rpm_requires)) -+ return (EXECUTION_SUCCESS); -+ -+ if (rpm_requires && command->type == cm_function_def) -+ return last_command_exit_value = -+ execute_intern_function (command->value.Function_def->name, -+ command->value.Function_def->command); -+ -+ if (read_but_dont_execute) - return (EXECUTION_SUCCESS); - - QUIT; -@@ -3984,7 +3994,7 @@ execute_intern_function (name, function) - - if (check_identifier (name, posixly_correct) == 0) - { -- if (posixly_correct && interactive_shell == 0) -+ if (posixly_correct && interactive_shell == 0 && rpm_requires == 0) - { - last_command_exit_value = EX_USAGE; - jump_to_top_level (ERREXIT); -diff -upk.orig bash-3.1.orig/execute_cmd.h bash-3.1/execute_cmd.h ---- bash-3.1.orig/execute_cmd.h 2001-05-07 14:39:37 +0000 -+++ bash-3.1/execute_cmd.h 2003-04-20 13:20:49 +0000 -@@ -22,6 +22,8 @@ - #define _EXECUTE_CMD_H_ - - #include "stdc.h" -+#include "variables.h" -+#include "command.h" - - extern struct fd_bitmap *new_fd_bitmap __P((int)); - extern void dispose_fd_bitmap __P((struct fd_bitmap *)); -diff -upk.orig bash-3.1.orig/make_cmd.c bash-3.1/make_cmd.c ---- bash-3.1.orig/make_cmd.c 2006-01-06 00:41:57 +0000 -+++ bash-3.1/make_cmd.c 2006-01-06 00:42:16 +0000 +diff -up bash-3.2/make_cmd.c.requires bash-3.2/make_cmd.c +--- bash-3.2/make_cmd.c.requires 2006-09-12 15:21:22.000000000 +0200 ++++ bash-3.2/make_cmd.c 2008-12-09 14:02:02.000000000 +0100 @@ -41,11 +41,15 @@ Foundation, 59 Temple Place, Suite 330, #include "flags.h" #include "make_cmd.h" @@ -214,7 +96,7 @@ diff -upk.orig bash-3.1.orig/make_cmd.c bash-3.1/make_cmd.c /* Object caching */ sh_obj_cache_t wdcache = {0, 0, 0}; -@@ -784,6 +792,27 @@ make_subshell_command (command) +@@ -789,6 +797,27 @@ make_subshell_command (command) return (make_command (cm_subshell, (SIMPLE_COM *)temp)); } @@ -242,7 +124,7 @@ diff -upk.orig bash-3.1.orig/make_cmd.c bash-3.1/make_cmd.c /* Reverse the word list and redirection list in the simple command has just been parsed. It seems simpler to do this here the one time then by any other method that I can think of. */ -@@ -801,6 +830,27 @@ clean_simple_command (command) +@@ -806,6 +835,27 @@ clean_simple_command (command) REVERSE_LIST (command->value.Simple->redirects, REDIRECT *); } @@ -270,37 +152,153 @@ diff -upk.orig bash-3.1.orig/make_cmd.c bash-3.1/make_cmd.c return (command); } -diff -upk.orig bash-3.1.orig/shell.c bash-3.1/shell.c ---- bash-3.1.orig/shell.c 2006-01-06 00:41:57 +0000 -+++ bash-3.1/shell.c 2006-01-06 00:42:16 +0000 -@@ -175,6 +175,9 @@ int running_under_emacs; - /* The name of the .(shell)rc file. */ - static char *bashrc_file = "~/.bashrc"; +diff -up bash-3.2/execute_cmd.c.requires bash-3.2/execute_cmd.c +--- bash-3.2/execute_cmd.c.requires 2008-12-09 14:02:02.000000000 +0100 ++++ bash-3.2/execute_cmd.c 2008-12-09 15:19:29.000000000 +0100 +@@ -476,6 +476,8 @@ async_redirect_stdin () -+/* Non-zero if we are finding the scripts requirements. */ -+int rpm_requires; -+ - /* Non-zero means to act more like the Bourne shell on startup. */ - static int act_like_sh; + #define DESCRIBE_PID(pid) do { if (interactive) describe_pid (pid); } while (0) -@@ -233,6 +236,7 @@ struct { - { "posix", Int, &posixly_correct, (char **)0x0 }, - { "protected", Int, &protected_mode, (char **)0x0 }, - { "rcfile", Charp, (int *)0x0, &bashrc_file }, -+ { "rpm-requires", Int, &rpm_requires, (char **)0x0 }, - #if defined (RESTRICTED_SHELL) - { "restricted", Int, &restricted, (char **)0x0 }, ++extern int rpm_requires; ++ + /* Execute the command passed in COMMAND, perhaps doing it asynchrounously. + COMMAND is exactly what read_command () places into GLOBAL_COMMAND. + ASYNCHROUNOUS, if non-zero, says to do this command in the background. +@@ -507,8 +509,13 @@ execute_command_internal (command, async + #else + if (breaking || continuing) + return (last_command_exit_value); +- if (command == 0 || read_but_dont_execute) ++ if (command == 0 || (read_but_dont_execute && !rpm_requires)) + return (EXECUTION_SUCCESS); ++ if (rpm_requires && command->type == cm_function_def) ++ return last_command_exit_value = ++ execute_intern_function (command->value.Function_def->name, ++ command->value.Function_def->command); ++ #endif -@@ -460,6 +464,12 @@ main (argc, argv, env) - if (dump_translatable_strings) - read_but_dont_execute = 1; -+ if (rpm_requires) -+ { -+ read_but_dont_execute = 1; -+ initialize_shell_builtins (); -+ } + QUIT; +@@ -4073,7 +4080,7 @@ execute_intern_function (name, function) + + if (check_identifier (name, posixly_correct) == 0) + { +- if (posixly_correct && interactive_shell == 0) ++ if (posixly_correct && interactive_shell == 0 && rpm_requires == 0) + { + last_command_exit_value = EX_USAGE; + jump_to_top_level (ERREXIT); +diff -up bash-3.2/execute_cmd.h.requires bash-3.2/execute_cmd.h +--- bash-3.2/execute_cmd.h.requires 2001-05-07 16:39:37.000000000 +0200 ++++ bash-3.2/execute_cmd.h 2008-12-09 14:02:02.000000000 +0100 +@@ -22,6 +22,8 @@ + #define _EXECUTE_CMD_H_ + + #include "stdc.h" ++#include "variables.h" ++#include "command.h" + + extern struct fd_bitmap *new_fd_bitmap __P((int)); + extern void dispose_fd_bitmap __P((struct fd_bitmap *)); +diff -up bash-3.2/builtins.h.requires bash-3.2/builtins.h +--- bash-3.2/builtins.h.requires 2004-12-30 19:59:05.000000000 +0100 ++++ bash-3.2/builtins.h 2008-12-09 14:02:02.000000000 +0100 +@@ -40,6 +40,7 @@ + #define STATIC_BUILTIN 0x4 /* This builtin is not dynamically loaded. */ + #define SPECIAL_BUILTIN 0x8 /* This is a Posix `special' builtin. */ + #define ASSIGNMENT_BUILTIN 0x10 /* This builtin takes assignment statements. */ ++#define REQUIRES_BUILTIN 0x20 /* This builtin requires other files. */ + + #define BASE_INDENT 4 + +diff -up bash-3.2/eval.c.requires bash-3.2/eval.c +--- bash-3.2/eval.c.requires 2006-03-19 23:30:26.000000000 +0100 ++++ bash-3.2/eval.c 2008-12-09 14:02:02.000000000 +0100 +@@ -53,6 +53,7 @@ extern int last_command_exit_value, stdi + extern int need_here_doc; + extern int current_command_number, current_command_line_count, line_number; + extern int expand_aliases; ++extern int rpm_requires; + + static void send_pwd_to_eterm __P((void)); + static sighandler alrm_catcher __P((int)); +@@ -131,7 +132,7 @@ reader_loop () + + if (read_command () == 0) + { +- if (interactive_shell == 0 && read_but_dont_execute) ++ if (interactive_shell == 0 && (read_but_dont_execute && !rpm_requires)) + { + last_command_exit_value = EXECUTION_SUCCESS; + dispose_command (global_command); +diff -up bash-3.2/builtins/mkbuiltins.c.requires bash-3.2/builtins/mkbuiltins.c +--- bash-3.2/builtins/mkbuiltins.c.requires 2006-03-07 22:41:57.000000000 +0100 ++++ bash-3.2/builtins/mkbuiltins.c 2008-12-09 14:02:02.000000000 +0100 +@@ -69,8 +69,13 @@ extern char *strcpy (); + #define whitespace(c) (((c) == ' ') || ((c) == '\t')) + + /* Flag values that builtins can have. */ ++/* These flags are for the C code generator, ++ the C which is produced (./builtin.c) ++ includes the flags definitions found ++ in ../builtins.h */ + #define BUILTIN_FLAG_SPECIAL 0x01 + #define BUILTIN_FLAG_ASSIGNMENT 0x02 ++#define BUILTIN_FLAG_REQUIRES 0x04 + + #define BASE_INDENT 4 + +@@ -154,9 +159,17 @@ char *assignment_builtins[] = + (char *)NULL + }; + ++/* The builtin commands that cause requirements on other files. */ ++static char *requires_builtins[] = ++{ ++ ".", "command", "exec", "source", "inlib", ++ (char *)NULL ++}; + - if (running_setuid && privileged_mode == 0) - disable_priv_mode (); + /* Forward declarations. */ + static int is_special_builtin (); + static int is_assignment_builtin (); ++static int is_requires_builtin (); + + #if !defined (HAVE_RENAME) + static int rename (); +@@ -800,6 +813,8 @@ builtin_handler (self, defs, arg) + new->flags |= BUILTIN_FLAG_SPECIAL; + if (is_assignment_builtin (name)) + new->flags |= BUILTIN_FLAG_ASSIGNMENT; ++ if (is_requires_builtin (name)) ++ new->flags |= BUILTIN_FLAG_REQUIRES; + array_add ((char *)new, defs->builtins); + building_builtin = 1; +@@ -1217,10 +1232,11 @@ write_builtins (defs, structfile, extern + else + fprintf (structfile, "(sh_builtin_func_t *)0x0, "); + +- fprintf (structfile, "%s%s%s, %s_doc,\n", ++ fprintf (structfile, "%s%s%s%s, %s_doc,\n", + "BUILTIN_ENABLED | STATIC_BUILTIN", + (builtin->flags & BUILTIN_FLAG_SPECIAL) ? " | SPECIAL_BUILTIN" : "", + (builtin->flags & BUILTIN_FLAG_ASSIGNMENT) ? " | ASSIGNMENT_BUILTIN" : "", ++ (builtin->flags & BUILTIN_FLAG_REQUIRES) ? " | REQUIRES_BUILTIN" : "", + document_name (builtin)); + + fprintf +@@ -1561,6 +1577,13 @@ is_assignment_builtin (name) + return (_find_in_table (name, assignment_builtins)); + } + ++static int ++is_requires_builtin (name) ++ char *name; ++{ ++ return (_find_in_table (name, requires_builtins)); ++} ++ + #if !defined (HAVE_RENAME) + static int + rename (from, to) diff --git a/bash.spec b/bash.spec index baf03e3..7bc742a 100644 --- a/bash.spec +++ b/bash.spec @@ -1,7 +1,7 @@ Version: 3.2 Name: bash Summary: The GNU Bourne Again shell (bash) version %{version} -Release: 30%{?dist} +Release: 31%{?dist} Group: System Environment/Shells License: GPLv2+ Url: http://www.gnu.org/software/bash @@ -10,6 +10,7 @@ Source2: ftp://ftp.gnu.org/gnu/bash/bash-doc-%{version}.tar.gz Source3: dot-bashrc Source4: dot-bash_profile Source5: dot-bash_logout + # Official upstream patches Patch1: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-001 Patch2: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-002 @@ -50,6 +51,15 @@ Patch36: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-036 Patch37: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-037 Patch38: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-038 Patch39: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-039 +Patch40: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-040 +Patch41: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-041 +Patch42: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-042 +Patch43: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-043 +Patch44: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-044 +Patch45: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-045 +Patch46: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-046 +Patch47: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-047 +Patch48: ftp://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-048 # Other patches Patch100: bash-2.03-paths.patch @@ -139,6 +149,15 @@ compliance over previous versions. %patch37 -p0 -b .037 %patch38 -p0 -b .038 %patch39 -p0 -b .039 +%patch40 -p0 -b .040 +%patch41 -p0 -b .041 +%patch42 -p0 -b .042 +%patch43 -p0 -b .043 +%patch44 -p0 -b .044 +%patch45 -p0 -b .045 +%patch46 -p0 -b .046 +%patch47 -p0 -b .047 +%patch48 -p0 -b .048 # Other patches %patch100 -p1 -b .paths @@ -306,6 +325,9 @@ fi %doc doc/*.ps doc/*.0 doc/*.html doc/article.txt %changelog +* Tue Dec 09 2008 Roman Rakus - 3.2-31 +- Patchlevel 48 + * Thu Dec 04 2008 Roman Rakus - 3.2-30 - Added check for `command_not_found_handler' shell function Resolves: #432579 diff --git a/bash32-040 b/bash32-040 new file mode 100644 index 0000000..50b85bb --- /dev/null +++ b/bash32-040 @@ -0,0 +1,47 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-040 + +Bug-Reported-by: John McCabe-Dansted +Bug-Reference-ID: +Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/202885 + +Bug-Description: + +When using the `set' builtin to list all shell variables, the shell uses +the wrong variable when computing the length of a variable's value. + +Patch: + +*** ../bash-3.2-patched/array.c 2007-03-24 14:51:03.000000000 -0400 +--- array.c 2008-08-17 13:07:04.000000000 -0400 +*************** +*** 684,688 **** + valstr = element_value (ae) ? sh_double_quote (element_value(ae)) + : (char *)NULL; +! elen = STRLEN (indstr) + 8 + STRLEN (valstr); + RESIZE_MALLOCED_BUFFER (result, rlen, (elen + 1), rsize, rsize); + +--- 809,813 ---- + valstr = element_value (ae) ? sh_double_quote (element_value(ae)) + : (char *)NULL; +! elen = STRLEN (is) + 8 + STRLEN (valstr); + RESIZE_MALLOCED_BUFFER (result, rlen, (elen + 1), rsize, rsize); + +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 39 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 40 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-041 b/bash32-041 new file mode 100644 index 0000000..3c05c04 --- /dev/null +++ b/bash32-041 @@ -0,0 +1,154 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-041 + +Bug-Reported-by: Dan Jacobson +Bug-Reference-ID: <873arjs11h.fsf@jidanni.org> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-02/msg00049.html + +Bug-Description: + +Bash saved and restored the value of `set -o history' while sourcing files, +preventing users from turning off history with `set +o history' in .bashrc. + +Patch: + +*** ../bash-3.2-patched/bashhist.c 2005-12-26 13:31:16.000000000 -0500 +--- bashhist.c 2008-08-17 13:07:40.000000000 -0400 +*************** +*** 81,84 **** +--- 81,85 ---- + becomes zero when we read lines from a file, for example. */ + int remember_on_history = 1; ++ int enable_history_list = 1; /* value for `set -o history' */ + + /* The number of lines that Bash has added to this history session. The +*************** +*** 235,239 **** + history_expansion_inhibited = 1; + #endif +! remember_on_history = interact != 0; + history_inhibit_expansion_function = bash_history_inhibit_expansion; + } +--- 236,240 ---- + history_expansion_inhibited = 1; + #endif +! remember_on_history = enable_history_list = interact != 0; + history_inhibit_expansion_function = bash_history_inhibit_expansion; + } +*** ../bash-3.2-patched/builtins/set.def 2006-07-27 09:41:43.000000000 -0400 +--- builtins/set.def 2008-08-14 16:33:41.000000000 -0400 +*************** +*** 190,194 **** + #endif /* BANG_HISTORY */ + #if defined (HISTORY) +! { "history", '\0', &remember_on_history, bash_set_history, (setopt_get_func_t *)NULL }, + #endif + { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL }, +--- 198,202 ---- + #endif /* BANG_HISTORY */ + #if defined (HISTORY) +! { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL }, + #endif + { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL }, +*************** +*** 382,385 **** +--- 390,394 ---- + if (on_or_off == FLAG_ON) + { ++ enable_history_list = 1; + bash_history_enable (); + if (history_lines_this_session == 0) +*************** +*** 387,392 **** + } + else +! bash_history_disable (); +! return (1 - remember_on_history); + } + #endif +--- 396,404 ---- + } + else +! { +! enable_history_list = 0; +! bash_history_disable (); +! } +! return (1 - enable_history_list); + } + #endif +*************** +*** 566,570 **** + { + #if defined (HISTORY) +! remember_on_history = 1; + #endif + ignoreeof = 0; +--- 578,582 ---- + { + #if defined (HISTORY) +! remember_on_history = enable_history_list = 1; + #endif + ignoreeof = 0; +*** ../bash-3.2-patched/builtins/evalstring.c 2006-07-28 15:12:16.000000000 -0400 +--- builtins/evalstring.c 2008-11-10 21:17:16.000000000 -0500 +*************** +*** 68,71 **** +--- 68,79 ---- + static int cat_file __P((REDIRECT *)); + ++ #if defined (HISTORY) ++ static void ++ set_history_remembering () ++ { ++ remember_on_history = enable_history_list; ++ } ++ #endif ++ + /* How to force parse_and_execute () to clean up after itself. */ + void +*************** +*** 116,120 **** + + #if defined (HISTORY) +! unwind_protect_int (remember_on_history); /* can be used in scripts */ + # if defined (BANG_HISTORY) + if (interactive_shell) +--- 124,131 ---- + + #if defined (HISTORY) +! if (parse_and_execute_level == 0) +! add_unwind_protect (set_history_remembering, (char *)NULL); +! else +! unwind_protect_int (remember_on_history); /* can be used in scripts */ + # if defined (BANG_HISTORY) + if (interactive_shell) +*** ../bash-3.2-patched/bashhist.h 2005-07-01 15:44:41.000000000 -0400 +--- bashhist.h 2008-08-17 12:51:07.000000000 -0400 +*************** +*** 32,35 **** +--- 32,38 ---- + + extern int remember_on_history; ++ extern int enable_history_list; /* value for `set -o history' */ ++ extern int literal_history; /* controlled by `shopt lithist' */ ++ extern int force_append_history; + extern int history_lines_this_session; + extern int history_lines_in_file; +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 40 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 41 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-042 b/bash32-042 new file mode 100644 index 0000000..4c9f4d6 --- /dev/null +++ b/bash32-042 @@ -0,0 +1,48 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-042 + +Bug-Reported-by: Archimerged Ark Submedes +Bug-Reference-ID: <5ba4bef00804182116g65ff71e0qdffcf672f205e708@mail.gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-04/msg00041.html + +Bug-Description: + +An operator precedence error prevented the bash arithmetic evaluator from +parsing conditional commands correctly. + +Patch: + +*** ../bash-3.2-patched/expr.c 2007-12-13 22:30:43.000000000 -0500 +--- expr.c 2008-08-17 13:09:59.000000000 -0400 +*************** +*** 521,525 **** + noeval++; + } +! val2 = explor (); + if (set_noeval) + noeval--; +--- 521,526 ---- + noeval++; + } +! +! val2 = expcond (); + if (set_noeval) + noeval--; +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 41 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 42 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-043 b/bash32-043 new file mode 100644 index 0000000..5a51843 --- /dev/null +++ b/bash32-043 @@ -0,0 +1,62 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-043 + +Bug-Reported-by: Morita Sho +Bug-Reference-ID: +Bug-Reference-URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478096 + +Bug-Description: + +Side effects caused by setting function-local versions of variables bash +handles specially persisted after the function returned. + +Patch: + +*** ../bash-3.2-patched/variables.c 2007-08-25 13:47:05.000000000 -0400 +--- variables.c 2008-11-09 17:47:31.000000000 -0500 +*************** +*** 3459,3465 **** + var->attributes &= ~(att_tempvar|att_propagate); + else +! shell_variables->flags |= VC_HASTMPVAR; + v->attributes |= var->attributes; + } + + dispose_variable (var); +--- 3771,3779 ---- + var->attributes &= ~(att_tempvar|att_propagate); + else +! shell_variables->flags |= VC_HASTMPVAR; + v->attributes |= var->attributes; + } ++ else ++ stupidly_hack_special_variables (var->name); /* XXX */ + + dispose_variable (var); +*************** +*** 3548,3551 **** +--- 3862,3867 ---- + v->attributes |= var->attributes; + } ++ else ++ stupidly_hack_special_variables (var->name); /* XXX */ + + dispose_variable (var); +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 42 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 43 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-044 b/bash32-044 new file mode 100644 index 0000000..3e7a392 --- /dev/null +++ b/bash32-044 @@ -0,0 +1,150 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-044 + +Bug-Reported-by: slinkp +Bug-Reference-ID: +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00085.html + +Bug-Description: + +The presence of invisible characters in a prompt longer than the screenwidth +with invisible characters on the first and last prompt lines caused readline +to place the cursor in the wrong physical location. + +Patch: + +*** ../bash-3.2-patched/lib/readline/display.c 2007-12-14 21:12:40.000000000 -0500 +--- lib/readline/display.c 2008-10-23 09:39:46.000000000 -0400 +*************** +*** 911,914 **** +--- 944,951 ---- + OFFSET (which has already been calculated above). */ + ++ #define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset) ++ #define WRAP_OFFSET(line, offset) ((line == 0) \ ++ ? (offset ? INVIS_FIRST() : 0) \ ++ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0)) + #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) + #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) +*************** +*** 945,949 **** + _rl_last_c_pos > wrap_offset && + o_cpos < prompt_last_invisible) +! _rl_last_c_pos -= wrap_offset; + + /* If this is the line with the prompt, we might need to +--- 982,992 ---- + _rl_last_c_pos > wrap_offset && + o_cpos < prompt_last_invisible) +! _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */ +! else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && +! (MB_CUR_MAX > 1 && rl_byte_oriented == 0) && +! cpos_adjusted == 0 && +! _rl_last_c_pos != o_cpos && +! _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line)) +! _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line); + + /* If this is the line with the prompt, we might need to +*************** +*** 1205,1209 **** + { + register char *ofd, *ols, *oe, *nfd, *nls, *ne; +! int temp, lendiff, wsatend, od, nd, o_cpos; + int current_invis_chars; + int col_lendiff, col_temp; +--- 1264,1268 ---- + { + register char *ofd, *ols, *oe, *nfd, *nls, *ne; +! int temp, lendiff, wsatend, od, nd, twidth, o_cpos; + int current_invis_chars; + int col_lendiff, col_temp; +*************** +*** 1221,1225 **** + temp = _rl_last_c_pos; + else +! temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset); + if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode + && _rl_last_v_pos == current_line - 1) +--- 1280,1284 ---- + temp = _rl_last_c_pos; + else +! temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset); + if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode + && _rl_last_v_pos == current_line - 1) +*************** +*** 1587,1599 **** + { + _rl_output_some_chars (nfd + lendiff, temp - lendiff); +- #if 1 + /* XXX -- this bears closer inspection. Fixes a redisplay bug + reported against bash-3.0-alpha by Andreas Schwab involving + multibyte characters and prompt strings with invisible + characters, but was previously disabled. */ +! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); +! #else +! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff); +! #endif + } + } +--- 1648,1660 ---- + { + _rl_output_some_chars (nfd + lendiff, temp - lendiff); + /* XXX -- this bears closer inspection. Fixes a redisplay bug + reported against bash-3.0-alpha by Andreas Schwab involving + multibyte characters and prompt strings with invisible + characters, but was previously disabled. */ +! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) +! twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); +! else +! twidth = temp - lendiff; +! _rl_last_c_pos += twidth; + } + } +*************** +*** 1789,1793 **** + int cpos, dpos; /* current and desired cursor positions */ + +! woff = W_OFFSET (_rl_last_v_pos, wrap_offset); + cpos = _rl_last_c_pos; + #if defined (HANDLE_MULTIBYTE) +--- 1850,1854 ---- + int cpos, dpos; /* current and desired cursor positions */ + +! woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset); + cpos = _rl_last_c_pos; + #if defined (HANDLE_MULTIBYTE) +*************** +*** 1803,1807 **** + prompt string, since they're both buffer indices and DPOS is a + desired display position. */ +! if (new > prompt_last_invisible) /* XXX - don't use woff here */ + { + dpos -= woff; +--- 1864,1872 ---- + prompt string, since they're both buffer indices and DPOS is a + desired display position. */ +! if ((new > prompt_last_invisible) || /* XXX - don't use woff here */ +! (prompt_physical_chars > _rl_screenwidth && +! _rl_last_v_pos == prompt_last_screen_line && +! wrap_offset != woff && +! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset))) + { + dpos -= woff; +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 43 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 44 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-045 b/bash32-045 new file mode 100644 index 0000000..68b91ff --- /dev/null +++ b/bash32-045 @@ -0,0 +1,50 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-045 + +Bug-Reported-by: Roman Rakus +Bug-Reference-ID: <4864B4A0.1060402@redhat.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-06/msg00098.html + +Bug-Description: + +When short-circuiting execution due to the `break' or `continue' builtins, +bash did not preserve the value of $?. + +Patch: + +*** ../bash-3.2-patched/execute_cmd.c 2008-04-28 22:00:24.000000000 -0400 +--- execute_cmd.c 2008-10-18 14:35:03.000000000 -0400 +*************** +*** 502,507 **** +--- 514,526 ---- + volatile int save_line_number; + ++ #if 0 + if (command == 0 || breaking || continuing || read_but_dont_execute) + return (EXECUTION_SUCCESS); ++ #else ++ if (breaking || continuing) ++ return (last_command_exit_value); ++ if (command == 0 || read_but_dont_execute) ++ return (EXECUTION_SUCCESS); ++ #endif + + QUIT; +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 44 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 45 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-046 b/bash32-046 new file mode 100644 index 0000000..78aaf01 --- /dev/null +++ b/bash32-046 @@ -0,0 +1,47 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-046 + +Bug-Reported-by: Wang Xin +Bug-Reference-ID: <9a73e1570807062042ide16698m10e1b18036c95592@mail.gmail.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-07/msg00014.html + +Bug-Description: + +Bash did not compute the length of multibyte characters correctly when +performing array element length references (e.g., ${#var[subscript]}). + +Patch: + +*** /usr/src/local/bash/bash-3.2-patched/subst.c 2008-04-28 22:00:20.000000000 -0400 +--- subst.c 2008-11-10 22:02:38.000000000 -0500 +*************** +*** 4813,4817 **** + t = (ind == 0) ? value_cell (var) : (char *)NULL; + +! len = STRLEN (t); + return (len); + } +--- 4813,4817 ---- + t = (ind == 0) ? value_cell (var) : (char *)NULL; + +! len = MB_STRLEN (t); + return (len); + } +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 45 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 46 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-047 b/bash32-047 new file mode 100644 index 0000000..b8272b1 --- /dev/null +++ b/bash32-047 @@ -0,0 +1,65 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-047 + +Bug-Reported-by: Roman Rakus +Bug-Reference-ID: <48A89EBC.906@redhat.com> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-08/msg00026.html + +Bug-Description: + +When using the `.' (source) builtin, under certain circumstances bash was +too careful in discarding state to preserve internal consistency. One +effect was that assignments to readonly variables would cause entire scripts +to be aborted instead of execution of the offending command. This behavior +was introduced by bash-3.2 patch 20. + +Patch: + +*** /usr/src/local/chet/src/bash/bash-3.2-patched/subst.c 2008-04-29 21:24:55.000000000 -0400 +--- subst.c 2008-11-13 17:44:25.000000000 -0500 +*************** +*** 138,142 **** + extern int last_command_exit_value, last_command_exit_signal; + extern int subshell_environment; +! extern int subshell_level; + extern int eof_encountered; + extern int return_catch_flag, return_catch_value; +--- 138,142 ---- + extern int last_command_exit_value, last_command_exit_signal; + extern int subshell_environment; +! extern int subshell_level, parse_and_execute_level; + extern int eof_encountered; + extern int return_catch_flag, return_catch_value; +*************** +*** 7673,7677 **** + expanding_redir = 0; + +! top_level_cleanup (); /* from sig.c */ + + jump_to_top_level (v); +--- 7673,7679 ---- + expanding_redir = 0; + +! if (parse_and_execute_level == 0) +! top_level_cleanup (); /* from sig.c */ +! + + jump_to_top_level (v); +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 46 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 47 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/bash32-048 b/bash32-048 new file mode 100644 index 0000000..551dade --- /dev/null +++ b/bash32-048 @@ -0,0 +1,56 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 3.2 +Patch-ID: bash32-048 + +Bug-Reported-by: Steffen Kiess +Bug-Reference-ID: <1223929957.5383.6.camel@fips> +Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-10/msg00047.html + +Bug-Description: + +When invoked as `bash -c', bash did not execute an EXIT trap when the last +command in the executed list was a command run from the file system. + +Patch: + +*** /Users/chet/src/bash/bash-3.2-patched/builtins/evalstring.c 2006-07-28 15:12:16.000000000 -0400 +--- builtins/evalstring.c 2008-11-13 18:38:45.000000000 -0500 +*************** +*** 249,252 **** +--- 249,253 ---- + * we're not running a trap AND + * we have parsed the full command (string == '\0') AND ++ * we're not going to run the exit trap AND + * we have a simple command without redirections AND + * the command is not being timed AND +*************** +*** 259,263 **** + *bash_input.location.string == '\0' && + command->type == cm_simple && +! !command->redirects && !command->value.Simple->redirects && + ((command->flags & CMD_TIME_PIPELINE) == 0) && + ((command->flags & CMD_INVERT_RETURN) == 0)) +--- 260,265 ---- + *bash_input.location.string == '\0' && + command->type == cm_simple && +! signal_is_trapped (EXIT_TRAP) == 0 && +! command->redirects == 0 && command->value.Simple->redirects == 0 && + ((command->flags & CMD_TIME_PIPELINE) == 0) && + ((command->flags & CMD_INVERT_RETURN) == 0)) +*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 +--- patchlevel.h Mon Oct 16 14:22:54 2006 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 47 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 48 + + #endif /* _PATCHLEVEL_H_ */