From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Kenichi Handa <handa@m17n.org>
Newsgroups: gmane.emacs.devel
Subject: Re: safe_call1 considered harmful
Date: Mon, 24 Jul 2006 10:36:12 +0900
Message-ID: <E1G4pMi-0005wp-00@etlken>
References: <uirlrguz3.fsf@gnu.org> <E1G3tGq-0006Z3-00@etlken>
	<uac73gdpy.fsf@gnu.org>
NNTP-Posting-Host: main.gmane.org
Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
X-Trace: sea.gmane.org 1153705037 3254 80.91.229.2 (24 Jul 2006 01:37:17 GMT)
X-Complaints-To: usenet@sea.gmane.org
NNTP-Posting-Date: Mon, 24 Jul 2006 01:37:17 +0000 (UTC)
Cc: emacs-devel@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 24 03:37:15 2006
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by ciao.gmane.org with esmtp (Exim 4.43)
	id 1G4pNi-0007ZX-87
	for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 03:37:14 +0200
Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1G4pNh-0006L2-Qm
	for ged-emacs-devel@m.gmane.org; Sun, 23 Jul 2006 21:37:13 -0400
Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1G4pNW-0006J5-GP
	for emacs-devel@gnu.org; Sun, 23 Jul 2006 21:37:02 -0400
Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1G4pNU-0006Ir-QW
	for emacs-devel@gnu.org; Sun, 23 Jul 2006 21:37:02 -0400
Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1G4pNU-0006Io-Lb
	for emacs-devel@gnu.org; Sun, 23 Jul 2006 21:37:00 -0400
Original-Received: from [150.29.246.133] (helo=mx1.aist.go.jp)
	by monty-python.gnu.org with esmtp (Exim 4.52)
	id 1G4pOS-0008Na-5k; Sun, 23 Jul 2006 21:38:00 -0400
Original-Received: from smtp1.aist.go.jp ([150.29.246.12])
	by mx1.aist.go.jp  with ESMTP id k6O1asc6020441;
	Mon, 24 Jul 2006 10:36:54 +0900 (JST) env-from (handa@m17n.org)
Original-Received: by smtp1.aist.go.jp  with ESMTP id k6O1ashR025394;
	Mon, 24 Jul 2006 10:36:54 +0900 (JST) env-from (handa@m17n.org)
Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian))
	id 1G4pMi-0005wp-00; Mon, 24 Jul 2006 10:36:12 +0900
Original-To: Eli Zaretskii <eliz@gnu.org>
In-reply-to: <uac73gdpy.fsf@gnu.org> (message from Eli Zaretskii on Fri, 21
	Jul 2006 18:49:29 +0300)
User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2
	Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:57513
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/57513>

In article <uac73gdpy.fsf@gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

>> But, by considering this problem again, I found another
>> solution than calling find-operation-coding-system with
>> (FILENAME . BUFFER).  That is to provide an extra argument
>> BUFFER.  Then, we can keep backward compatibility and
>> find-buffer-file-type-coding-system works as before, and, by
>> modifying po-find-file-coding-system to check that extra
>> argument instead of checking if FILENAME is cons or not, we
>> can make it work well too.

> This will work if no function on file-coding-system-alist currently
> looks at arguments beyond the 1st one, the file name.  If there are
> functions which look beyond that, such a change will break them.

No, what I meant is to give the extra argument BUFFER at the
END of the normal arguments to insert-file-contents.  So,
for instance, tar-extract will call
find-operation-coding-system as this:

			     (car (find-operation-coding-system
				   'insert-file-contents
				   name t nil nil nil (current-buffer)))

The new docstring (only the last paragraph) for
find-operation-coding-system will be:

----------------------------------------------------------------------
[...]
If OPERATION is `insert-file-contents', there may be an extra argument
BUFFER at the end.  In that case, FILENAME is a file name to look up,
and BUFFER is a buffer that contains the file's contents (not yet
decoded).  If `file-coding-system-alist' specifies a function to call
for FILENAME, that function should examine the contents of BUFFER
instead of reading the file.
----------------------------------------------------------------------

This change breaks only such a function that checks that the
number of given arguments is not greater than 5 (the maximum
arguments to insert-file-contents).  I believe such a
function is very very rare.

> In any case, I think we should revert the change you made to use
> safe_call1.

Yes.

---
Kenichi Handa
handa@m17n.org