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