From nobody Sat Apr 27 07:08:27 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VRLKS2GMLz5J0xB; Sat, 27 Apr 2024 07:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VRLKS0c49z44Tv; Sat, 27 Apr 2024 07:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714201708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a6oHJPF9IPfYc6Aa3iFsZ99jKYnJJA8C+3gO4wOhotM=; b=aenj40V53K7PRQ5loxHfcZxsgRlbGuvbSThvaRCpO94lzIhVI0cuY9rXWBzGoDcTsHY25j u0TMhg9LFNX/h3FHImBzWYADqrZXs58PctJp6zcEnQw1o056O1+u+GvG/LU3XZ75X+J4cL iYP5NZXGF5+ifEsbmSrCoW+KfC8IoNZa5nbDe7VWqTyoUdU4bAc+o75qxL6WQ6YteeSFEc xKLH5sOa8ebgYpCcUoNANGCc55Ra7bvRq/9/Ws5+SgJ1zRwi1SZ/Y+RcYl32hwzbDFk8yY QVaNyP39zu0TZHYWFELoz/8VQ8kd3lOxSIfcuttKWEevyRwrSLBYADVB4DFzKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714201708; a=rsa-sha256; cv=none; b=L3L+9qUd5ZOTYyixpul//qYXEfEShAkSExKy3IrTeIo1lkTD0SKH0wZJ5pRQefW6gbzgBv WaJrl5mZH09hnmHnub7YtKXYuo7VohkkrPvHbpt4/rCv+Qv/ZcT1Yisbj5XZUVWyd6popv pOG/2jQ71qR7bsKW5RxD8Nssysm6U8wge1Me7Q2nB8N6q2ILWEbPLuUqr7BeksvTX/rngB plbl4G8oE7Vr24hYeYT625M6Lre37JMaSR52gA2zoMMB9YaNQfgg2pfIOpMOt8hJN5JLy0 2mUMnpjuCpUbHPUGu7LvA2e32H+XKHcqQKf1ijODOKSRRWsTsAn1mYehEDROgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714201708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a6oHJPF9IPfYc6Aa3iFsZ99jKYnJJA8C+3gO4wOhotM=; b=JFfVVGkt1ugDJdWgYnMl+w4DSRY3rxutJgfx+D+UV+DBXINqwqg3agmPn14jOxg+JPQsHr U65rKtRa2pluQ/C+xMn2LzS51blX2bllyojKyUOr9vzliBAULofR5RDDWjXifvog6jBYeM Wg8f6OvKBxiF/kzw2HB3GzJq5hyHC7XklIL6asi/8wwkS0cDSg+QwSjIEstApUTBCkSir6 2lwCcPFMMMVVjCxeX97Whd/Pho1rhVBmsPoj6E4eyCGx4TK7V6Y2RiEbTnEDm18nmZKCUr RVYgP9VAfH8P6TSL+lcuquMvTVdOW/PIIpQ/lgv5l5BO3zQqDr0V4rb+0UhUoA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VRLKR6SBVzGvK; Sat, 27 Apr 2024 07:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43R78Rxb037010; Sat, 27 Apr 2024 07:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43R78ROD037007; Sat, 27 Apr 2024 07:08:27 GMT (envelope-from git) Date: Sat, 27 Apr 2024 07:08:27 GMT Message-Id: <202404270708.43R78ROD037007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 302d0acea8a0 - stable/13 - MFV: less: Do not trust st_size if it equals zero List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 302d0acea8a0bc18a26b5e0f1a7870b09dc58d16 Auto-Submitted: auto-generated The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=302d0acea8a0bc18a26b5e0f1a7870b09dc58d16 commit 302d0acea8a0bc18a26b5e0f1a7870b09dc58d16 Author: Ricardo Branco AuthorDate: 2024-04-24 05:29:46 +0000 Commit: Xin LI CommitDate: 2024-04-27 07:08:17 +0000 MFV: less: Do not trust st_size if it equals zero This is a smaller version of upstream 1fafd968b48e5cea6c85f126d77071a8de707a55 to address the issue that less not being able to operate on files residing in pseudo-filesystems that advertize a zero size value. PR: bin/276133 (cherry picked from commit cae336280b0d7ad3d49788c5fc0986f91328eb50) --- contrib/less/ch.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/contrib/less/ch.c b/contrib/less/ch.c index fd53b2d66e38..51045438a296 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -700,7 +700,6 @@ public void ch_flush(void) ch_block = 0; /* ch_fpos / LBUFSIZE; */ ch_offset = 0; /* ch_fpos % LBUFSIZE; */ -#if HAVE_PROCFS /* * This is a kludge to workaround a Linux kernel bug: files in * /proc have a size of 0 according to fstat() but have readable @@ -709,17 +708,9 @@ public void ch_flush(void) */ if (ch_fsize == 0) { - struct statfs st; - if (fstatfs(ch_file, &st) == 0) - { - if (st.f_type == PROC_SUPER_MAGIC) - { - ch_fsize = NULL_POSITION; - ch_flags &= ~CH_CANSEEK; - } - } + ch_fsize = NULL_POSITION; + ch_flags &= ~CH_CANSEEK; } -#endif if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) {