From: Binbin YE <phantom2501@gmail.com>
To: emacs-devel@gnu.org
Subject: how to reading 0 byte files properly
Date: Thu, 17 Nov 2022 17:45:43 +0900 [thread overview]
Message-ID: <CABVdjjBbJDY1TaxP9s2H7qRyvWNkBZouxzB-OUtYZaKXN+0e8A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1479 bytes --]
next reply other threads:[~2022-11-17 8:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 8:45 Binbin YE [this message]
2022-11-17 10:15 ` how to reading 0 byte files properly Andreas Schwab
2022-11-18 1:04 ` Binbin YE
2022-11-18 2:17 ` Binbin YE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABVdjjBbJDY1TaxP9s2H7qRyvWNkBZouxzB-OUtYZaKXN+0e8A@mail.gmail.com \
--to=phantom2501@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).