]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tail: fix EINTR handling on older systems
authorPádraig Brady <P@draigBrady.com>
Sat, 24 Jan 2026 18:04:46 +0000 (18:04 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 24 Jan 2026 20:00:32 +0000 (20:00 +0000)
tail(1) could fail with an "Interrupted system call"
diagnostic, on some systems like Centos 5 (Linux 2.6.18).
This was seen with tests/tail/overlay-headers.sh
which sends SIGCONT, which should not induce a failure.

* src/tail.c (tail_forever_inotify): Retry the poll()
upon receiving a non terminating signal, and the syscall
is not automatically restarted by the system.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.

NEWS
src/tail.c

diff --git a/NEWS b/NEWS
index c3c985bb32943d88d5140f9f18dd439df8c5c193..a19744ddd04bbf7bee8ea917ecba0506ff61032f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   'numfmt' no longer drops custom suffixes from numbers it cannot fully parse.
   [bug introduced with numfmt in coreutils-8.21]
 
+  'tail -f --pid' can no longer exit upon receiving a non terminating signal.
+  On older Linux systems it may have failed with "Interrupted system call".
+  [bug introduced in coreutils-7.5]
+
   'timeout' will now propagate all terminating signals to the monitored command.
   Previously 'timeout' could have exited and left the monitored command running.
   [bug introduced with timeout in coreutils-7.0]
index e549f5df02b0bc6822f1cea4b5b35dad73a88579..c0d4e0329ee336e0a83b97c19508bcb76cfa3b2e 100644 (file)
@@ -1684,7 +1684,7 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files,
               pfd[1].events = pfd[1].revents = 0;
               file_change = poll (pfd, monitor_output + 1, delay);
             }
-          while (file_change == 0);
+          while (file_change == 0 || (file_change < 0 && errno == EINTR));
 
           if (file_change < 0)
             error (EXIT_FAILURE, errno,