From nobody Sat Apr 27 07:07:52 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 4VRLJm67nbz5J103; Sat, 27 Apr 2024 07:07:52 +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 4VRLJm5dhkz44bK; Sat, 27 Apr 2024 07:07:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714201672; 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=bqzyDkd8hDOlf3hUGytRx1PpXJnbZZH4D3KMhufHPYQ=; b=bvVNKsaspaMmA4oQqtzXSGh613f6SqqazCZ8+yOiuo++C/C/vitgW4kvuB3KroeKYkrvHX gkpE7Q+LnW1ngRwwaIvsxYtCa08YCojwvLxKpl6sKOUMVP10B3OrwktA08NoU71roGPRpZ +bqKoN7B9qtqlTT4XZRS4cxaOop/ZOGDXB6u7gHmySoUuXl/PIpywrmOOI4U/RWJDHMnt+ ngE8o5ercwVwwqeXWx6MNweGbh9Obb5XmxqgOf9J0HyXbnj/9yic6uEPRfU5oGoVGDPJKP UBKcEqbArHcqzhpikmSxC4Q4CyOJVbNIvFvKzL4kIURaucs8Qt0mQZLSY1QSMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714201672; a=rsa-sha256; cv=none; b=jdWErrhbv74mjgsz8Ecw5FMZ545KUgrg8MhC0wGjI1GGV3nz3noS+GgKoanl5szsbyJCLZ RQfFdbYtJOk5k5yAdipNkArgp8oPfNjQhOOfCJ3WJxGWtPDvoAs5IG5UGIUqarMd70oiej 53v4g3jMI4tc9VVZcLel16ZiKPagZtey8ChNHZVwAGSWOW4yh3CEYp90qum7rSYdvt2L7y QOXiYYITcdi99MsqulM8bjMXht/rjukHgLsYhAezLpNrVewEX9PfoOpZ/1xtnAzTYU5ZTJ CVjcaIbrUZjowGhEZ6ifKFnKU003EhfEvokPLYQcJTI1aYEzeLnzt/5BE9UvtA== 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=1714201672; 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=bqzyDkd8hDOlf3hUGytRx1PpXJnbZZH4D3KMhufHPYQ=; b=fyUjmRDiT0GyABMbuV1KWn0aw0W2Ag9lTwtTYNtffmKdvhtc6xEuLz/a5PM4oP76v9Imht 18O3E9ab4w8Ap9IRm4+HGQh5J8hIfEq7m12Zvg/J8hrauvrNjy5Nen4piKFUAo0Gpi31Vt nAOMFapj2sk9SSkW1rdp+R2tTJEcrZbcpmQ9DE9tCaWScfG4Iw6wGyuuPpegAg8NckA4nx AqQD41luQSnN4l56EUL7UMrwlHArDVnRF405SauGYJ+NYkirWWrgUfU1i9h1WpyVBRjfP+ L06pTH7JjzEFHS+WDM5Ajm7G/IRWqChsq8ZlwCROFE+YnrfbWSl0zCaLOS7ssg== 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 4VRLJm59tzzGHt; Sat, 27 Apr 2024 07:07:52 +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 43R77qwa036768; Sat, 27 Apr 2024 07:07:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43R77qqE036765; Sat, 27 Apr 2024 07:07:52 GMT (envelope-from git) Date: Sat, 27 Apr 2024 07:07:52 GMT Message-Id: <202404270707.43R77qqE036765@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: 5132cb42607b - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 5132cb42607bf7e1cc640e7c4ff4a1e9cfa3916d Auto-Submitted: auto-generated The branch stable/14 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=5132cb42607bf7e1cc640e7c4ff4a1e9cfa3916d commit 5132cb42607bf7e1cc640e7c4ff4a1e9cfa3916d Author: Ricardo Branco AuthorDate: 2024-04-24 05:29:46 +0000 Commit: Xin LI CommitDate: 2024-04-27 07:07:32 +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) {