bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9800: Incomplete truncated file buffers from the /proc filesystem


From: Eli Zaretskii
Subject: bug#9800: Incomplete truncated file buffers from the /proc filesystem
Date: Thu, 20 Oct 2011 10:22:43 +0200

> From: Juri Linkov <address@hidden>
> Date: Thu, 20 Oct 2011 01:59:42 +0300
> 
> Large files from the /proc filesystem are visited incompletely,
> their file buffers are truncated at the position 65536.
> One possible test case to reproduce this is to load enough libraries
> with e.g. (imagemagick-register-types) and visit Emacs's maps file
> in /proc/$PID/maps.
> 
> Andreas said in 
> http://lists.gnu.org/archive/html/emacs-devel/2011-10/msg00782.html
> that it's due to this code in `insert-file-contents':
> 
>         /* The file size returned from stat may be zero, but data
>            may be readable nonetheless, for example when this is a
>            file in the /proc filesystem.  */
>         if (end_offset == 0)
>           end_offset = READ_BUF_SIZE;
> 
> How this could be fixed?  Should it keep reading while more data can be
> read from the file?

Does lseek work on these files?  If so, we could use something like

   lseek (fd, 0L, SEEK_END)

to find its size.  Or we could treat those files as non-regular, where
we set end_offset to TYPE_MAXIMUM (off_t) -- would that work with
these files?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]