From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Binbin YE Newsgroups: gmane.emacs.devel Subject: how to reading 0 byte files properly Date: Thu, 17 Nov 2022 17:45:43 +0900 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f6ed9305eda69d29" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16169"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 17 10:25:42 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ovb9R-0003vu-Vr for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Nov 2022 10:25:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovb8z-0006PB-EW; Thu, 17 Nov 2022 04:25:22 -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 1ovaWz-00058S-DC for emacs-devel@gnu.org; Thu, 17 Nov 2022 03:45:57 -0500 Original-Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovaWx-0004ya-Rb for emacs-devel@gnu.org; Thu, 17 Nov 2022 03:45:57 -0500 Original-Received: by mail-qk1-x72b.google.com with SMTP id z17so700292qki.11 for ; Thu, 17 Nov 2022 00:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=XRjkcb4ywslvY0/j3ihqrUcprZpsAp5IhiGgNXW3RpM=; b=Rs5mcFXHqHUD0DX091SxzrH9yBBMtyJ/IiGuLZe7EjRczu/XU7u+F25v4ot+GPHQKH OMtIML1k27K5Ow7+M9K3pblQ6NeGavSAGnHHJ4kHrhpTvzaD4lB8USjEtqwvR8+9sdWV gWnrCRVDi/QN23fALxKrtkW4h2YCF6FteylcMB25kz+xP2b0MDcaGrsCR20lttkTKzIa wvjK4CtG7X7+arJu1EECsye2HOQSXJJSLk4yW9eHkf1ZPuJeXLJdytbC3sftUmxH6ttV Pj3RunM+yof5GFmM0eii7m+k6dRNmzMBKz7FNI9Al3dY+jmyw6FW9oojj2xoQm7iYRXJ Hk7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XRjkcb4ywslvY0/j3ihqrUcprZpsAp5IhiGgNXW3RpM=; b=JUUG+hdVTrsy1xyHcB/oCzPtzOEgl57Tw2F6HYalr46gWr9qJbDmjdwpayfPZNVbWM MJv2a5O6GF6ZWTtlompqUugbnoPXeyXopkk5jT8/EgoSjm3wHVUO08vHRxrRizJLz4uz qAiHzD2wgigyfAQ6NiZ0qx8qMxsr7JgkzcaxXcBSjPI3yEWgaNl1nmxXil8dec7uJCDG YfSy4CBLg9ndidDue3yh8mM4DfGXakf3RoebsBJcz7b2f+PiIgoVEppXHHTm4DM+2s3W iK3qP104edmA1/3PNIVTiJ5OfB2lKua2I9Ku2zef9JI5eb46vL6blmFbWx4JJIWoT2bk qfaA== X-Gm-Message-State: ANoB5pmoKBRd0P3/NX/o+KRN3vbyJvPbHzuaZ6O+putk3q9RPmgQOuRc pDiqLDPK4lrQIM3L8phs0yIZMzm0ViU40Q+boAlhwB0J+N9D6Q== X-Google-Smtp-Source: AA0mqf5eogDNFiUTUb4PGLmGLvIHTI8gKMVR0pm9SunIHykU58hTydQSnWlRhHTtxFmbqYRM/pz0G88qsYmmR/KzBcs= X-Received: by 2002:a05:620a:148b:b0:6fa:e099:bc12 with SMTP id w11-20020a05620a148b00b006fae099bc12mr859914qkj.308.1668674754111; Thu, 17 Nov 2022 00:45:54 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=phantom2501@gmail.com; helo=mail-qk1-x72b.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Nov 2022 04:25:11 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300030 Archived-At: --000000000000f6ed9305eda69d29 Content-Type: text/plain; charset="UTF-8" Hi devs! I've been trying using emacs to view some files mounted by FUSE. Sadly file attr in the system says the file size is 0 bytes, just like files under /proc emacs can open the file but only can open it partially. I've checked the code to handle find-file and narrow down to ```c /* emacs/src/fileio.c:4587 */ if (seekable || !NILP (end)) total = end_offset - beg_offset; else /* For a special file, all we can do is guess. */ total = READ_BUF_SIZE; ``` Judging from the code, it assume the total size would be READ_BUF_SIZE which seems to be not a very big number ( or not, I'm not sure) ```c /* emacs/src/fileio.c:3692 */ enum { READ_BUF_SIZE = MAX_ALLOCA }; ``` ```h /* emacs/src/lisp.h:5300 */ enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 }; ``` since vscode, vim, cat, and less can read this file properly, I would like to clarify whether it is a bug to fix or there another way to open a big file like this (say the actual size is 2MB~ but showing as 0 byte on stat) Best, Binbin --000000000000f6ed9305eda69d29 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi devs!

I've been trying using ema= cs to view some files mounted by FUSE. Sadly file attr in the system says t= he file size is 0 bytes, just like files under /proc

emacs can open the file but only can open it partially. I've checked= the code to handle find-file and narrow down to=C2=A0

=
```c
/* emacs/src/fileio.c:4587 */

if (seekable || !NILP (en= d))
=C2=A0 total =3D end_offset - beg_offset;
else
=C2=A0 /* For a= special file, all we can do is guess. =C2=A0*/
=C2=A0 total =3D READ_BU= F_SIZE;
```
Judging from the code, it assume the total size wo= uld be READ_BUF_SIZE

which seems to be not a very = big number ( or not, I'm not sure)

```c
/* = emacs/src/fileio.c:3692 */

enum { READ_BUF_SIZE =3D MAX_ALLOCA };```

```h
/* emacs/src/lisp.h:5300 */
enum MAX_ALLOCA { MAX_ALLOCA =3D 16 * 1024 };
```

since vscode, vim, cat, and less can read this file properly, I wo= uld like to clarify whether it is a bug to fix or there another way to open= a big file like this (say the actual size is 2MB~ but showing as 0 byte on= stat)

Best,

Binbin
--000000000000f6ed9305eda69d29--