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