aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parse_execution.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-08 15:57:56 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-14 20:38:32 -0700
commit51468b764689e7d724a87e6c2b8cdb4e599a3604 (patch)
tree75fe13dbad791e0d143a3610bfe7ed7d0136ad38 /src/parse_execution.cpp
parentff1d651415a2752e82ec417294f9bdf8c234c10f (diff)
add `function --shadow-builtin` flag
It's currently too easy for someone to bork their shell by doing something like `function test; return 0; end`. That's obviously a silly, contrived, example but the point is that novice users who learn about functions are prone to do something like that without realizing it will bork the shell. Even expert users who know about the `test` builtin might forget that, say, `pwd` is a builtin. This change adds a `--shadow-builtin` flag that must be specified to indicate you know what you're doing. Fixes #3000
Diffstat (limited to 'src/parse_execution.cpp')
-rw-r--r--src/parse_execution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp
index cca0b8d9..7989597f 100644
--- a/src/parse_execution.cpp
+++ b/src/parse_execution.cpp
@@ -392,8 +392,8 @@ parse_execution_result_t parse_execution_context_t::run_function_statement(
int definition_line_offset = this->line_offset_of_character_at_offset(contents_start);
wcstring error_str;
io_streams_t streams;
- int err = define_function(*parser, streams, argument_list, contents_str,
- definition_line_offset, &error_str);
+ int err = builtin_function(*parser, streams, argument_list, contents_str,
+ definition_line_offset, &error_str);
proc_set_last_status(err);
if (!error_str.empty()) {