GNU logs - #18370, boring messages

Message sent to bug-gnu-emacs@HIDDEN:

X-Loop: help-debbugs@HIDDEN
Subject: bug#18370: insert-file-contents: forbids also beg, end for non-regular (special) files 
Resent-From: Ivan Shmakov <ivan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at>>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 31 Aug 2014 19:51:01 +0000
Resent-Message-ID: <handler.18370.B.140951462324088 <at>>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 18370
X-GNU-PR-Package: emacs
To: 18370 <at>
X-Debbugs-Original-To: submit <at>
Received: via spool by submit <at> id=B.140951462324088
          (code B ref -1); Sun, 31 Aug 2014 19:51:01 +0000
Received: (at submit) by; 31 Aug 2014 19:50:23 +0000
Received: from localhost ([]:55139
	by with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at>>)
	id 1XOB8o-0006GS-Pj
	for submit <at>; Sun, 31 Aug 2014 15:50:23 -0400
Received: from ([]:52783)
 by with esmtp (Exim 4.80)
 (envelope-from <ivan@HIDDEN>) id 1XOB8l-0006GG-Ll
 for submit <at>; Sun, 31 Aug 2014 15:50:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;;
Received: from [2a02:2560:6d4:26ca::1:1d] (
 by with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128)
 (Exim 4.80) (envelope-from <ivan@HIDDEN>) id 1XOB8j-00038s-Pm
 for submit <at>; Sun, 31 Aug 2014 19:50:17 +0000
Received: from localhost ([::1]
 by with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.80) (envelope-from <ivan@HIDDEN>) id 1XOB8c-0001Ae-Jq
 for submit <at>; Mon, 01 Sep 2014 02:50:10 +0700
From: Ivan Shmakov <ivan@HIDDEN>
Date: Sun, 31 Aug 2014 19:50:09 +0000
Message-ID: <87y4u4tp5a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit <at>
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <>
List-Unsubscribe: <>, 
 <mailto:debbugs-submit-request <at>>
List-Archive: <>
List-Post: <mailto:debbugs-submit <at>>
List-Help: <mailto:debbugs-submit-request <at>>
List-Subscribe: <>, 
 <mailto:debbugs-submit-request <at>>
Errors-To: debbugs-submit-bounces <at>
Sender: "Debbugs-submit" <debbugs-submit-bounces <at>>
X-Spam-Score: 0.7 (/)

Package:  emacs
Severity: minor

	As currently implemented, insert-file-contents disallows not
	only (as per ( Reading from Files) the case of either
	=E2=80=98visit=E2=80=99 or =E2=80=98replace=E2=80=99 arguments being non-n=
il, but also when
	non-nil are either =E2=80=98beg=E2=80=99 or =E2=80=98end=E2=80=99 (or both=

  3506	  /* This code will need to be changed in order to work on named
  3507	     pipes, and it's probably just not worth it.  So we should at
  3508	     least signal an error.  */
  3509	  if (!S_ISREG (st.st_mode))
  3510	    {
  3511	      not_regular =3D 1;
  3516	      if (! NILP (replace) || ! NILP (beg) || ! NILP (end))
  3517		xsignal2 (Qfile_error,
  3518			  build_string ("not a regular file"), orig_filename);
  3519	    }

	This, however, precludes the use of insert-file-contents not
	only on named pipes, but also on /dev/cdrom, /dev/random, and
	the like, =E2=80=93 for (and especially in the case of the latter) the
	=E2=80=98end=E2=80=99 argument gets rather essential here, as otherwise the
	function is likely to read much more than the caller will be
	able to handle at any single time.

	Instead, I=E2=80=99d suggest that =E2=80=98end=E2=80=99 is always allowed,=
 and =E2=80=98beg=E2=80=99 is
	allowed when the file in question is /seekable/, =E2=80=93 which, ISTR,
	is possible to check beforehand (lseek (fd, 0, SEEK_CUR) < 0?)

	From a glance over the code, this new behavior wouldn=E2=80=99t be all
	that hard to implement (some not_regular checks will have to be
	replaced with the ones against beg_offset, end_offset, etc.),
	but from what I read, =E2=80=93 it=E2=80=99s already going to be more than=
 I can
	test right now.  So no .diff this time, alas.

FSF associate member #7257  =E2=80=A6 3013 B6A0=
 230E 334A

Message sent:

Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Ivan Shmakov <ivan@HIDDEN>
Subject: bug#18370: Acknowledgement (insert-file-contents: forbids also
 beg, end for non-regular (special) files )
Message-ID: <handler.18370.B.140951462324088.ack <at>>
References: <87y4u4tp5a.fsf@HIDDEN>
X-Gnu-PR-Message: ack 18370
X-Gnu-PR-Package: emacs
Reply-To: 18370 <at>
Date: Sun, 31 Aug 2014 19:51:02 +0000

Thank you for filing a new bug report with

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):

If you wish to submit further information on this problem, please
send it to 18370 <at>

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.