From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#48177: 28.0.50; process-file doesn't correctly handle quoted file names for INFILE Date: Mon, 03 May 2021 15:51:52 +0200 Message-ID: <87czu89b7r.fsf@gmx.de> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26345"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 48177@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 03 15:53:18 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldZ0g-0006iD-3X for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 15:53:18 +0200 Original-Received: from localhost ([::1]:52778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldZ0f-0005Wv-5G for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 09:53:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldZ0Q-0005WR-Ed for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 09:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldZ0Q-0006hA-7L for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 09:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldZ0Q-0004gD-5z for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 09:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 May 2021 13:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48177 X-GNU-PR-Package: emacs Original-Received: via spool by 48177-submit@debbugs.gnu.org id=B48177.162004992117956 (code B ref 48177); Mon, 03 May 2021 13:53:02 +0000 Original-Received: (at 48177) by debbugs.gnu.org; 3 May 2021 13:52:01 +0000 Original-Received: from localhost ([127.0.0.1]:46503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldYzR-0004fS-F9 for submit@debbugs.gnu.org; Mon, 03 May 2021 09:52:01 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:53029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldYzQ-0004fK-LR for 48177@debbugs.gnu.org; Mon, 03 May 2021 09:52:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620049914; bh=URRlD1fc04a/Lt+xfVL/gpwUIytKLeYpPu7k2qWecIg=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=WXYgJ5wzU1gLe6/u5HdhLJmhZnvUhWPJDXj3LxMKd4e8KrEYWHOydV75PyWCpEkcO cl4J08Tdf3DvCMktxKNMKxeBybY7zRsMQCMU8R6RfNduUMkTopIDaObVilsrvW2bDO JDZSgDLIER/3QKTGhbMHJExua6CcraaWi1lT+MWY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([79.140.118.134]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MQe5k-1lxorP3rRG-00NjIT; Mon, 03 May 2021 15:51:54 +0200 In-Reply-To: (Philipp Stephani's message of "Mon, 3 May 2021 00:04:43 +0200") X-Provags-ID: V03:K1:KFiar9s+S2PlXAcch465Eji9/6S3dL4dMeXOUrEuKIKP0mCjOeH DnXQhskPys8RJl7XOpCvMQ8t7pwuzil2TxsTD9jTsB6CI13NbFL88cPOc8Fm/KCGD1DtdFl 4eOpqEXwFd3a5ZPniHihabpdiO+QuQISphMhN29JPGtWvv89kXMT1Y6hudlHBHaggY303Bj 47TSYZjbxq4JTjUAxyBIA== X-UI-Out-Filterresults: notjunk:1;V03:K0:qAnnRjOHIW4=:xkZk5laHyAAEXowJ2KUao3 rY2mvQP+YKcu8wZQ2/5qWimhSZmPfx7rLMkGCMXi2ehIoIZx+eswCqVQ3oML2QpZU1Hex4OI5 xM7Lqxw+YAYfWXdG0zb62J/V0k6P0KzobZvOLjm8o7fM8lDYHk/MW5g9g/pxtGQ1ElrVT1shy jBUBEHj6HwZfB9vfLFjtskla1geYWFF5KWjOUkM1P67gA9LxF2nAJfoXzHJ5DU4yEQNAVLNFW N+K1PXnrnIVuuUxFOXfPDxFyDfabI7OfikyG4GeEgAwP9L9+KrhchoFXHGzLttyn9tBnwQQUs qJxOvMUevBEtsOhTVvH+j4S3t8O6/ohJ33bhN6zutp5nAl1BqeTd2HV2uVX6gn6k2Zl/wvxVp 3Xc7eU6/DLgbiGWg60L3r9YC6KVQw3rBR6fD5D+3pdEN8Q+I18TE3CUY2K94rUeBSyLwXHAMs yJGhCvlLqdM2O2+C86+7NYo2k7DzuCBbFerQW5zvhA5PiZqXETZDN9gM75CWOIu4fcGkHR8DQ IfukrwZ8py+YQYOvSA0hyK0UeZJ6+iSnQI8/Dt28jnHYyQsRVpL/BQDKXqWoUwV1zvWLPjAoN mwk6aZVRNjJ9Ifyvvx5IlK3NPLmk8qpYpeZwn9mJ/LdPR6P9CtCc6Ayu1xMfX6PL1DvUIFZ9r VQejXz+nMErvF2Tf7PMMoocudPGImXT8MBPtjCnhf5id7JK9QNDN8ohIA3mWr+nmbMjaKwyFm 62jKN0Yp39b00vJrUtnzWL8BnRXN5fQypqlct3t+9CJ61eiauZc6bIhKuIBD4si3rJb8S/I7 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205512 Archived-At: --=-=-= Content-Type: text/plain Philipp Stephani writes: >> > Evaluate something like >> > >> > (process-file "/:/bin/true" "/:/dev/null") >> > >> > This gives an error >> > >> > (file-missing "Opening process input file" "No such file or directory" "/:/dev/null") >> > >> > Other magic filenames for INFILE (such as "/ssh:localhost:/dev/null") >> > work as expected. The docstring for `process-file' says that INFILE is >> > handled by filename handlers, so I think this should work for quoted >> > filenames as well. >> > >> >> Same for >> (process-file "/:/bin/true" nil '((:file "/:/dev/null") "/dev/null")) > > Other forms that I think should work, but fail: > > (let ((default-directory "/:/usr/")) > (process-file "/:/bin/true" nil '(t "/:/dev/null"))) > > (let ((temporary-file-directory "/:/tmp/")) > (process-file "/:/bin/true" nil '(t "/dev/null"))) The appended patch shall fix this, could you pls test? Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/files.el b/lisp/files.el index 8e8fbac8dc..7b6e186257 100644 =2D-- a/lisp/files.el +++ b/lisp/files.el @@ -7439,7 +7439,11 @@ file-name-non-special ;; might be bound to different file name handlers, we still ;; need this. (saved-file-name-handler-alist file-name-handler-alist) - file-name-handler-alist + (inhibit-file-name-handlers + (cons 'file-name-non-special + (and (eq inhibit-file-name-operation operation) + inhibit-file-name-handlers))) + (inhibit-file-name-operation operation) ;; Some operations respect file name handlers in ;; `default-directory'. Because core function like ;; `call-process' don't care about file name handlers in diff --git a/src/callproc.c b/src/callproc.c index 5aa2cbafb4..e44e243680 100644 =2D-- a/src/callproc.c +++ b/src/callproc.c @@ -276,6 +276,9 @@ DEFUN ("call-process", Fcall_process, Scall_process, 1= , MANY, 0, else infile =3D build_string (NULL_DEVICE); + /* Remove "/:" from INFILE. */ + infile =3D remove_slash_colon (infile); + encoded_infile =3D ENCODE_FILE (infile); filefd =3D emacs_open (SSDATA (encoded_infile), O_RDONLY, 0); @@ -439,9 +442,15 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int= filefd, current_dir =3D encode_current_directory (); if (STRINGP (error_file)) - error_file =3D ENCODE_FILE (error_file); + { + error_file =3D remove_slash_colon (error_file); + error_file =3D ENCODE_FILE (error_file); + } if (STRINGP (output_file)) - output_file =3D ENCODE_FILE (output_file); + { + output_file =3D remove_slash_colon (output_file); + output_file =3D ENCODE_FILE (output_file); + } display_p =3D INTERACTIVE && nargs >=3D 4 && !NILP (args[3]); --=-=-=--