mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
fd61773e6f
Two cosmetic-but-noisy errors at every SITL boot once the rcS runs via
the portable /bin/sh backend (this branch's commit 9abb4ac867). On
ROS Integration Tests the container ships without bc, so the
PX4_SIM_SPEED_FACTOR multiplications fail and rcS emits:
px4-rc: 190: etc/init.d-posix/rcS: bc: not found
COM_DL_LOSS_T set to
ERROR [param] not enough arguments.
Try 'param set COM_DL_LOSS_T 3 [fail]'
(The ros_test_runner.py path always sets PX4_SIM_SPEED_FACTOR=1, so
the bc block always runs even though the multiplication is a no-op.)
Substitute awk -v s="$SF" 'BEGIN{print s*N}' for the bc one-liners.
awk is in coreutils on every PX4 dev / CI image and produces identical
floating-point output; bc is not packaged in the ROS Integration
container.
Separately, every external param-set call from the rcS races the
daemon's closesocket() and the client's recv() picks up ECONNRESET
(or EPIPE) instead of a clean EOF, even though the {0, retval}
sentinel is already buffered. The Linux #else branch unconditionally
logged "unable to read from socket" and returned -1, drowning the rcS
output in spurious errors:
EKF2_EV_CTRL: curr: 0 -> new: 15
ERROR [px4_daemon] unable to read from socket
Mirror the Windows WSAECONNRESET / WSAESHUTDOWN handling on Linux:
when errno is ECONNRESET / EPIPE and the sentinel is buffered, honour
it as end-of-stream instead of treating the close race as a failure.
Also append strerror(errno) to the surviving error path so a real
socket failure (EBADF, EINTR, ENOMEM, ...) still surfaces with the
underlying cause.
Both fixes are no-ops on the happy path; they only suppress error
output that the daemon-client teardown race emits during normal
shutdown.
Signed-off-by: Nuno Marques <n.marques21@hotmail.com>