代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/coreutils 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 1ed5aa2254505fbf971c6db6810130227f552eec Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Thu, 16 May 2024 10:57:26 +0800
Subject: [PATCH] tac: handle short reads on input
This can be reproduced by getting the read() above 2G,
which induces a short read, thus triggering the erroneous failure.
$ truncate -s 5G 5G
$ cat 5G | TMPDIR=$PWD tac | wc -c
tac: /tmp/tacFt7txA: read error: Illegal seek
0
With the fix in place we now get:
$ cat 5G | TMPDIR=$PWD src/tac | wc -c
5368709120
---
NEWS | 5 +++++
src/tac.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 4a09ab4..39d1024 100644
--- a/NEWS
+++ b/NEWS
@@ -207,6 +207,11 @@ GNU coreutils NEWS -*- outline -*-
non regular files are specified, as inotify is ineffective with these.
[bug introduced with inotify support added in coreutils-7.5]
+ tac now handles short reads on its input. Previously it may have exited
+ erroneously, especially with large input files with no separators.
+ [This bug was present in "the beginning".]
+
+
uptime no longer outputs the AM/PM component of the current time,
as that's inconsistent with the 24 hour time format used.
[bug introduced in coreutils-7.0]
diff --git a/src/tac.c b/src/tac.c
index 753f8f1..1186d94 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -46,6 +46,7 @@ tac -r -s '.\|
#include "die.h"
#include "error.h"
#include "filenamecat.h"
+#include "full-read.h"
#include "safe-read.h"
#include "stdlib--.h"
#include "xbinary-io.h"
@@ -352,7 +353,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
else
match_start = past_end;
- if (safe_read (input_fd, G_buffer, read_size) != read_size)
+ if (full_read (input_fd, G_buffer, read_size) != read_size)
{
error (0, errno, _("%s: read error"), quotef (file));
return false;
--
2.39.3
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。