Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Coverity Log
CID 1612757: (#1 of 1): UNUSED_VALUE
assigned_value: The value -1 is assigned to param.fd_in here, but the stored value is overwritten before it can be used.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Coverity Log
CID 1612743: (#1 of 1): Resource leak (RESOURCE_LEAK)
12. leaked_handle: The handle variable fd_out goes out of scope and leaks the handle.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This PR will still allow basic shell operations such as cd/ls/pwd to be used even when the environment is disabled.
Signed-off-by: chao an <anchao@lixiang.com>
stdio.h remove <nuttx/xxxx.h> Some .c previously depended on
<nuttx/xxx.h> and needed to be added to .c instead of stdio.h
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
1. Input redirect flags currently is hardcode, passing by arguments maybe better.
2. Only support redirect to path_name, redirect to fd is needed for pipeline.
Test
1. Redirect in
cat < /etc/init.d/rc.sysinit
2. Redirect with FIFO
mkfifo /dev/testfifo
cat /dev/testfifo &
ls > /dev/testfifo
3. NSH Params
set name `uname`
echo $name
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Without this patch
nsh> ls /etc/group | dd | dd
sh [13:100]
sh [14:100]
nsh: dd: read failed: 4
nsh>
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
There is no corresponding sched_lock() for this and therefore this causes
random crashes.
Found when running a long init script which utilizes shell variables in
SMP mode.
CC: mm_heap/mm_memalign.c misc/rwbuffer.c: In function 'rwb_readbytes':
misc/rwbuffer.c:1172:2: warning: #warning Not Implemented [-Wcpp]
1172 | #warning Not Implemented
| ^~~~~~~
CC: binfmt_unloadmodule.c In file included from nsh_console.c:40:
nsh_console.c: In function 'nsh_consoleredirect':
nsh_console.h:85:30: error: 'struct serialsave_s' has no member named 'cn_confd'; did you mean 'cn_infd'?
85 | # define INFD(p) ((p)->cn_confd)
| ^~~~~~~~
nsh_console.c:344:7: note: in expansion of macro 'INFD'
344 | INFD(ssave) = INFD(pstate);
| ^~~~
nsh_console.c: In function 'nsh_consoleundirect':
nsh_console.h:85:30: error: 'struct serialsave_s' has no member named 'cn_confd'; did you mean 'cn_infd'?
85 | # define INFD(p) ((p)->cn_confd)
| ^~~~~~~~
nsh_console.c:370:18: note: in expansion of macro 'INFD'
370 | INFD(pstate) = INFD(ssave);
| ^~~~
Signed-off-by: ligd <liguiding1@xiaomi.com>
pthread & detach will still quit when parent task exit,
cause nsh_parse clone args leak. nsh should use task instead of thread
this case can reproduce the memory leak.
int main(int argc, FAR char *argv[])
{
printf("Hello, World!!\n");
system("sleep 1 &");
return 0;
}
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Obtaining the heap usage size requires traversing all memory.
When the number of threads is large, it will become very slow.
ps -heap
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK HEAP STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 4338432 2162672 0005196 0.2% Idle_Task
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
arm-none-eabi/bin/ld: apps/libapps.a(nsh_proccmds.c.obj): in function `cmd_pkill':
apps/nshlib/nsh_proccmds.c:861:(.text.cmd_pkill+0x38): undefined reference to `nsh_getpid'
Signed-off-by: chao an <anchao@lixiang.com>
Board/Config/Command
sim:nsh
cat < /etc/init.d/rc.sysinit
Problem
The NSH hangs after exec the test command.
`nsh_redirect()` needs to save three fd but array length is only two, stack buffer overflowed!
Related: https://github.com/apache/nuttx-apps/pull/2469
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
nsh_syscmds.c: In function ‘cmd_rpmsg_once’:
nsh_syscmds.c:567:13: error: ‘RPMSGIOC_PANIC’ undeclared (first use in this function)
567 | cmd = RPMSGIOC_PANIC;
| ^~~~~~~~~~~~~~
nsh_syscmds.c:567:13: note: each undeclared identifier is reported only once for each function it appears in
nsh_syscmds.c:571:13: error: ‘RPMSGIOC_DUMP’ undeclared (first use in this function); did you mean ‘FIOC_DUMP’?
571 | cmd = RPMSGIOC_DUMP;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
1. struct rpmsg_ping_s ack change to cmd;
2. Update the help descrption based on the new cmd
meaning;
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>