This is an automated email from the ASF dual-hosted git repository.

acassis 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 fabafbc36 nshlib: add relative image path support in boot command
fabafbc36 is described below

commit fabafbc3615b3d22636bbf33f932578f491bef23
Author: Junbo Zheng <[email protected]>
AuthorDate: 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]>
---
 nshlib/nsh_syscmds.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 88db8c913..15ca82c46 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -405,6 +405,7 @@ int cmd_switchboot(FAR struct nsh_vtbl_s *vtbl, int argc, 
FAR char **argv)
 int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
 {
   struct boardioc_boot_info_s info;
+  FAR char *fullpath = NULL;
 
   memset(&info, 0, sizeof(info));
 
@@ -421,7 +422,8 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR 
char **argv)
         /* Go through */
 
       case 1:
-        info.path = argv[1];
+        fullpath = nsh_getfullpath(vtbl, argv[1]);
+        info.path = fullpath;
 
         /* Go through */
 
@@ -439,6 +441,7 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR 
char **argv)
    */
 
   nsh_error(vtbl, g_fmtcmdfailed, argv[0], "boardctl", NSH_ERRNO);
+  nsh_freefullpath(fullpath);
   return ERROR;
 }
 #endif

Reply via email to