54 lines
1.7 KiB
Diff
54 lines
1.7 KiB
Diff
|
|
From c0c63e9735908a9579f8735001957db6bd81afc3 Mon Sep 17 00:00:00 2001
|
||
|
|
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||
|
|
Date: Mon, 30 Jan 2023 21:44:10 +0000
|
||
|
|
Subject: [PATCH] tail: fix support for -F with non seekable files
|
||
|
|
|
||
|
|
This was seen to be an issue when following a
|
||
|
|
symlink that was being updated to point to
|
||
|
|
different underlying devices.
|
||
|
|
|
||
|
|
* src/tail.c (recheck): Guard the lseek() call to only
|
||
|
|
be performed for regular files.
|
||
|
|
* NEWS: Mention the bug fix.
|
||
|
|
|
||
|
|
Reference:https://github.com/coreutils/coreutils/commit/c0c63e9735908a9579f8735001957db6bd81afc3
|
||
|
|
Conflict:NEWS Context adapation
|
||
|
|
|
||
|
|
---
|
||
|
|
NEWS | 4 ++++
|
||
|
|
src/tail.c | 3 ++-
|
||
|
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/NEWS b/NEWS
|
||
|
|
index b65bc85..f65eb95 100644
|
||
|
|
--- a/NEWS
|
||
|
|
+++ b/NEWS
|
||
|
|
@@ -3,6 +3,10 @@ GNU coreutils NEWS -*- outline -*-
|
||
|
|
* Noteworthy changes in release 9.0 (2021-09-24) [stable]
|
||
|
|
|
||
|
|
** Bug fixes
|
||
|
|
+ tail --follow=name works again with non seekable files. Previously it
|
||
|
|
+ exited with an "Illegal seek" error when such a file was replaced.
|
||
|
|
+ [bug introduced in fileutils-4.1.6]
|
||
|
|
+
|
||
|
|
cp, mv, and install now handle ENOENT failures across CIFS file systems,
|
||
|
|
falling back from copy_file_range to a better supported standard copy.
|
||
|
|
[issue introduced in coreutils-9.0]
|
||
|
|
diff --git a/src/tail.c b/src/tail.c
|
||
|
|
index 2244509dd..03061e8bf 100644
|
||
|
|
--- a/src/tail.c
|
||
|
|
+++ b/src/tail.c
|
||
|
|
@@ -1122,7 +1122,8 @@ recheck (struct File_spec *f, bool blocking)
|
||
|
|
{
|
||
|
|
/* Start at the beginning of the file. */
|
||
|
|
record_open_fd (f, fd, 0, &new_stats, (is_stdin ? -1 : blocking));
|
||
|
|
- xlseek (fd, 0, SEEK_SET, pretty_name (f));
|
||
|
|
+ if (S_ISREG (new_stats.st_mode))
|
||
|
|
+ xlseek (fd, 0, SEEK_SET, pretty_name (f));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|