From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#9800: Incomplete truncated file buffers from the /proc filesystem Date: Thu, 20 Oct 2011 10:22:43 +0200 Message-ID: <83ehy8t6lo.fsf@gnu.org> References: <877h40vb8h.fsf@mail.jurta.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1319099049 15802 80.91.229.12 (20 Oct 2011 08:24:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 20 Oct 2011 08:24:09 +0000 (UTC) Cc: 9800@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 20 10:24:05 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RGnv0-0005wO-Px for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Oct 2011 10:24:02 +0200 Original-Received: from localhost ([::1]:36329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGnv0-0000lT-1F for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Oct 2011 04:24:02 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGnuw-0000lG-ME for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2011 04:24:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGnuu-0000zw-7J for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2011 04:23:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGnuu-0000wq-5g for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2011 04:23:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RGnvy-0003PM-Bb for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2011 04:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2011 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9800-submit@debbugs.gnu.org id=B9800.131909904413030 (code B ref 9800); Thu, 20 Oct 2011 08:25:02 +0000 Original-Received: (at 9800) by debbugs.gnu.org; 20 Oct 2011 08:24:04 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGnv1-0003O7-Ji for submit@debbugs.gnu.org; Thu, 20 Oct 2011 04:24:03 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGnuz-0003Na-4u for 9800@debbugs.gnu.org; Thu, 20 Oct 2011 04:24:02 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LTC00J00V6NUD00@a-mtaout20.012.net.il> for 9800@debbugs.gnu.org; Thu, 20 Oct 2011 10:22:41 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.212.197]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LTC00JKOV9SJZ90@a-mtaout20.012.net.il>; Thu, 20 Oct 2011 10:22:41 +0200 (IST) In-reply-to: <877h40vb8h.fsf@mail.jurta.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 20 Oct 2011 04:25:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:52904 Archived-At: > From: Juri Linkov > 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?