1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-03-01 02:26:17 +02:00
Files
coreutils/tests/tail/basic-seek.sh
Hannes Braun 914972e80d tail: fix tailing larger number of lines in regular files
* src/tail.c (file_lines): Seek to the previous block instead of the
beginning (or a little before) of the block that was just scanned.
Otherwise, the same block is read and scanned (at least partially)
again. This bug was introduced by commit v9.7-219-g976f8abc1.
* tests/tail/basic-seek.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: mention the bug fix.
2025-09-24 22:37:18 +01:00

29 lines
1006 B
Bash
Executable File

#!/bin/sh
# Verify that tail works when seeking within a file
# Copyright (C) 2025 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ tail
yes '=================================' |
head -n1K > file.in || framework_failure_
# This returned 139 in coreutils v9.8
test $(tail -n200 file.in | wc -l) = 200 || fail=1
Exit $fail