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> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 31 Aug 2014 19:51:01 +0000
Resent-Message-ID: <handler.18370.B.140951462324088 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 18370
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 18370 <at> debbugs.gnu.org
X-Debbugs-Original-To: submit <at> debbugs.gnu.org
Received: via spool by submit <at> debbugs.gnu.org id=B.140951462324088
          (code B ref -1); Sun, 31 Aug 2014 19:51:01 +0000
Received: (at submit) by debbugs.gnu.org; 31 Aug 2014 19:50:23 +0000
Received: from localhost ([127.0.0.1]:55139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XOB8o-0006GS-Pj
	for submit <at> debbugs.gnu.org; Sun, 31 Aug 2014 15:50:23 -0400
Received: from fely.am-1.org ([78.47.74.50]:52783)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <ivan@HIDDEN>) id 1XOB8l-0006GG-Ll
 for submit <at> debbugs.gnu.org; Sun, 31 Aug 2014 15:50:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net;
 s=a2013295; 
 h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From;
 bh=A8TI6hGnaamNfbsOOl4KSGZF3IG+BN/jxJ531Fy8rmo=; 
 b=mOmBOELefW/XfLqkfgRAOMj1rG30/LCLFm/rmJJWLlvdnoFQCjtqZMK3AMJ/slj7ZgNt6gqjmSwsLREb8zevqIIY8CR/rdaBmnKeDSBzKv8bUZyhKBikl9Hqd/C9nyMEbJtuTAba7xdx/ehjfzBomMrtvERxTrZiMZOyospVPJM=;
Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net)
 by fely.am-1.org 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> debbugs.gnu.org; Sun, 31 Aug 2014 19:50:17 +0000
Received: from localhost ([::1] helo=violet.siamics.net)
 by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.80) (envelope-from <ivan@HIDDEN>) id 1XOB8c-0001Ae-Jq
 for submit <at> debbugs.gnu.org; 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> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Package:  emacs
Severity: minor

	As currently implemented, insert-file-contents disallows not
	only (as per (elisp.info) 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;
=E2=8B=AF
  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.

--=20
FSF associate member #7257  http://boycottsystemd.org/  =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> debbugs.gnu.org>
References: <87y4u4tp5a.fsf@HIDDEN>
X-Gnu-PR-Message: ack 18370
X-Gnu-PR-Package: emacs
Reply-To: 18370 <at> debbugs.gnu.org
Date: Sun, 31 Aug 2014 19:51:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

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):
 bug-gnu-emacs@HIDDEN

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

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

--=20
18370: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18370
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.