Thread View: gnu.bash.bug
1 messages
1 total messages
Started by Chip Salzenberg
Mon, 22 Jan 1990 18:48
Bash 1.04 patch: function return -- IMPORTANT
Author: Chip Salzenberg
Date: Mon, 22 Jan 1990 18:48
Date: Mon, 22 Jan 1990 18:48
26 lines
1444 bytes
1444 bytes
Bash 1.04 has a serious bug in the handling of the "return" statement in
shell functions. Falling off the end of a shell function automatically
cleans up local variables and redirection. The code obviously should do
the same when the "return" statement is executed, but Bash 1.04, as
distributed, does not do so. This patch fixes the bug.
Index: execute_cmd.c
***************
*** 741,747 ****
remember_args (words->next, 1);
result = execute_command (tc);
- run_unwind_frame ("function_calling");
}
return_catch_flag--;
redirection_undo_list = saved_undo_list;
}
--- 741,749 ----
remember_args (words->next, 1);
result = execute_command (tc);
}
+ run_unwind_frame ("function_calling");
return_catch_flag--;
+ do_redirections (redirection_undo_list, 1, 0);
+ dispose_redirects (redirection_undo_list);
redirection_undo_list = saved_undo_list;
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads