Package: libserial1 Version: 1.0.0-9+b2 Severity: normal Tags: patch upstream
Dear Maintainer, when writing data to a serial port, occasional exception "Interrupted system call" is thrown by libserial. This is because there is no retry in case a call to tcdrain returns EINTR. The bug was reported upstream: https://github.com/crayzeewulf/libserial/issues/194 A pull request was also submitted: https://github.com/crayzeewulf/libserial/pull/195 The proposed fix was tested in a special setup where data was continuosly written to the serial port through libserial and at the same time repeated systemcalls via sysfs were made. Without the change the exception could be easily reproduced, after the proposed change it did not occur anymore for several days. I ask you to include this patch in Debian as I don't expect a new upstream release for this. Thanks, Tobias -- System Information: Debian Release: trixie/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: arm64, armhf Kernel: Linux 6.12.11-amd64 (SMP w/10 CPU threads; PREEMPT) Kernel taint flags: TAINT_SOFTLOCKUP Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages libserial1 depends on: ii libc6 2.41-6 ii libgcc-s1 14.2.0-19 ii libstdc++6 14.2.0-19 libserial1 recommends no packages. libserial1 suggests no packages. -- no debconf information
From: Tobias Graemer <tobias.grae...@mt.com> Date: Thu, 10 Apr 2025 10:31:17 +0200 Subject: [PATCH] Call tcdrain with retry When writing to the serial port, exception "interrupted system call" was observed. System calls that are interrupted shall be repeated, as explained in the description of call_with_retry() template function. --- src/SerialPort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SerialPort.cpp b/src/SerialPort.cpp index e354fcb..b5b4d12 100644 --- a/src/SerialPort.cpp +++ b/src/SerialPort.cpp @@ -922,7 +922,7 @@ namespace LibSerial throw NotOpen(ERR_MSG_PORT_NOT_OPEN) ; } - if (tcdrain(this->mFileDescriptor) < 0) + if (call_with_retry(tcdrain, this->mFileDescriptor) < 0) { throw std::runtime_error(std::strerror(errno)) ; }