unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* how to reading 0 byte files properly
@ 2022-11-17  8:45 Binbin YE
  2022-11-17 10:15 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Binbin YE @ 2022-11-17  8:45 UTC (permalink / raw)
  To: emacs-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-18  2:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  8:45 how to reading 0 byte files properly Binbin YE
2022-11-17 10:15 ` Andreas Schwab
2022-11-18  1:04   ` Binbin YE
2022-11-18  2:17   ` Binbin YE

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).