From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Emacs opens only first 16384 bytes of file?! Date: Sun, 12 Feb 2023 13:56:48 +0800 Message-ID: References: <87h6vrucl7.fsf@drac> <87mt5jscs2.fsf@telefonica.net> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38991"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 29.0.60 Cc: Christoph Groth , help-gnu-emacs@gnu.org To: =?utf-8?Q?=C3=93scar?= Fuentes Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 12 07:18:59 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pR5hT-0009sr-6I for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Feb 2023 07:18:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pR5gc-0001Cn-Jf; Sun, 12 Feb 2023 01:18:06 -0500 Original-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 ) id 1pR5ga-0001CJ-KS for help-gnu-emacs@gnu.org; Sun, 12 Feb 2023 01:18:04 -0500 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pR5gY-0006NJ-73 for help-gnu-emacs@gnu.org; Sun, 12 Feb 2023 01:18:04 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id b4ab46dd (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 12 Feb 2023 06:17:56 +0000 (UTC) In-reply-to: <87mt5jscs2.fsf@telefonica.net> Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, PLING_QUERY=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142721 Archived-At: =C3=93scar Fuentes writes: > [...] > As of today (Emacs 30, current development branch) the same is true. > > /proc/cpuinfo is not a regular file, in the sense that its content is > not stored in a device. AFAIK it is generated on-the-fly when it is > read. > > You can do some simple observations: > > $ ls -l /proc/cpuinfo > -r--r--r-- 1 root root 0 feb 7 03:34 /proc/cpuinfo > $ du /proc/cpuinfo > 0 /proc/cpuinfo > > Here those tools are saying that the file's size is 0. Thanks for elaborating on the part that I missed. So, to reproduce the issue, we need to find a file which does not show size, and whose contents are generated on-the-fly when read -- in the original report, it is /proc/cpuinfo, and I have also found /proc/kallsyms which contains around 12M of data. In this case, I have reproduced the issue on my Emacs 29 build. > I guess that Emacs detects that the file is special and reads its > contents following some heuristics. What surprises me is that M-x > revert-file actually reads all the content. > > Of course, looking at the sources would be enlightening, but why do the > effort of actually clearing the matter when it is so cheap to throw > speculation? ;-) I think the limit of 16384 is probably caused by fileio.c:3919 (907fd1f7ff4 somewhere on master, inside DEFUN "insert-file-contents") which declares a read buffer. The constant READ_BUF_SIZE is indirectly set as 16 * 1024 =3D 16384. Didn't read further there, nor inside `revert-buffer'. > (I looked at insert-file-contents, but bailed out after the fifth > screenful of code. A 1000+ lines function, no kidding.) Yeah, that's exactly why I didn't read further there. -- Best, RY