|
|
ff19ae |
*** ../bash-4.3-patched/builtins/common.h 2013-07-08 16:54:47.000000000 -0400
|
|
|
ff19ae |
--- builtins/common.h 2014-09-12 14:25:47.000000000 -0400
|
|
|
ff19ae |
***************
|
|
|
ff19ae |
*** 34,37 ****
|
|
|
ff19ae |
--- 49,54 ----
|
|
|
ff19ae |
#define SEVAL_PARSEONLY 0x020
|
|
|
ff19ae |
#define SEVAL_NOLONGJMP 0x040
|
|
|
ff19ae |
+ #define SEVAL_FUNCDEF 0x080 /* only allow function definitions */
|
|
|
ff19ae |
+ #define SEVAL_ONECMD 0x100 /* only allow a single command */
|
|
|
ff19ae |
|
|
|
ff19ae |
/* Flags for describe_command, shared between type.def and command.def */
|
|
|
ff19ae |
*** ../bash-4.3-patched/builtins/evalstring.c 2014-02-11 09:42:10.000000000 -0500
|
|
|
ff19ae |
--- builtins/evalstring.c 2014-09-14 14:15:13.000000000 -0400
|
|
|
ff19ae |
***************
|
|
|
ff19ae |
*** 309,312 ****
|
|
|
ff19ae |
--- 313,324 ----
|
|
|
ff19ae |
struct fd_bitmap *bitmap;
|
|
|
ff19ae |
|
|
|
ff19ae |
+ if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def)
|
|
|
ff19ae |
+ {
|
|
|
ff19ae |
+ internal_warning ("%s: ignoring function definition attempt", from_file);
|
|
|
ff19ae |
+ should_jump_to_top_level = 0;
|
|
|
ff19ae |
+ last_result = last_command_exit_value = EX_BADUSAGE;
|
|
|
ff19ae |
+ break;
|
|
|
ff19ae |
+ }
|
|
|
ff19ae |
+
|
|
|
ff19ae |
bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
|
|
|
ff19ae |
begin_unwind_frame ("pe_dispose");
|
|
|
ff19ae |
***************
|
|
|
ff19ae |
*** 369,372 ****
|
|
|
ff19ae |
--- 381,387 ----
|
|
|
ff19ae |
dispose_fd_bitmap (bitmap);
|
|
|
ff19ae |
discard_unwind_frame ("pe_dispose");
|
|
|
ff19ae |
+
|
|
|
ff19ae |
+ if (flags & SEVAL_ONECMD)
|
|
|
ff19ae |
+ break;
|
|
|
ff19ae |
}
|
|
|
ff19ae |
}
|
|
|
ff19ae |
*** ../bash-4.3-patched/variables.c 2014-05-15 08:26:50.000000000 -0400
|
|
|
ff19ae |
--- variables.c 2014-09-14 14:23:35.000000000 -0400
|
|
|
ff19ae |
***************
|
|
|
ff19ae |
*** 359,368 ****
|
|
|
ff19ae |
strcpy (temp_string + char_index + 1, string);
|
|
|
ff19ae |
|
|
|
ff19ae |
! parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST);
|
|
|
ff19ae |
!
|
|
|
ff19ae |
! /* Ancient backwards compatibility. Old versions of bash exported
|
|
|
ff19ae |
! functions like name()=() {...} */
|
|
|
ff19ae |
! if (name[char_index - 1] == ')' && name[char_index - 2] == '(')
|
|
|
ff19ae |
! name[char_index - 2] = '\0';
|
|
|
ff19ae |
|
|
|
ff19ae |
if (temp_var = find_function (name))
|
|
|
ff19ae |
--- 364,372 ----
|
|
|
ff19ae |
strcpy (temp_string + char_index + 1, string);
|
|
|
ff19ae |
|
|
|
ff19ae |
! /* Don't import function names that are invalid identifiers from the
|
|
|
ff19ae |
! environment, though we still allow them to be defined as shell
|
|
|
ff19ae |
! variables. */
|
|
|
ff19ae |
! if (legal_identifier (name))
|
|
|
ff19ae |
! parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
|
|
|
ff19ae |
|
|
|
ff19ae |
if (temp_var = find_function (name))
|
|
|
ff19ae |
***************
|
|
|
ff19ae |
*** 362,369 ****
|
|
|
ff19ae |
else
|
|
|
ff19ae |
report_error (_("error importing function definition for `%s'"), name);
|
|
|
ff19ae |
-
|
|
|
ff19ae |
- /* ( */
|
|
|
ff19ae |
- if (name[char_index - 1] == ')' && name[char_index - 2] == '\0')
|
|
|
ff19ae |
- name[char_index - 2] = '('; /* ) */
|
|
|
ff19ae |
}
|
|
|
ff19ae |
#if defined (ARRAY_VARS)
|
|
|
ff19ae |
--- 360,363 ----
|