GNU bug report logs - #75569
30.0.93; Large /proc/* file are read incompletely

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Daniel Mendler <mail@HIDDEN>; dated Wed, 15 Jan 2025 00:22:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 12:22:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 07:22:23 2025
Received: from localhost ([127.0.0.1]:45162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZUJr-0000bs-2k
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 07:22:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40824)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZUJo-0000bf-31
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 07:22:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZUJg-0004Wi-NM; Sun, 19 Jan 2025 07:22:12 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=G4ZPvZ+QWP0S6oGtorG+gQj4nX8WRWlMlmQ7+dXDJuM=; b=mCl9a1L2S7No
 yENxQCGtoTjzn6FMWec2aCOOJj4OaB70INZUKDuHOEYr7eOCRdnplGVonOwJVq9cdjjO5NYKGM4FD
 xsejQxLWeLRz4QSCnJWtSPyfZj/pFgn99Onn1EtsA+mXVA6b2vpFhA9VNOYmcPrExObBB6WglmsoY
 YW/iWW9GMKgts31lo2ybjILpv1cS9BzPpOfGYskE9axVu4Be79RC6kzRCoQMujNstZQswsHEni7eF
 D7cpV7g0YWOBHbUBqhHuB2WUZVnC1k0qPuIP1EYRSSDmKvYYeRccCFIQVVJri6JuETJgeVM9T0i/r
 l5v0aEcy8++j6dsdphLI0g==;
Date: Sun, 19 Jan 2025 14:22:08 +0200
Message-Id: <86y0z76ljj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: juri@HIDDEN, mail@HIDDEN
In-Reply-To: <861pwz82cx.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 19
 Jan 2025 13:33:34 +0200)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN> <87tt9w58qx.fsf@HIDDEN>
 <865xmb8494.fsf@HIDDEN> <861pwz82cx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: eggert@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: mail@HIDDEN, eggert@HIDDEN, 75569 <at> debbugs.gnu.org
> Date: Sun, 19 Jan 2025 13:33:34 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> Actually... are you sure these changes fixed the problem?  I've
> installed one of them, and /proc/kallsyms is not read in its entirety.
> Which file did you try this with, and what is its real size?

I've now installed a followup fix, please test.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 11:35:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 06:35:05 2025
Received: from localhost ([127.0.0.1]:45101 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZTa5-0006Vt-AF
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 06:35:05 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60588)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZTa2-0006TA-M2
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 06:35:03 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZTZx-000708-0G; Sun, 19 Jan 2025 06:34:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=J9ylYlYQzp+gIf3KpPlWogZ3naTGgxGlsOF3FzjIpDg=; b=lWKkghRs1SEO
 L0VO6hYbFkpgRZx6pOD/zNJgXrEW7UvZEeYe6c53bxp+eq+YaYXwNFAKJhPvAmnxZyUoRDH1yxZsE
 XhAg6yxE1+GNRA2TgdEDDzIexCh6cSr/8U2I4FLyEawA+sMj+BQu+Ot2lVFG2FKBjj4BqyX6av0gn
 fNDoNenGgkvMD+zgRjTiFIy77jhQg6jodXylwJXAnjEol6PvNMYJ2Jq/FAK/xsDlX4DquK/ZP6exG
 Vzx9Q4GhzHnPa5DqJT6THeAf/158vEHwmHOClyMgQ2mXjf+K51TnALc+xzSpngkLFMMysKdz/rRWg
 VsOx0hiJef5AWzKVYQO+wA==;
Date: Sun, 19 Jan 2025 13:34:54 +0200
Message-Id: <86zfjn6nq9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
In-Reply-To: <87cygjax4d.fsf@HIDDEN> (message from Daniel Mendler
 on Sun, 19 Jan 2025 11:58:26 +0100)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN>
 <478d6227-355a-4eb8-8cae-ecf71886d3ee@HIDDEN>
 <864j1v8466.fsf@HIDDEN> <87cygjax4d.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: eggert@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Daniel Mendler <mail@HIDDEN>
> Cc: Paul Eggert <eggert@HIDDEN>,  juri@HIDDEN,  75569 <at> debbugs.gnu.org
> Date: Sun, 19 Jan 2025 11:58:26 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Date: Sat, 18 Jan 2025 09:35:34 -0800
> >> Cc: 75569 <at> debbugs.gnu.org
> >> From: Paul Eggert <eggert@HIDDEN>
> >> 
> >> On 2025-01-18 02:44, Eli Zaretskii wrote:
> >> >> In other words, when reading a file Emacs should treat st_size as merely
> >> >> a heuristic, not as authoritative.
> >> > But does it do that now?  Regular files whose size changes as we read
> >> > them are pretty rare, so maybe we almost never bump into them.
> >> 
> >> No, it doesn't do it now, and that's the main bug here. Fix that, and 
> >> this other stuff isn't needed (and likely gets simplified away).
> >
> > Patches welcome, then.
> >
> > For now, I've installed a fix that Juri tested, to fix the regression.
> 
> Thank you! Are you going to install the fix on the emacs-30 branch if
> this is a regression, or has it been broken in 29 too?

I'm not going to install this on emacs-30 for now.  First, its' risky,
and it's too late for such changes on the release branch.  And second,
it doesn't seem to be a solution for this case, see my other message.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 11:33:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 06:33:48 2025
Received: from localhost ([127.0.0.1]:45088 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZTYp-0006R8-VU
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 06:33:48 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:52048)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZTYm-0006Qt-KG
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 06:33:45 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZTYe-0006m1-Un; Sun, 19 Jan 2025 06:33:36 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=PRnaFLXGOEAwq+0j5ba/JNbiFQmFM56vophGBEfjHGk=; b=sG9L5I2G+i2+
 boKxtXEhWQOHpDfH78jIkSx34r9CnjKAzo8xqbnekZLOgx6aOU1wwo8Qqu63oe8qEOUBtKre8vcmy
 WcZE2FJJH3HfplQJ5XDEoho89u/GR3N23Xrycupbmrvcc+S6ANryF+Cl+TY/6GeBe8WaVdo0hkeX8
 Vp21iAJBrIBKRHti3ZkiwkMLIvzT5Lbr6Q2d+wCiSSn9EVs/82IodBPdEEhDcGPD0df3PLIP5S8sj
 amcTsJaL1Wd4ARtm4kggtNBfWfqMJydV6x9ZPNw2LL/GLHEBQMCLP3Yb2wp1IG+XUK4Km4A1oQd19
 hUkAfUCF/WitqAKD0rnt9w==;
Date: Sun, 19 Jan 2025 13:33:34 +0200
Message-Id: <861pwz82cx.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: juri@HIDDEN
In-Reply-To: <865xmb8494.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 19
 Jan 2025 12:52:39 +0200)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN> <87tt9w58qx.fsf@HIDDEN>
 <865xmb8494.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, eggert@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: mail@HIDDEN, eggert@HIDDEN, 75569 <at> debbugs.gnu.org
> Date: Sun, 19 Jan 2025 12:52:39 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Juri Linkov <juri@HIDDEN>
> > Cc: mail@HIDDEN,  Paul Eggert <eggert@HIDDEN>,
> >   75569 <at> debbugs.gnu.org
> > Date: Sat, 18 Jan 2025 19:31:34 +0200
> > 
> > >> > Then how about
> > >> > 
> > >> >    if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))
> > >> 
> > >> That should work too but I expect we're overthinking it; see bellow.
> > >
> > > Juri and Daniel, could you please try the change above?
> > 
> > There are many large files under /proc that you can try
> > such as /proc/kallsyms.
> 
> Ah, thanks.
> 
> > I tried the change above, and it works.
> > 
> > >> > That would exclude non-regular files that are seekable, which would be
> > >> > a regression, I think.
> > >> 
> > >> I expect it's a bugfix not a regression. For such files, end_offset
> > >> is TYPE_MAXIUMUM (off_t), which Emacs will try to create an enormous buffer.
> > >
> > > Juri and Daniel, could you also try
> > >
> > >   if ((regular && st.st_size > 0) || !NILP (end))  
> > >
> > > instead?
> > 
> > This works as well.
> 
> Thanks for testing.

Actually... are you sure these changes fixed the problem?  I've
installed one of them, and /proc/kallsyms is not read in its entirety.
Which file did you try this with, and what is its real size?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 10:58:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 05:58:37 2025
Received: from localhost ([127.0.0.1]:45051 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZT0m-0004gU-JN
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:58:36 -0500
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:56825 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1tZT0j-0004gD-PE
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:58:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date:
 References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:
 List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lNYZ9MXD/W6jjSzx568MijB5zlwWp9zrpxPqxLA7ZrY=; b=xKPJ7rLG/bRCV3iT2DsWzIITL2
 6ev0NbleA57xoMlMkL1TRUg0LdG75fvUa5bWrJdVrhVP7OUqAOK2yW+4lm1AjJz8PZIE8HXgryY5+
 +f69SbxG/k4IKLAsNXuxzeHcC0NlryxEfrKDE0hIcR0s+5xKC7rXijzOOetvvgZgPGP0=;
From: Daniel Mendler <mail@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
In-Reply-To: <864j1v8466.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 19 Jan
 2025 12:54:25 +0200")
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN>
 <478d6227-355a-4eb8-8cae-ecf71886d3ee@HIDDEN>
 <864j1v8466.fsf@HIDDEN>
Date: Sun, 19 Jan 2025 11:58:26 +0100
Message-ID: <87cygjax4d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75569
Cc: Paul Eggert <eggert@HIDDEN>, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Sat, 18 Jan 2025 09:35:34 -0800
>> Cc: 75569 <at> debbugs.gnu.org
>> From: Paul Eggert <eggert@HIDDEN>
>> 
>> On 2025-01-18 02:44, Eli Zaretskii wrote:
>> >> In other words, when reading a file Emacs should treat st_size as merely
>> >> a heuristic, not as authoritative.
>> > But does it do that now?  Regular files whose size changes as we read
>> > them are pretty rare, so maybe we almost never bump into them.
>> 
>> No, it doesn't do it now, and that's the main bug here. Fix that, and 
>> this other stuff isn't needed (and likely gets simplified away).
>
> Patches welcome, then.
>
> For now, I've installed a fix that Juri tested, to fix the regression.

Thank you! Are you going to install the fix on the emacs-30 branch if
this is a regression, or has it been broken in 29 too?

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 10:54:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 05:54:37 2025
Received: from localhost ([127.0.0.1]:45044 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZSwv-0004TH-Kw
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:54:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:59840)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZSwt-0004Su-2y
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:54:35 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZSwm-00009A-5J; Sun, 19 Jan 2025 05:54:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=ZBBl2u1rb4bdf91yrMVfEPikIOavBs2kcq5UQcNqkO0=; b=Uli0ZpvUdtc3
 r3C4g5/hvbrnLvmUfb/ZLcCkOr3MeEOLtV/uQUICVsRt3yEuFhNRdkGWGKWbT0UmLfmbo3jKUBua3
 pC7sW/W8kAsKpZTY0Gf6dnvWzrbTUfF2loY9LYrCDPFJAqaDlybXtnA6vRFgtEEgNYACDPvJWaLVe
 nIiWcFNn2wB7Zu/yj95j5XCBsut8DXO9ApHVLLIidjBkMJEhhTMa3z3dAW+lRR+oTiua2laP2p7x1
 GfYSAZWMEHm36RqEohgjfnd0KyTPqmusxL7f/1kt0fvWRhbWmAwI4u9CXdD6Il0vywi0/p81gt5XJ
 eMap2sgd86LgrJlDRSI93g==;
Date: Sun, 19 Jan 2025 12:54:25 +0200
Message-Id: <864j1v8466.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <478d6227-355a-4eb8-8cae-ecf71886d3ee@HIDDEN> (message from
 Paul Eggert on Sat, 18 Jan 2025 09:35:34 -0800)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN> <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN> <864j1wbdv5.fsf@HIDDEN>
 <478d6227-355a-4eb8-8cae-ecf71886d3ee@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 18 Jan 2025 09:35:34 -0800
> Cc: 75569 <at> debbugs.gnu.org
> From: Paul Eggert <eggert@HIDDEN>
> 
> On 2025-01-18 02:44, Eli Zaretskii wrote:
> >> In other words, when reading a file Emacs should treat st_size as merely
> >> a heuristic, not as authoritative.
> > But does it do that now?  Regular files whose size changes as we read
> > them are pretty rare, so maybe we almost never bump into them.
> 
> No, it doesn't do it now, and that's the main bug here. Fix that, and 
> this other stuff isn't needed (and likely gets simplified away).

Patches welcome, then.

For now, I've installed a fix that Juri tested, to fix the regression.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 19 Jan 2025 10:52:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 05:52:55 2025
Received: from localhost ([127.0.0.1]:45034 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZSvG-0004IG-Ku
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:52:54 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56414)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZSvD-0004Hz-Fa
 for 75569 <at> debbugs.gnu.org; Sun, 19 Jan 2025 05:52:53 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZSv6-0008RD-D6; Sun, 19 Jan 2025 05:52:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=oyYTV/h+s/E3VZxSd8BTzA85nC8s3nJlYqs9p9zc1uU=; b=Z7UE93xMovN4
 GJfKZ/STokrnEbNyBg1ZKsuS6HEBBsIjjoaEw9M+QaNkVzSag9wX2bC0T3TH+Z63im/ffObSmOVWW
 8a/6aLU30yui6296Rxn46jpF1gFcO8At11etJvizPvZUQw0OOl2iq9bRgIqUfRzNUCfiSqoBgoRsk
 GuFTpY5CvBRtrqx0pnqM0SM75nQ7ZHB2U1mQDeuo6hQg1gAzC5JD4/A+9+e1WTtmbuyamCDnfHbtU
 Vbkx2+AbzPjxoikBai5DT3DcSowTJTEbpbIxDGp4BzUjxt8a8SlqBEJUNG9joT6pO4GtpEDVL8sv0
 NszVP+aNkYs2cheWcroLlQ==;
Date: Sun, 19 Jan 2025 12:52:39 +0200
Message-Id: <865xmb8494.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87tt9w58qx.fsf@HIDDEN> (message from Juri Linkov on
 Sat, 18 Jan 2025 19:31:34 +0200)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN> <87tt9w58qx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, eggert@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: mail@HIDDEN,  Paul Eggert <eggert@HIDDEN>,
>   75569 <at> debbugs.gnu.org
> Date: Sat, 18 Jan 2025 19:31:34 +0200
> 
> >> > Then how about
> >> > 
> >> >    if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))
> >> 
> >> That should work too but I expect we're overthinking it; see bellow.
> >
> > Juri and Daniel, could you please try the change above?
> 
> There are many large files under /proc that you can try
> such as /proc/kallsyms.

Ah, thanks.

> I tried the change above, and it works.
> 
> >> > That would exclude non-regular files that are seekable, which would be
> >> > a regression, I think.
> >> 
> >> I expect it's a bugfix not a regression. For such files, end_offset
> >> is TYPE_MAXIUMUM (off_t), which Emacs will try to create an enormous buffer.
> >
> > Juri and Daniel, could you also try
> >
> >   if ((regular && st.st_size > 0) || !NILP (end))  
> >
> > instead?
> 
> This works as well.

Thanks for testing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 18 Jan 2025 17:35:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 18 12:35:43 2025
Received: from localhost ([127.0.0.1]:43630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZCjX-0003Ni-HM
	for submit <at> debbugs.gnu.org; Sat, 18 Jan 2025 12:35:43 -0500
Received: from mail.cs.ucla.edu ([131.179.128.66]:50538)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1tZCjV-0003NV-E6
 for 75569 <at> debbugs.gnu.org; Sat, 18 Jan 2025 12:35:41 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 5A1FB3C123877;
 Sat, 18 Jan 2025 09:35:35 -0800 (PST)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id f_LULJ47W0Xf; Sat, 18 Jan 2025 09:35:34 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id CC79A3C123876;
 Sat, 18 Jan 2025 09:35:34 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu CC79A3C123876
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1737221734;
 bh=5fXQ4vAkWr1O+lPvzo9yVE3LzGrWr2gXXrkMzmREPA4=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=YogEF6Fq6vjDDM3bAg5KgixK8yk0SCnubqklf2+503xnKN/PWtHyR7ALRAWLZLWpj
 qSO2vMMXujgrmVYjcvuF1Go1pX6SOqsyGCDkzMmFrBq4dxePSsmki9k76jeKQgVV5o
 aePygjVrXOfRk5r4x/wd4T7odI5uHmJcFxcBbdJf+1gotOkqeaheC/kiXU6+M9IKr1
 lPj+ZF8QsGGll5lfAM7ST7wKgK2IB3UEDnwcBQqSX57fl1EX1KSZLIwHlek3+wbdY5
 smeUA09zfv+i8JiTvf24PkyHD7TBqqub9GE0YRnYgV6ruYZDGeameXhYEV8YoLXAUr
 sRg1Pa34lTUbQ==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id dNEYkMHbhz76; Sat, 18 Jan 2025 09:35:34 -0800 (PST)
Received: from [192.168.254.12] (unknown [47.154.28.214])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id AE5173C123872;
 Sat, 18 Jan 2025 09:35:34 -0800 (PST)
Message-ID: <478d6227-355a-4eb8-8cae-ecf71886d3ee@HIDDEN>
Date: Sat, 18 Jan 2025 09:35:34 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
To: Eli Zaretskii <eliz@HIDDEN>, juri@HIDDEN, mail@HIDDEN
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN> <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN> <864j1wbdv5.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <864j1wbdv5.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75569
Cc: 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2025-01-18 02:44, Eli Zaretskii wrote:
>> In other words, when reading a file Emacs should treat st_size as merely
>> a heuristic, not as authoritative.
> But does it do that now?  Regular files whose size changes as we read
> them are pretty rare, so maybe we almost never bump into them.

No, it doesn't do it now, and that's the main bug here. Fix that, and 
this other stuff isn't needed (and likely gets simplified away).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 18 Jan 2025 17:32:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 18 12:32:43 2025
Received: from localhost ([127.0.0.1]:43617 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZCgd-0003Cf-Bg
	for submit <at> debbugs.gnu.org; Sat, 18 Jan 2025 12:32:43 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:55163)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tZCgb-0003CR-7I
 for 75569 <at> debbugs.gnu.org; Sat, 18 Jan 2025 12:32:41 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 7D15720004;
 Sat, 18 Jan 2025 17:32:33 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
In-Reply-To: <864j1wbdv5.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 18 Jan
 2025 12:44:30 +0200")
Organization: LINKOV.NET
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
 <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
 <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
 <864j1wbdv5.fsf@HIDDEN>
Date: Sat, 18 Jan 2025 19:31:34 +0200
Message-ID: <87tt9w58qx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, Paul Eggert <eggert@HIDDEN>,
 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

>> > Then how about
>> > 
>> >    if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))
>> 
>> That should work too but I expect we're overthinking it; see bellow.
>
> Juri and Daniel, could you please try the change above?

There are many large files under /proc that you can try
such as /proc/kallsyms.

I tried the change above, and it works.

>> > That would exclude non-regular files that are seekable, which would be
>> > a regression, I think.
>> 
>> I expect it's a bugfix not a regression. For such files, end_offset
>> is TYPE_MAXIUMUM (off_t), which Emacs will try to create an enormous buffer.
>
> Juri and Daniel, could you also try
>
>   if ((regular && st.st_size > 0) || !NILP (end))  
>
> instead?

This works as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 18 Jan 2025 10:44:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 18 05:44:46 2025
Received: from localhost ([127.0.0.1]:40391 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZ6Jq-0002ow-8v
	for submit <at> debbugs.gnu.org; Sat, 18 Jan 2025 05:44:46 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58606)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZ6Jn-0002oh-H0
 for 75569 <at> debbugs.gnu.org; Sat, 18 Jan 2025 05:44:44 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZ6Jf-0004Po-FY; Sat, 18 Jan 2025 05:44:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Xa2OGfbhXJosZeFWP0s0ofOWejD05Jx6F+hGg56Xpvs=; b=bntu3cdeTO/7
 Dzna8qCngeQFVbC1IAiuF3xGRzmVKmNi+rzzP2TnYkqKIsP5Me6cIcAtLbw/ITDWFxQGj/JYB3zDE
 6EG9/ug4B6UaMJt3A5cIlmC6ICBbXb09b3ZxKlPYxyBAVVFIpyGh+T29x3nTfcIOS0u9f+bAvyZWh
 eUOBgA1XwlqNGSgsMe5K2zVg3ABFyAzJhIUZeAQXoBt1JK5ncqr4HaL793Sq0GcE+PSWYsebw8s0g
 UibGziwECZRrPa139k0B2fP8NJ+C9fds2NMT/3xZOEUC7dxIrcj4sdupRRcQV4+1lY4gUyVQcXo/U
 UyXfHteqrta8GX2zwAO+Yw==;
Date: Sat, 18 Jan 2025 12:44:30 +0200
Message-Id: <864j1wbdv5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: juri@HIDDEN, mail@HIDDEN, Paul Eggert <eggert@HIDDEN>
In-Reply-To: <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN> (message from
 Paul Eggert on Thu, 16 Jan 2025 12:51:11 -0800)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN> <86frlji1d9.fsf@HIDDEN>
 <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 16 Jan 2025 12:51:11 -0800
> Cc: juri@HIDDEN, mail@HIDDEN, 75569 <at> debbugs.gnu.org
> From: Paul Eggert <eggert@HIDDEN>
> 
> On 2025-01-16 00:55, Eli Zaretskii wrote:
> 
> > Then how about
> > 
> >    if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))
> 
> That should work too but I expect we're overthinking it; see bellow.

Juri and Daniel, could you please try the change above?

> > That would exclude non-regular files that are seekable, which would be
> > a regression, I think.
> 
> I expect it's a bugfix not a regression. For such files, end_offset
> is TYPE_MAXIUMUM (off_t), which Emacs will try to create an enormous buffer.

Juri and Daniel, could you also try

  if ((regular && st.st_size > 0) || !NILP (end))  

instead?

> > If the size is non-zero and
> > inaccurate, do we currently support that, e.g., if the file grows
> > while we read it?
> 
> That's the crux of the bug. If we don't support that, the code is 
> unreliable pretty much everywhere, not just in /proc. If we fix that, 
> the /proc problem goes away.
> 
> In other words, when reading a file Emacs should treat st_size as merely 
> a heuristic, not as authoritative.

But does it do that now?  Regular files whose size changes as we read
them are pretty rare, so maybe we almost never bump into them.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 16 Jan 2025 20:51:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 15:51:21 2025
Received: from localhost ([127.0.0.1]:34851 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYWpk-0003oQ-N8
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 15:51:21 -0500
Received: from mail.cs.ucla.edu ([131.179.128.66]:42562)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1tYWph-0003o8-Ka
 for 75569 <at> debbugs.gnu.org; Thu, 16 Jan 2025 15:51:18 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id CFD113C082C91;
 Thu, 16 Jan 2025 12:51:11 -0800 (PST)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id 1FWKOMrl1IQc; Thu, 16 Jan 2025 12:51:11 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 7FA603C082EB9;
 Thu, 16 Jan 2025 12:51:11 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 7FA603C082EB9
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1737060671;
 bh=UGptozid3h5R9NJQa9twAEX96OoHS8UgalxhDkNAgo4=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=TPddax7eHQD3fxB6Pi1QdVkk2KFz2Dbbbtux0FwcBv0H2Hnj02FkUcDUbjYbeSRHH
 B9eseVeKamfT/u+IETdFTf+8W800EszHTQQVePeN14P6792/rAO03IMhOJdyNoYgpf
 izk+uxH2dqL3j2JIY2iniTSGFq5jX0oTiP9LxjNF0uBRuJ7LpgsWNSdiy/KUsYuxdV
 PxUbaON2syY2XCSaFnNDhVnZsxzOO8Mqj3cPW+oZciKJRnGSurpK87FBwzXNhGOiq+
 m28C+aGbPr5lv3+majRbm2my8Kg8EI3zmqUNgKrAdpowXbeSJjuw2zfiiRrrjA+JJ1
 v6J2G2Yi37mxQ==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id 3W6fYDTivtlx; Thu, 16 Jan 2025 12:51:11 -0800 (PST)
Received: from [192.168.254.12] (unknown [47.154.28.214])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 61C243C082C91;
 Thu, 16 Jan 2025 12:51:11 -0800 (PST)
Message-ID: <df5c1a5c-2be0-4d4e-95c1-1f78f0522381@HIDDEN>
Date: Thu, 16 Jan 2025 12:51:11 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
To: Eli Zaretskii <eliz@HIDDEN>
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN> <86frlji1d9.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <86frlji1d9.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2025-01-16 00:55, Eli Zaretskii wrote:

> Then how about
> 
>    if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))

That should work too but I expect we're overthinking it; see bellow.


> That would exclude non-regular files that are seekable, which would be
> a regression, I think.

I expect it's a bugfix not a regression. For such files, end_offset
is TYPE_MAXIUMUM (off_t), which Emacs will try to create an enormous buffer.


> If the size is non-zero and
> inaccurate, do we currently support that, e.g., if the file grows
> while we read it?

That's the crux of the bug. If we don't support that, the code is 
unreliable pretty much everywhere, not just in /proc. If we fix that, 
the /proc problem goes away.

In other words, when reading a file Emacs should treat st_size as merely 
a heuristic, not as authoritative.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 16 Jan 2025 08:56:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 03:56:07 2025
Received: from localhost ([127.0.0.1]:59974 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYLfb-0005vp-0q
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 03:56:07 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:51950)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tYLfY-0005v9-3S
 for 75569 <at> debbugs.gnu.org; Thu, 16 Jan 2025 03:56:05 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tYLfQ-0000Au-CH; Thu, 16 Jan 2025 03:55:56 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=cHLYRO2oGmoVqMZ1WvAlhl4p2UWsy8hNRCV7ZgY6SIE=; b=W5i9aTCmTqRu
 F2A/iZjUdrsBu2w7R38SFp8AKBEislUuM1xVARyK3R0DEjJxqlQ0DsennNUiNzmfV1HnSRgeP44pF
 SQ2gpj1Qd2w+8r2tbcSonS/LczBkuI4yOljI52yL/rfep1UQ1/npL+e1HZx2AXwBj+UgrMUbcld6L
 L92SGQ21p7OxSUPAiv0Njf6BNFQFCQQcdwxzzx9ysaeNDsg5kSygyxVSCEMCLM4g5isRRL7jK4Gn8
 WwLM8/XUmA57hsfw8jFo5Q9teIMVlzhU4Mf7wh8yau46Tt2vT9LYacMwE4CSTB1SOeidCcDTmSfdL
 bKlVzukp3itrA3w4sD3iQg==;
Date: Thu, 16 Jan 2025 10:55:46 +0200
Message-Id: <86frlji1d9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN> (message from
 Paul Eggert on Wed, 15 Jan 2025 22:58:31 -0800)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
 <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 15 Jan 2025 22:58:31 -0800
> Cc: juri@HIDDEN, mail@HIDDEN, 75569 <at> debbugs.gnu.org
> From: Paul Eggert <eggert@HIDDEN>
> 
> On 2025-01-15 22:18, Eli Zaretskii wrote:
> 
> > So you are saying that the condition should be
> > 
> >     if ((regular && st.st_size > 0) || seekable || !NILP (end))
> 
> regular implies seekable, so that doesn't look right either.

Then how about

  if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))

> I was 
> thinking that rather than replace "seekable" with "(seekable && st.size 
>  > 0)" or with "(regular && st.st_size > 0) || seekable", one should 
> replace "seekable" with "(regular && st.st_size > 0)".

That would exclude non-regular files that are seekable, which would be
a regression, I think.

> There's another thing. On some platforms these /proc regular files have 
> nonzero size. On at least one of these platforms (Solaris) the size is 
> accurate (though it may change at any time); on others, I vaguely recall 
> that it's a small nonzero fixed size (I don't remember which systems do 
> that, unfortunately).

If the size is non-zero and accurate, it should already work, because
this is just how "normal" files behave.  If the size is non-zero and
inaccurate, do we currently support that, e.g., if the file grows
while we read it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 16 Jan 2025 06:58:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 01:58:43 2025
Received: from localhost ([127.0.0.1]:59767 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYJpy-0002dG-Kg
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:58:42 -0500
Received: from mail.cs.ucla.edu ([131.179.128.66]:40658)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1tYJpu-0002d2-TL
 for 75569 <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:58:40 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id A7E633C082EA4;
 Wed, 15 Jan 2025 22:58:32 -0800 (PST)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id E5aK_DyaKdUV; Wed, 15 Jan 2025 22:58:32 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 5570C3C082EA5;
 Wed, 15 Jan 2025 22:58:32 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5570C3C082EA5
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1737010712;
 bh=BEOio94OcvkXT9z2Kv5w6MLVnnG1GCWHZ2fzRNN1BQU=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=SiJjjNe7HKxzVeC5qpMbefFTuudqrrywlvIH63tT1f4XmGmDdXQtgUfijpZy5+4OB
 jNCbWN84eIdplIqT3uNF+eMXZoEU2axeiIX1LUOYeydOj1Jfdz9ggZeNLmR+UR50RD
 gc5inPTiHW55bH37I8XM8lFR47yQEPPBy5B2BvdAsGNW8gpV0Dh74ZlabNhaGSZCie
 vvvSHPx3d0N++Ve/RcXoJqES7UFRFxnzMbTA6bibigyyJSBD+3NaNm2CUooTM6wFN6
 rkb4p+ZoJ5XVafHDzlbttzf7mXPtaT5mxYnVhXcEpBg2vpmrHof91CZlnlzGhnEh/V
 2VjTRfZXW/MKQ==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id 5e7PrBTt-9Mu; Wed, 15 Jan 2025 22:58:32 -0800 (PST)
Received: from [192.168.254.12] (unknown [47.154.28.214])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 36CB43C082EA4;
 Wed, 15 Jan 2025 22:58:32 -0800 (PST)
Message-ID: <3260cfda-aaec-445e-9388-d4cb6c4d7e6e@HIDDEN>
Date: Wed, 15 Jan 2025 22:58:31 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
To: Eli Zaretskii <eliz@HIDDEN>
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> <86wmevi8n1.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <86wmevi8n1.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2025-01-15 22:18, Eli Zaretskii wrote:

> So you are saying that the condition should be
> 
>     if ((regular && st.st_size > 0) || seekable || !NILP (end))

regular implies seekable, so that doesn't look right either. I was 
thinking that rather than replace "seekable" with "(seekable && st.size 
 > 0)" or with "(regular && st.st_size > 0) || seekable", one should 
replace "seekable" with "(regular && st.st_size > 0)".


> AFAIU, the additional conditions are not needed for these two uses,
> because:
> 
>    . 'total' is already computed correctly at that point for the
>      regular zero-size files
>    . only non-regular files can be !seekable
> 
> Or am I missing something?

You've looked it more carefully than I. All I was thinking is that if 
'total' was guessed to be READ_BUF_SIZE earlier, it's still a guess here.

Anyway, I suppose it doesn't matter much, as 'total' is a guess 
regardless of how it's computed. Even a regular file with nonzero size 
can change size before we read it.

There's another thing. On some platforms these /proc regular files have 
nonzero size. On at least one of these platforms (Solaris) the size is 
accurate (though it may change at any time); on others, I vaguely recall 
that it's a small nonzero fixed size (I don't remember which systems do 
that, unfortunately).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 16 Jan 2025 06:19:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 16 01:19:06 2025
Received: from localhost ([127.0.0.1]:59710 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYJDd-0000ei-J5
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:19:06 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56702)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tYJDa-0000eB-07
 for 75569 <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:19:03 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tYJDQ-0006DA-PC; Thu, 16 Jan 2025 01:18:52 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=tUICmQY/cuXqCkP1JnIIyeee5h4ZJSS+fdv2D9WJAFw=; b=AbcPx1/6Ok6v
 2l+y1Bvzj+9WLLAFTTSUxv4ebIResuj90WuAvEgIqy4qqCEtx9n7V1/HDVW8yb8ailpkfBUi58iL4
 36yKQYff82qzLYC5W1HYUcIftQHlGV11T8P249UepC8i3lhdLtfs1AQSnc4WagUEbShAmq6wI8MN8
 +vNwBSCMlm0hRgirCZen99tRwStZquKvSW9R9ALfms9Zkt+hFVBY8UTqWDGy0TVHTmfIlvtgBVlnS
 GQn7WvD68GKuZkbWriLWor2woX5YtoeCQJ/N9XAdmyzOui2sYI2SHfTOz23WtFVZIuY/+EUd2o8/j
 bpNXVK9eMoBdeuzWGgoIDw==;
Date: Thu, 16 Jan 2025 08:18:42 +0200
Message-Id: <86wmevi8n1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN> (message from
 Paul Eggert on Wed, 15 Jan 2025 13:08:10 -0800)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
 <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 15 Jan 2025 13:08:10 -0800
> Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org
> From: Paul Eggert <eggert@HIDDEN>
> 
> On 2025-01-15 12:07, Eli Zaretskii wrote:
> > -  if (seekable || !NILP (end))
> > +  if ((seekable && st.size > 0) || !NILP (end))
> 
> Presumably you meant st.st_size.

(Blush) yes, sorry.

> However, POSIX does not specify the 
> value of st.st_size for every seekable file. Instead, when reading Emacs 
> should look at st.st_size only for regular files, shared memory objects, 
> and typed memory objects (the last two are rare enough that we don't 
> need to bother to optimize for them).

So you are saying that the condition should be

   if ((regular && st.st_size > 0) || seekable || !NILP (end))

is that right?

> Also, there are other uses of 'seekable' in the code that probably need 
> a similar treatment.

There are only two more:

	/* 'try' is reserved in some compilers (Microsoft C).  */
	ptrdiff_t trytry = min (gap_size, READ_BUF_SIZE);
	if (seekable || !NILP (end))
	  trytry = min (trytry, total - inserted);

	if (!seekable && NILP (end))
	  {

AFAIU, the additional conditions are not needed for these two uses,
because:

  . 'total' is already computed correctly at that point for the
    regular zero-size files
  . only non-regular files can be !seekable

Or am I missing something?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 15 Jan 2025 21:08:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 15 16:08:19 2025
Received: from localhost ([127.0.0.1]:58963 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYAcd-00087d-CP
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 16:08:19 -0500
Received: from mail.cs.ucla.edu ([131.179.128.66]:33204)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1tYAca-00087P-FL
 for 75569 <at> debbugs.gnu.org; Wed, 15 Jan 2025 16:08:17 -0500
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id B18053C03E9F1;
 Wed, 15 Jan 2025 13:08:10 -0800 (PST)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id 4Pr8_sT3DraE; Wed, 15 Jan 2025 13:08:10 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 73A1B3C082C9F;
 Wed, 15 Jan 2025 13:08:10 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 73A1B3C082C9F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1736975290;
 bh=s1L5WXBnvNMvZmCte6yYr3a+0lHiJpAKTd1JUCkHCi0=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=UZpf2HJO9mZZOQFti/jzujHNj8qBIaOFutOb8Asy29OWnkANxBKGxkbeayHJkpCTa
 fL4HjbfckZKMQIbXyt8GmNefv2DRnV6CC+2tD+vIcmL7wmvmwMzWDkSOzoeHIMB423
 75gymmUg3sCuM2eUuQE1n2hr8oQyUwpU5tyIorLbJ7pxeCuRcCP3CM8nYyinnyh5tX
 iWOyUpabxWIBDjo1Zr95HF2TDrR8eNiMH7Owc6bThPlx7brEfm9QpeLlxU6p4eNg4Z
 QBk0XAyespx0yvgXueU6/EaN3N7mS/2Tj6hcBACZ6AfJ0S9n7d1h8VSs6R2qtM0uhK
 iKpf25Kn86hQg==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id tylUoElOQGxb; Wed, 15 Jan 2025 13:08:10 -0800 (PST)
Received: from [192.168.254.12] (unknown [47.154.28.214])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5635A3C03E9F1;
 Wed, 15 Jan 2025 13:08:10 -0800 (PST)
Message-ID: <73057533-29a4-47db-9cec-9394f5fa8122@HIDDEN>
Date: Wed, 15 Jan 2025 13:08:10 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
To: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN> <86cygnkfix.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <86cygnkfix.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2025-01-15 12:07, Eli Zaretskii wrote:
> -  if (seekable || !NILP (end))
> +  if ((seekable && st.size > 0) || !NILP (end))

Presumably you meant st.st_size. However, POSIX does not specify the 
value of st.st_size for every seekable file. Instead, when reading Emacs 
should look at st.st_size only for regular files, shared memory objects, 
and typed memory objects (the last two are rare enough that we don't 
need to bother to optimize for them).

Also, there are other uses of 'seekable' in the code that probably need 
a similar treatment.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 15 Jan 2025 20:07:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 15 15:07:23 2025
Received: from localhost ([127.0.0.1]:58805 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tY9fe-0002Cf-GZ
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 15:07:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:39946)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tY9fY-0002CO-QZ
 for 75569 <at> debbugs.gnu.org; Wed, 15 Jan 2025 15:07:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tY9fR-00066d-57; Wed, 15 Jan 2025 15:07:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Dv1zXMpTHriB900h743SLY4FJvfiuJvbURWUiYmBs2s=; b=rvyjXVN9RQHF
 /MDydynZl6f4XqVC7ZYNLN51e+IUm/jewtxodsSJ5MnPVX0XHP52KzlTbQ31RCocurY64TBf9aLbz
 pnaHl2aGeXqEQrVrBxrfNQV3TTGDi6kvixGsUuhvuCwCsRP8QcsLkgdAuxMg3BJXck0ojzuFFQRnN
 d7CNb3ewkT0eR3acdcDrxVEPoEMiKzOKJ4I+4YuLumJOPPJXKKM7RRhuAcs4xH9vYB6l2kB47zASr
 jyPDmckSBpzxVSKbNAizar0Z8sujTObyrUQzOQWNd2v6mfaqDsv85LpnDHkiBiaA6rxD/HxoDZtcS
 NWY+tknJdNAEOaFne4U/tw==;
Date: Wed, 15 Jan 2025 22:07:02 +0200
Message-Id: <86cygnkfix.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87zfjs2efg.fsf@HIDDEN> (message from Juri Linkov on
 Wed, 15 Jan 2025 19:08:03 +0200)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
 <87zfjs2efg.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, eggert@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Paul Eggert <eggert@HIDDEN>,  mail@HIDDEN,
>   75569 <at> debbugs.gnu.org
> Date: Wed, 15 Jan 2025 19:08:03 +0200
> 
> > But maybe commits 8650b3308dd and/or 3fb2c174d3a7 broke that later?
> 
> I confirm that reverting 8650b3308dd fixes it again after removing 'seekable'.

Thanks.  Can you try the patch below?

> > The /proc/cpuinfo file on the system to which I have access is smaller
> > than 16KB, so could someone who can access a larger cpuinfo file
> > please see if those commits broke the fix, or maybe bisect?
> 
> To be able to test it you need at least 16 cpu cores.  If this is
> not feasible, a simpler way would be just to try on another file
> such as /proc/crypto.

/proc/crypto here is also less than 16KB, so I still cannot test.

diff --git a/src/fileio.c b/src/fileio.c
index db7c491..a296970 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4747,7 +4747,7 @@ DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
       goto handled;
     }
 
-  if (seekable || !NILP (end))
+  if ((seekable && st.size > 0) || !NILP (end))
     total = end_offset - beg_offset;
   else
     /* For a special file, all we can do is guess.  */




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 15 Jan 2025 17:15:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 15 12:15:57 2025
Received: from localhost ([127.0.0.1]:58579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tY6zk-00032k-Le
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 12:15:57 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:49981)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tY6zi-00032R-SY
 for 75569 <at> debbugs.gnu.org; Wed, 15 Jan 2025 12:15:55 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id AA96A240003;
 Wed, 15 Jan 2025 17:15:45 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
In-Reply-To: <86tta0jesz.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 15 Jan
 2025 17:07:56 +0200")
Organization: LINKOV.NET
References: <87ldvd6i6n.fsf@HIDDEN>
 <87bjw8h7ce.fsf@HIDDEN> <86tta0jesz.fsf@HIDDEN>
Date: Wed, 15 Jan 2025 19:08:03 +0200
Message-ID: <87zfjs2efg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, Paul Eggert <eggert@HIDDEN>,
 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> > When opening a large file in /proc/* like /proc/cpuinfo in Emacs via
>> > find-file, the buffer content is incomplete, when comparing the output
>> > to the output produced by /bin/cat. The Eshell command eshell/cat has
>> > the same problem.The proc file system doesn't report file sizes since
>> > the files are dynamically generated. ls -l /proc/cpuinfo reports size 0.
>> > Emacs doesn't handle this well, limiting its reads to 16KiB.
>> >
>> > In Eshell:
>> >
>> > cat /proc/cpuinfo > #<buffer bug>  ==> truncated buffer (exactly 16KiB)
>> > *cat /proc/cpuinfo > #<buffer bug> ==> complete buffer (larger than 16KiB)
>> 
>> Strange, bug#9800 was closed as fixed, but I confirm the buffer is still
>> truncated.
>
> It was closed because it was fixed back then.

I'm sure I tested it when it was closed, so it was fixed back then indeed.

> But maybe commits 8650b3308dd and/or 3fb2c174d3a7 broke that later?

I confirm that reverting 8650b3308dd fixes it again after removing 'seekable'.

> The /proc/cpuinfo file on the system to which I have access is smaller
> than 16KB, so could someone who can access a larger cpuinfo file
> please see if those commits broke the fix, or maybe bisect?

To be able to test it you need at least 16 cpu cores.  If this is
not feasible, a simpler way would be just to try on another file
such as /proc/crypto.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 15 Jan 2025 15:08:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 15 10:08:10 2025
Received: from localhost ([127.0.0.1]:58306 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tY506-0005YT-1C
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 10:08:10 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46376)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tY503-0005YF-Nx
 for 75569 <at> debbugs.gnu.org; Wed, 15 Jan 2025 10:08:08 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tY4zw-0004Lt-L6; Wed, 15 Jan 2025 10:08:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=QXHIxTfyLfzBaFSernhncAJjZ0ZUVOZvggzY2GBUplI=; b=rFoe5wTwEAuN
 XaBc3A4z2DMirnkFsH7k/X3sSiu6k0LDhGHnBMTRL1rv3WYLetQMLT2C2T1On7mMRJbN01qsPtUWQ
 HeEnRoAx74n+ZWl3DccNv84HOFeV21BBhdSWamW7ZZIODYKpYonqXfTcnX/aaoELJZ8EuKVmvhNWQ
 Rzk37HhO8tn6oocRbscGRKyZVANrBIk2D5JXC5xwmzzWcFoKp+f6GW6HatiWBSr3YTETXKfjGjoHK
 Nq1RuSJecgE9AyiTw10ik3aC+x5x2ps4Bk2oR0uXenG0rXDsuRGrJF5waLr9HR0ZpjgcQtZWfxZv8
 Wrk/tB8j9dFyFVzvjBF9DA==;
Date: Wed, 15 Jan 2025 17:07:56 +0200
Message-Id: <86tta0jesz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>, Paul Eggert <eggert@HIDDEN>
In-Reply-To: <87bjw8h7ce.fsf@HIDDEN> (message from Juri Linkov on
 Wed, 15 Jan 2025 09:19:10 +0200)
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
References: <87ldvd6i6n.fsf@HIDDEN> <87bjw8h7ce.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75569
Cc: mail@HIDDEN, 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 75569 <at> debbugs.gnu.org
> From: Juri Linkov <juri@HIDDEN>
> Date: Wed, 15 Jan 2025 09:19:10 +0200
> 
> > When opening a large file in /proc/* like /proc/cpuinfo in Emacs via
> > find-file, the buffer content is incomplete, when comparing the output
> > to the output produced by /bin/cat. The Eshell command eshell/cat has
> > the same problem.The proc file system doesn't report file sizes since
> > the files are dynamically generated. ls -l /proc/cpuinfo reports size 0.
> > Emacs doesn't handle this well, limiting its reads to 16KiB.
> >
> > In Eshell:
> >
> > cat /proc/cpuinfo > #<buffer bug>  ==> truncated buffer (exactly 16KiB)
> > *cat /proc/cpuinfo > #<buffer bug> ==> complete buffer (larger than 16KiB)
> 
> Strange, bug#9800 was closed as fixed, but I confirm the buffer is still
> truncated.

It was closed because it was fixed back then.  But maybe commits
8650b3308dd and/or 3fb2c174d3a7 broke that later?

The /proc/cpuinfo file on the system to which I have access is smaller
than 16KB, so could someone who can access a larger cpuinfo file
please see if those commits broke the fix, or maybe bisect?

Adding Paul in case he has comments or suggestions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at 75569 <at> debbugs.gnu.org:


Received: (at 75569) by debbugs.gnu.org; 15 Jan 2025 07:21:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 15 02:21:21 2025
Received: from localhost ([127.0.0.1]:56803 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tXxiK-0005DS-Mz
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 02:21:20 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:54517)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1tXxiI-0005DD-07
 for 75569 <at> debbugs.gnu.org; Wed, 15 Jan 2025 02:21:18 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id A71B11BF203;
 Wed, 15 Jan 2025 07:21:09 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
In-Reply-To: <87ldvd6i6n.fsf@HIDDEN> (Daniel Mendler via's message
 of "Wed, 15 Jan 2025 01:21:03 +0100")
Organization: LINKOV.NET
References: <87ldvd6i6n.fsf@HIDDEN>
Date: Wed, 15 Jan 2025 09:19:10 +0200
Message-ID: <87bjw8h7ce.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 75569
Cc: 75569 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

> When opening a large file in /proc/* like /proc/cpuinfo in Emacs via
> find-file, the buffer content is incomplete, when comparing the output
> to the output produced by /bin/cat. The Eshell command eshell/cat has
> the same problem.The proc file system doesn't report file sizes since
> the files are dynamically generated. ls -l /proc/cpuinfo reports size 0.
> Emacs doesn't handle this well, limiting its reads to 16KiB.
>
> In Eshell:
>
> cat /proc/cpuinfo > #<buffer bug>  ==> truncated buffer (exactly 16KiB)
> *cat /proc/cpuinfo > #<buffer bug> ==> complete buffer (larger than 16KiB)

Strange, bug#9800 was closed as fixed, but I confirm the buffer is still
truncated.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Jan 2025 00:21:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 14 19:21:40 2025
Received: from localhost ([127.0.0.1]:56205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tXrAB-0002bk-Nf
	for submit <at> debbugs.gnu.org; Tue, 14 Jan 2025 19:21:40 -0500
Received: from lists.gnu.org ([2001:470:142::17]:51436)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1tXrA6-0002bN-T1
 for submit <at> debbugs.gnu.org; Tue, 14 Jan 2025 19:21:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1tXrA1-0005S0-1B
 for bug-gnu-emacs@HIDDEN; Tue, 14 Jan 2025 19:21:29 -0500
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1tXr9x-0005V4-OS
 for bug-gnu-emacs@HIDDEN; Tue, 14 Jan 2025 19:21:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date:
 Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=TUlY9N+BQj71TiUBISuGL+UDIetwekQH1JJXroNdRv0=; b=GX5SSqUBsvAjzF55oQqg3/yrN0
 pJocIylbjqs+eHS+khXz4tSixPeA8ajg7TkHboqmOibSmQ683lH7t8UpcnZ+QMPk6C1VcTStnQvfq
 e8Mz5WWfwmVXRl7xSQiPMgy6YnhdJRv9i6W1yHmAI4I2H/EzQ2FXx7Hp4Vpn2eRW7Jmw=;
From: Daniel Mendler <mail@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.93; Large /proc/* file are read incompletely
X-Debbugs-Cc: 
Date: Wed, 15 Jan 2025 01:21:03 +0100
Message-ID: <87ldvd6i6n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a01:4f8:c012:9177::1;
 envelope-from=mail@HIDDEN; helo=mail.qxqx.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

When opening a large file in /proc/* like /proc/cpuinfo in Emacs via
find-file, the buffer content is incomplete, when comparing the output
to the output produced by /bin/cat. The Eshell command eshell/cat has
the same problem.The proc file system doesn't report file sizes since
the files are dynamically generated. ls -l /proc/cpuinfo reports size 0.
Emacs doesn't handle this well, limiting its reads to 16KiB.

In Eshell:

cat /proc/cpuinfo > #<buffer bug>  ==> truncated buffer (exactly 16KiB)
*cat /proc/cpuinfo > #<buffer bug> ==> complete buffer (larger than 16KiB)

In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw scroll bars) of 2025-01-14
Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-tree-sitter
 --with-native-compilation --with-x-toolkit=athena --with-dbus
 --without-selinux --without-threads --without-gsettings --without-gpm
 --with-cairo --with-cairo-xcb --disable-gc-mark-trace --with-xinput2'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix




Acknowledgement sent to Daniel Mendler <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#75569; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 19 Jan 2025 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.