GNU bug report logs - #18370
insert-file-contents: forbids also beg, end for non-regular (special) files

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Ivan Shmakov <ivan@HIDDEN>; Keywords: moreinfo; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 18370 <at> debbugs.gnu.org:


Received: (at 18370) by debbugs.gnu.org; 12 Jun 2022 10:19:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 12 06:19:31 2022
Received: from localhost ([127.0.0.1]:54819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1o0Kgt-00013H-4o
	for submit <at> debbugs.gnu.org; Sun, 12 Jun 2022 06:19:31 -0400
Received: from quimby.gnus.org ([95.216.78.240]:53232)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1o0Kgr-00012y-C7
 for 18370 <at> debbugs.gnu.org; Sun, 12 Jun 2022 06:19:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uUIL3Xv1mbQRV0qhqrlkNYBAwEVtYXSXlq0TnidWCZU=; b=Odao2Ot9K3oY16oqrrqBFTXj5L
 ATBZU3YlyE0vLX2apOIUTqoGAkbarnbE+ypzXcaN70GfbNc8BX6yW/Wi4POXT+QlA3AojibJUwce4
 VJTdMsIHnMs0hqTEYX5dWlyYtbzwINxUJEfv1pCvl6aHaiDPPWP/o087DrcEwEoVOfXA=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1o0Kgi-0003ZG-Ji; Sun, 12 Jun 2022 12:19:23 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#18370: insert-file-contents: forbids also beg, end for
 non-regular (special) files
References: <87y4u4tp5a.fsf@HIDDEN> <874k1w6qlr.fsf@HIDDEN>
 <87r13vqsp0.fsf@HIDDEN> <86pmjeqqx0.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEUSERF6jHyryLxV
 PDmXWlz///9ZQryFAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+YGDAk5N3C3Cx0AAAGoSURBVDjLbZIL
 csQgCIbJ0ANE4wU0ewBSPMBauf+ZCpjsmm3JTDLhkx95ACzFbQds8SESkggzd7hAhipmrQsDfAJm
 kS5CCPQCRQFB7dItsvcZELKe7+JEQTahUkhIPdWkTrCHGEKIqzvqkBoReQYh8QVGirj5fy258w2U
 zSSYfxLXegfjHABKzQPkUHLMKpDIAFcuYXMQcyw7dy0QmCfg9uhPkyHAT6Cy2lX1c6WfS0rTaLeB
 mJQpaFNEbqrOOIBMoDSXcsBzRBk5uoPvGaTnFcF0zGDvOLzIeOQJPDqKA33uEcQxo1WuIE2AqcZt
 U6C2TGAvtIQwAB3p3fZQ1iXEZACpyfM9wbKiRqD6GUVoAjuGzQbC2O5Ar+R+bkn6tIklrwxf2t4j
 aF8UYLyA/rHoJiUel8YTBLbxNfX76OEU0xyeGl9uteMEltnEXcjmb0RXyJbEF3fE4Kova8kJUnu+
 tUCFvq+IbfJb/o193y6hyzCs6GXXDp9mfdW66Q/wizL/C8Y2zBnOkj79cAzgAbcrbX/AOqo4AbyU
 lgF8v84kAxzrdXAqxj/0C8wtgenSMRVkAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA2LTEyVDA5
 OjU3OjU1KzAwOjAwsdDWUQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNi0xMlQwOTo1Nzo1NSsw
 MDowMMCNbu0AAAAASUVORK5CYII=
X-Now-Playing: Arto Lindsay's _Mundo Civilizado_: "Clown"
Date: Sun, 12 Jun 2022 12:19:16 +0200
In-Reply-To: <86pmjeqqx0.fsf@HIDDEN> (Juri Linkov's message of "Sun, 
 12 Jun 2022 10:11:07 +0300")
Message-ID: <874k0qp4kb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Juri Linkov <juri@HIDDEN> writes: > Maybe this is related
 to bug#9800, still unfixed after this change. I think it's somewhat unrelated
 -- the /proc files are "regular" files, they just tend to "grow" while reading.
 I think the solution sketched in that bug report sounds OK. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 18370
Cc: 18370 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -3.3 (---)

Juri Linkov <juri@HIDDEN> writes:

> Maybe this is related to bug#9800, still unfixed after this change.

I think it's somewhat unrelated -- the /proc files are "regular" files,
they just tend to "grow" while reading.  I think the solution sketched
in that bug report sounds OK.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18370; Package emacs. Full text available.

Message received at 18370 <at> debbugs.gnu.org:


Received: (at 18370) by debbugs.gnu.org; 12 Jun 2022 07:50:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 12 03:50:57 2022
Received: from localhost ([127.0.0.1]:54591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1o0IN7-0003OG-A0
	for submit <at> debbugs.gnu.org; Sun, 12 Jun 2022 03:50:57 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:58083)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1o0IN1-0003Nw-OU
 for 18370 <at> debbugs.gnu.org; Sun, 12 Jun 2022 03:50:56 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 97AC2C0005;
 Sun, 12 Jun 2022 07:50:44 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#18370: insert-file-contents: forbids also beg, end for
 non-regular (special) files
Organization: LINKOV.NET
References: <87y4u4tp5a.fsf@HIDDEN> <874k1w6qlr.fsf@HIDDEN>
 <87r13vqsp0.fsf@HIDDEN>
Date: Sun, 12 Jun 2022 10:11:07 +0300
In-Reply-To: <87r13vqsp0.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sat,
 11 Jun 2022 14:40:27 +0200")
Message-ID: <86pmjeqqx0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18370
Cc: 18370 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -1.7 (-)

>> Simple test case:
>>
>> (insert-file-contents "/dev/urandom" nil nil 10)
>>
>> This still fails in Emacs 29, and it would indeed be nice if it worked.
>> I seem to remember this being discussed previously, and that...  er...
>> no, I can't really recall anything more than that.
>>
>> Does anybody see any good reasons why we shouldn't allow this?  If not,
>> I can take a stab at implementing it...
>
> There were no objections, so I've now added this to Emacs 29.

Maybe this is related to bug#9800, still unfixed after this change.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18370; Package emacs. Full text available.
bug marked as fixed in version 29.1, send any further explanations to 18370 <at> debbugs.gnu.org and Ivan Shmakov <ivan@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 18370 <at> debbugs.gnu.org:


Received: (at 18370) by debbugs.gnu.org; 11 Jun 2022 12:40:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 11 08:40:46 2022
Received: from localhost ([127.0.0.1]:52055 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1o00Q1-0006o6-W7
	for submit <at> debbugs.gnu.org; Sat, 11 Jun 2022 08:40:46 -0400
Received: from quimby.gnus.org ([95.216.78.240]:44500)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1o00Pz-0006nn-94
 for 18370 <at> debbugs.gnu.org; Sat, 11 Jun 2022 08:40:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=xcAPcnIa6H5FfUpRplKpKyKY4KToZThwjJDMRIyF9Fs=; b=Z5DmTf1govPXPVypcyCUUxfMEY
 3/rmD7HJqNZ4HRmj2pYMkGP6+UoH6m2EBVfXrTapwg1vSky+4KZ3S3EGcxxauVFBBpsCi55gOWVZd
 DQdS6IuYfJBbZYm5cg/WPoGpCo+yhhJX+rqW/tw9Pe1PQh6Vx2nEzJxmxnzf0LjIx+LI=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1o00Pk-0000s2-C6; Sat, 11 Jun 2022 14:40:30 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ivan Shmakov <ivan@HIDDEN>
Subject: Re: bug#18370: insert-file-contents: forbids also beg, end for
 non-regular (special) files 
References: <87y4u4tp5a.fsf@HIDDEN> <874k1w6qlr.fsf@HIDDEN>
X-Now-Playing: Various's _We Are Not Alone Pt. 1_: "Lullaby"
Date: Sat, 11 Jun 2022 14:40:27 +0200
In-Reply-To: <874k1w6qlr.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Wed,
 11 May 2022 17:22:56 +0200")
Message-ID: <87r13vqsp0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Lars Ingebrigtsen <larsi@HIDDEN> writes: > Simple test
 case:
 > > (insert-file-contents "/dev/urandom" nil nil 10) > > This still fails
 in Emacs 29, and it would indeed be nice if it worked. > I seem to remember
 this being discussed previousl [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 18370
Cc: 18370 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -3.3 (---)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Simple test case:
>
> (insert-file-contents "/dev/urandom" nil nil 10)
>
> This still fails in Emacs 29, and it would indeed be nice if it worked.
> I seem to remember this being discussed previously, and that...  er...
> no, I can't really recall anything more than that.
>
> Does anybody see any good reasons why we shouldn't allow this?  If not,
> I can take a stab at implementing it...

There were no objections, so I've now added this to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18370; Package emacs. Full text available.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 18370 <at> debbugs.gnu.org:


Received: (at 18370) by debbugs.gnu.org; 11 May 2022 15:23:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 11 11:23:12 2022
Received: from localhost ([127.0.0.1]:38169 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nooBE-0002CW-LT
	for submit <at> debbugs.gnu.org; Wed, 11 May 2022 11:23:12 -0400
Received: from quimby.gnus.org ([95.216.78.240]:42914)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nooBC-0002C4-Lv
 for 18370 <at> debbugs.gnu.org; Wed, 11 May 2022 11:23:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=gCj9N8oZlj/y8BXqAniYA0vxewmtnqj9Us9eXCD9EKo=; b=pa/raBHV/OgDstFbY1P0PoPdz3
 3RjRvS17L0ElWzO33Hcc9ZPJQWnBANMw0HXai3omH2CF1vBpS0dQ/+tuCYcQzpYSehi4B3diQKBg3
 h4hyjIRE+KtYisOAw+3K9xBBl+s1B77pE0QMonYL9pQQw99C5BdQjOp8RqXMIw6qk228=;
Received: from [84.212.220.105] (helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nooAz-0001Gv-9m; Wed, 11 May 2022 17:22:59 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ivan Shmakov <ivan@HIDDEN>
Subject: Re: bug#18370: insert-file-contents: forbids also beg, end for
 non-regular (special) files 
References: <87y4u4tp5a.fsf@HIDDEN>
X-Now-Playing: Joni Mitchell's _Travelogue (1)_: "For the Roses"
Date: Wed, 11 May 2022 17:22:56 +0200
In-Reply-To: <87y4u4tp5a.fsf@HIDDEN> (Ivan Shmakov's message of
 "Sun, 31 Aug 2014 19:50:09 +0000")
Message-ID: <874k1w6qlr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  Ivan Shmakov <ivan@HIDDEN> writes: > As currently implemented,
    insert-file-contents disallows not > only (as per (elisp.info) Reading from
    Files) the case of either > ‘visit’ or ‘replace’ arguments being
   non-nil, but also when [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 18370
Cc: 18370 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -3.3 (---)

Ivan Shmakov <ivan@HIDDEN> writes:

> 	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=
-nil, but also when
> 	non-nil are either =E2=80=98beg=E2=80=99 or =E2=80=98end=E2=80=99 (or bo=
th):

[...]

> 	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 allowe=
d, 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 th=
an I can
> 	test right now.  So no .diff this time, alas.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Simple test case:

(insert-file-contents "/dev/urandom" nil nil 10)

This still fails in Emacs 29, and it would indeed be nice if it worked.
I seem to remember this being discussed previously, and that...  er...
no, I can't really recall anything more than that.

Does anybody see any good reasons why we shouldn't allow this?  If not,
I can take a stab at implementing it...

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18370; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 Aug 2014 19:50:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 31 15:50:23 2014
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>
To: submit <at> debbugs.gnu.org
Subject: insert-file-contents: forbids also beg,
 end for non-regular (special) files 
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-Debbugs-Envelope-To: submit
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




Acknowledgement sent to Ivan Shmakov <ivan@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#18370; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jun 2022 10:30:02 UTC

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