This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 145e64a5d nshlib: boot: guard nsh_getfullpath against NULL argv[1]
145e64a5d is described below
commit 145e64a5d40a874da1a0f1ab49546152d55d50f4
Author: Junbo Zheng <[email protected]>
AuthorDate: Tue Aug 4 22:05:26 2026 +0800
nshlib: boot: guard nsh_getfullpath against NULL argv[1]
A bare `boot` (no argument, argc == 1) passes argv[1] == NULL.
nsh_getfullpath(NULL) returns strdup(g_home) == "/" instead of NULL,
which turned the default-boot path (NULL -> board default image)
into "/". board_boot_image("/") then failed with -EINVAL (-22),
preventing the board from booting.
Guard the nsh_getfullpath() call so NULL passes through unchanged,
restoring the original default-boot behavior while still resolving
relative paths when an argument is given.
This fixes the regression introduced by the relative-path support
```
commit fabafbc3615b3d22636bbf33f932578f491bef23 (origin/master, origin/HEAD)
Author: Junbo Zheng <[email protected]>
Date: Fri Jul 24 23:47:44 2026 +0800
nshlib: add relative image path support in boot command
cmd_boot passed the image path straight to boardctl(), which resolves
it in a context that does not inherit the NSH shell cwd, so relative
paths failed and only absolute paths worked. Use nsh_getfullpath() to
resolve relative paths against the cwd before calling boardctl().
Signed-off-by: Junbo Zheng <[email protected]>
```
Signed-off-by: Junbo Zheng <[email protected]>
---
nshlib/nsh_syscmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 15ca82c46..8ddda99a8 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -422,7 +422,7 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR
char **argv)
/* Go through */
case 1:
- fullpath = nsh_getfullpath(vtbl, argv[1]);
+ fullpath = argv[1] ? nsh_getfullpath(vtbl, argv[1]) : NULL;
info.path = fullpath;
/* Go through */