This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit e20d2688abe487b4738b90770445e08c24f954a1 Author: Ville Juven <[email protected]> AuthorDate: Wed Mar 22 11:42:57 2023 +0200 nsh/alias: Do not expand argument lists, only the command A resulting word that is identified to be the command name word of a simple command shall be examined to determine whether it is an unquoted, valid alias name. The keyword here being "a simple command", arguments are not subject to expansion. --- nshlib/nsh_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index 392d59eb3..75c7876a1 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -1809,7 +1809,7 @@ static FAR char *nsh_argument(FAR struct nsh_vtbl_s *vtbl, #ifdef CONFIG_NSH_ALIAS /* Expand aliases (if applicable) first, quoting prevents this */ - if (!quoted) + if (alist && !quoted) { pbegin = nsh_aliasexpand(vtbl, pbegin, alist); } @@ -2427,7 +2427,7 @@ static int nsh_parse_cmdparm(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline, argv[0] = cmd; for (argc = 1; argc < MAX_ARGV_ENTRIES - 1; argc++) { - argv[argc] = nsh_argument(vtbl, &saveptr, &memlist, &alist, NULL); + argv[argc] = nsh_argument(vtbl, &saveptr, &memlist, NULL, NULL); if (!argv[argc]) { break; @@ -2571,7 +2571,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) { int isenvvar = 0; /* flag for if an environment variable gets expanded */ - argv[argc] = nsh_argument(vtbl, &saveptr, &memlist, &alist, &isenvvar); + argv[argc] = nsh_argument(vtbl, &saveptr, &memlist, NULL, &isenvvar); if (!argv[argc]) {
