unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 48177@debbugs.gnu.org
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	[thread overview]
Message-ID: <87czu89b7r.fsf@gmx.de> (raw)
In-Reply-To: <CAArVCkRK8dKr8chmXPnWJyiNvNKaVURuqajBjPaw8eR01Ng7Tw@mail.gmail.com> (Philipp Stephani's message of "Mon, 3 May 2021 00:04:43 +0200")

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Philipp Stephani <p.stephani2@gmail.com> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1843 bytes --]

diff --git a/lisp/files.el b/lisp/files.el
index 8e8fbac8dc..7b6e186257 100644
--- 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
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -276,6 +276,9 @@ DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0,
   else
     infile = build_string (NULL_DEVICE);

+  /* Remove "/:" from INFILE.  */
+  infile = remove_slash_colon (infile);
+
   encoded_infile = ENCODE_FILE (infile);

   filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0);
@@ -439,9 +442,15 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
   current_dir = encode_current_directory ();

   if (STRINGP (error_file))
-    error_file = ENCODE_FILE (error_file);
+    {
+      error_file = remove_slash_colon (error_file);
+      error_file = ENCODE_FILE (error_file);
+    }
   if (STRINGP (output_file))
-    output_file = ENCODE_FILE (output_file);
+    {
+      output_file = remove_slash_colon (output_file);
+      output_file = ENCODE_FILE (output_file);
+    }

   display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]);


  reply	other threads:[~2021-05-03 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 21:49 bug#48177: 28.0.50; process-file doesn't correctly handle quoted file names for INFILE Philipp Stephani
2021-05-02 21:53 ` Philipp Stephani
2021-05-02 22:04   ` Philipp Stephani
2021-05-03 13:51     ` Michael Albinus [this message]
2021-05-03 13:59       ` Philipp Stephani
2021-05-03 14:05         ` Michael Albinus
2021-05-03 14:54           ` Michael Albinus
2021-05-07 15:31           ` Glenn Morris
2021-05-07 15:34             ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czu89b7r.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=48177@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).