From 07a95cfcabb0706a22599b4440b495b6cfa8123e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 4 Jul 2023 14:35:41 +0200 Subject: ash: disable check for "good" function name, bash does not check this function old new delta .rodata 105304 105261 -43 parse_command 1696 1633 -63 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-106) Total: -106 bytes Signed-off-by: Denys Vlasenko --- shell/hush.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'shell/hush.c') diff --git a/shell/hush.c b/shell/hush.c index ec4f3a2..1b7e546 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4306,7 +4306,7 @@ static int done_word(struct parse_context *ctx) || endofname(command->argv[0])[0] != '\0' ) { /* bash says just "not a valid identifier" */ - syntax_error("bad variable name in for"); + syntax_error("bad for loop variable"); return 1; } /* Force FOR to have just one word (variable name) */ @@ -4683,6 +4683,11 @@ static int parse_group(struct parse_context *ctx, syntax_error_unexpected_ch(ch); return -1; } +//bash allows functions named "123", "..", "return"! +// if (endofname(command->argv[0])[0] != '\0') { +// syntax_error("bad function name"); +// return -1; +// } nommu_addchr(&ctx->as_string, ch); command->cmd_type = CMD_FUNCDEF; goto skip; -- cgit v1.1