You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Busybox applets (echo in this case) assume correct SIGPIPE signal behaviour which terminates the process.
As a quick check I modified proc_write() in kernel so that SIGPIPE signal gets sent:
err=proc_send(oid.port, msg);
if (err >= 0) {
if ((err=msg->o.io.err) ==-EPIPE)
threads_sigpost(proc_current()->process, proc_current(), 13/*SIGPIPE*/);
}
As a result default SIGPIPE signal handler terminates the process and error messages no longer appear on the screen:
Please note that 'the quick check' probably isn't a correct way of sending SIGPIPE signal - I'll check how it should be done.
Verified on host (linux) that the echo $text process is being killed by SIGPIPE (incomplete write) if the write size exceeds the kernel pipe buffer (65535 bytes by default), code to reproduce:
strace -f busybox ash -c 'text=$(yes abc | head -c 655360); busybox echo $text | busybox head -c 5'
I don't know if the EPIPE errno is being set in case of partial write (to be checked).
Maxez
pushed a commit
to phoenix-rtos/libphoenix
that referenced
this issue
Aug 19, 2021
To reproduce:
edit /etc/rc.psh in rootskel like that (for posixsrv run in background):
![image](https://user-images.githubusercontent.com/77304431/129186875-e9081788-5289-4ceb-a2af-902820f1936d.png)
run system image
run /bin/psh /etc/rc.psh (for posixsrv run in background)
run /bin/sh
run text='yes abc | head -c 9999'
run echo "$text" | head -c 5
The text was updated successfully, but these errors were encountered: