Debian Bug report logs - #1039042
coreutils: tail: on blockdevs reads the whole thing, doesn't on files of the same size

version graph

Package: coreutils; Maintainer for coreutils is Michael Stone <[email protected]>; Source for coreutils is src:coreutils (PTS, buildd, popcon).

Reported by: наб <[email protected]>

Date: Sat, 24 Jun 2023 23:21:02 UTC

Severity: normal

Found in version coreutils/9.1-1

Full log


Message #5 received at [email protected] (full text, mbox, reply):

Received: (at submit) by bugs.debian.org; 24 Jun 2023 23:17:13 +0000
From [email protected] Sat Jun 24 23:17:12 2023
X-Spam-Checker-Version: SpamAssassin 3.4.6-bugs.debian.org_2005_01_02
	(2021-04-09) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-14.3 required=4.0 tests=BAYES_00,DIGITS_LETTERS,
	DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FOURLA,HAS_PACKAGE,
	MD5_SHA1_SUM,PGPSIGNATURE,RDNS_NONE,SPF_HELO_PASS,SPF_PASS,
	T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no
	version=3.4.6-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 22; hammy, 150; neutral, 81; spammy,
	0. spammytokens: hammytokens:0.000-+--sk:taint_o, 0.000-+--sk:TAINT_O,
	0.000-+--sk:taint_u, 0.000-+--sk:TAINT_U, 0.000-+--H*ct:application
Return-path: <[email protected]>
Received: from [139.28.40.42] (port=54290 helo=tarta.nabijaczleweli.xyz)
	by buxtehude.debian.org with esmtp (Exim 4.94.2)
	(envelope-from <[email protected]>)
	id 1qDCVE-003FXm-LY
	for [email protected]; Sat, 24 Jun 2023 23:17:12 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz;
	s=202305; t=1687648630;
	bh=RFuqr3MTn9J6LJBBQnBl+b/sBgh6Isx0AzpYK9RGENI=;
	h=Date:From:To:Subject:From;
	b=AW62oau+l7FwpcUSmw/0ak2YTXHo1vsEJCM4bBzU3PzwBacoyve4YGtNTovtofrlu
	 9hmyaNq2pe74qroQJnWbnkbOotdpce7tQPu5D3ull1GsEGkzldkQLhr5SU4th/0Pa9
	 e3PP9Q2eDNGGdDQECDbJdDd/ocMuPePQdLWbtu/9/jrslYydHAMBqqIpLWvFpPo2+7
	 ZdgpZgU3OXB3Bdf5ppm0RFuvo9TfeY6rSEH3zGClsB/U8ex/RnFJA9fGWysH8stAOH
	 /OiDh+WaMncnl35AhiTNBs+DtZ32UN0UrhX32+GDe6hhJSmUCx7Rxfyvacbr2gTNIv
	 Qp6wRT/f/u6Tw==
Received: by tarta.nabijaczleweli.xyz (Postfix, from userid 1000)
	id 3384E1690; Sun, 25 Jun 2023 01:17:10 +0200 (CEST)
Date: Sun, 25 Jun 2023 01:17:10 +0200
From: наб <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: coreutils: tail: on blockdevs reads the whole thing, doesn't on
 files of the same size
Message-ID: <h6hne3lzxmxj4banwbtriritntcefotdcgnku23376viw53ikx@xeaupgzfobst>
Mail-Followup-To: Debian Bug Tracking System <[email protected]>
X-Reportbug-Version: 12.0.0
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="pq3frbvprjbrbzuy"
Content-Disposition: inline
User-Agent: NeoMutt/20230517
Delivered-To: [email protected]
[Message part 1 (text/plain, inline)]
Package: coreutils
Version: 9.1-1
Severity: normal

Dear Maintainer,

$ cp --sparse=always /dev/zvol/filling/store/nabijaczleweli/vm-zoot /tmp/
$ time tail /dev/zvol/filling/store/nabijaczleweli/vm-zoot | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m17.235s
user    0m1.344s
sys     0m9.693s
$ time tail /tmp/vm-zoot | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m0.005s
user    0m0.005s
sys     0m0.004s
$ time cat /dev/zvol/filling/store/nabijaczleweli/vm-zoot | tail | b2sum
11d28bd10ad4d4ae652e02aaaa6f59f1ef5ff5f44111e3e3c80d5ae01f666e00f38d626784539b9f095255a246d9b6b56624fd08c8916a10b16e7b5b6560d7f1  -

real    0m17.271s
user    0m1.620s
sys     0m17.504s

Somehow I feel there's no reason that tail couldn't lseek(SEEK_END) on a
blockdev just as well as it can do on a regular file.

Best,
наб

-- System Information:
Debian Release: 12.0
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-9-amd64 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages coreutils depends on:
ii  libacl1      2.3.1-3
ii  libattr1     1:2.5.1-4
ii  libc6        2.36-9
ii  libgmp10     2:6.2.1+dfsg1-1.1
ii  libselinux1  3.4-1+b6

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information
[signature.asc (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 14:26:20 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.