* bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
@ 2017-03-03 13:38 Philipp Stephani
2017-03-03 16:37 ` Philipp Stephani
2017-03-03 16:59 ` Philipp Stephani
0 siblings, 2 replies; 5+ messages in thread
From: Philipp Stephani @ 2017-03-03 13:38 UTC (permalink / raw)
To: 25949
emacs -Q
C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file exists)
M-: (process-file "true")
will result in an error
Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "/:/tmp/")
call-process("true" nil nil nil)
apply(call-process "true" nil nil nil nil)
process-file("true" nil nil nil)
apply(process-file ("true" nil nil nil))
file-name-non-special(process-file "true" nil nil nil)
apply(file-name-non-special process-file "true" nil nil nil nil)
process-file("true" nil nil nil)
apply(process-file ("true" nil nil nil))
tramp-run-real-handler(process-file ("true" nil nil nil))
tramp-file-name-handler(process-file "true" nil nil nil)
apply(tramp-file-name-handler process-file "true" nil nil nil nil)
process-file("true")
eval((process-file "true") nil)
eval-expression((process-file "true") nil)
funcall-interactively(eval-expression (process-file "true") nil)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
In GNU Emacs 26.0.50 (build 10, x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
of 2017-03-03 built on localhost
Repository revision: 244de7b0ed3bb23e700c9edef51e413602d8720a
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --enable-checking --enable-check-lisp-object-type
--with-modules 'CFLAGS=-O0 -ggdb3''
Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt subr-x gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)
Memory information:
((conses 16 96482 12339)
(symbols 48 20188 1)
(miscs 40 39 156)
(strings 32 17690 5095)
(string-bytes 1 576738)
(vectors 16 14048)
(vector-slots 8 483315 6318)
(floats 8 48 68)
(intervals 56 217 0)
(buffers 976 12)
(heap 1024 23865 964))
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge. Vielen Dank.
This e-mail is confidential. If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
2017-03-03 13:38 bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name Philipp Stephani
@ 2017-03-03 16:37 ` Philipp Stephani
2017-03-03 16:59 ` Philipp Stephani
1 sibling, 0 replies; 5+ messages in thread
From: Philipp Stephani @ 2017-03-03 16:37 UTC (permalink / raw)
To: 25949
[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]
Philipp Stephani <p.stephani2@gmail.com> schrieb am Fr., 3. März 2017 um
14:41 Uhr:
>
> emacs -Q
> C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file exists)
> M-: (process-file "true")
>
> will result in an error
>
> Debugger entered--Lisp error: (file-missing "Setting current directory"
> "No such file or directory" "/:/tmp/")
> call-process("true" nil nil nil)
> apply(call-process "true" nil nil nil nil)
> process-file("true" nil nil nil)
> apply(process-file ("true" nil nil nil))
> file-name-non-special(process-file "true" nil nil nil)
> apply(file-name-non-special process-file "true" nil nil nil nil)
> process-file("true" nil nil nil)
> apply(process-file ("true" nil nil nil))
> tramp-run-real-handler(process-file ("true" nil nil nil))
> tramp-file-name-handler(process-file "true" nil nil nil)
> apply(tramp-file-name-handler process-file "true" nil nil nil nil)
> process-file("true")
> eval((process-file "true") nil)
> eval-expression((process-file "true") nil)
> funcall-interactively(eval-expression (process-file "true") nil)
> call-interactively(eval-expression nil nil)
> command-execute(eval-expression)
>
The same issue can be triggered simply with
(let ((default-directory "/:/")) (process-file "true"))
[-- Attachment #2: Type: text/html, Size: 2342 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
2017-03-03 13:38 bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name Philipp Stephani
2017-03-03 16:37 ` Philipp Stephani
@ 2017-03-03 16:59 ` Philipp Stephani
2017-03-03 19:31 ` Michael Albinus
1 sibling, 1 reply; 5+ messages in thread
From: Philipp Stephani @ 2017-03-03 16:59 UTC (permalink / raw)
To: 25949
[-- Attachment #1.1: Type: text/plain, Size: 1230 bytes --]
Philipp Stephani <p.stephani2@gmail.com> schrieb am Fr., 3. März 2017 um
14:41 Uhr:
>
> emacs -Q
> C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file exists)
> M-: (process-file "true")
>
> will result in an error
>
> Debugger entered--Lisp error: (file-missing "Setting current directory"
> "No such file or directory" "/:/tmp/")
> call-process("true" nil nil nil)
> apply(call-process "true" nil nil nil nil)
> process-file("true" nil nil nil)
> apply(process-file ("true" nil nil nil))
> file-name-non-special(process-file "true" nil nil nil)
> apply(file-name-non-special process-file "true" nil nil nil nil)
> process-file("true" nil nil nil)
> apply(process-file ("true" nil nil nil))
> tramp-run-real-handler(process-file ("true" nil nil nil))
> tramp-file-name-handler(process-file "true" nil nil nil)
> apply(tramp-file-name-handler process-file "true" nil nil nil nil)
> process-file("true")
> eval((process-file "true") nil)
> eval-expression((process-file "true") nil)
> funcall-interactively(eval-expression (process-file "true") nil)
> call-interactively(eval-expression nil nil)
> command-execute(eval-expression)
>
>
Attached a patch.
[-- Attachment #1.2: Type: text/html, Size: 2232 bytes --]
[-- Attachment #2: 0001-Make-process-file-resolve-the-default-directory.txt --]
[-- Type: text/plain, Size: 2159 bytes --]
From b6719f898fcec5d505c56f722365cde0d99fd10f Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Fri, 3 Mar 2017 17:56:01 +0100
Subject: [PATCH] Make process-file resolve the default directory
`call-process' doesn't respect file name handlers in
`default-directory', so `file-name-non-special' has to resolve them
for `process-file' (Bug#25959).
* lisp/files.el (file-name-non-special): Also resolve default directory
for 'process-file'.
* test/lisp/files-tests.el
(files-tests--file-name-non-special--process-files): Add unit test.
---
lisp/files.el | 8 +++++++-
test/lisp/files-tests.el | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lisp/files.el b/lisp/files.el
index c7de4453d7..4a37bfe9e8 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6906,7 +6906,13 @@ save-buffers-kill-terminal
(defun file-name-non-special (operation &rest arguments)
(let ((file-name-handler-alist nil)
(default-directory
- (if (eq operation 'insert-directory)
+ ;; Some operations respect file name handlers in
+ ;; `default-directory'. Because core function like
+ ;; `call-process' don't care about file name handlers in
+ ;; `default-directory', we here have to resolve the
+ ;; directory into a local one. For `process-file', this
+ ;; fixes Bug#25949.
+ (if (memq operation '(insert-directory process-file))
(directory-file-name
(expand-file-name
(unhandled-file-name-directory default-directory)))
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 9d456c512b..04e9ddd7d3 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -243,5 +243,10 @@ files-test-bug-18141-file
(concat "/:/:" subdir)))))
(delete-directory dir 'recursive))))
+(ert-deftest files-tests--file-name-non-special--process-files ()
+ "Check that Bug#25949 is fixed."
+ (skip-unless (executable-find "true"))
+ (should (eq (let ((default-directory "/:/")) (process-file "true")) 0)))
+
(provide 'files-tests)
;;; files-tests.el ends here
--
2.12.0.rc1.440.g5b76565f74-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
2017-03-03 16:59 ` Philipp Stephani
@ 2017-03-03 19:31 ` Michael Albinus
2017-04-04 12:35 ` Philipp Stephani
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2017-03-03 19:31 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 25949
Philipp Stephani <p.stephani2@gmail.com> writes:
Hi Philippe,
> emacs -Q
> C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file
> exists)
> M-: (process-file "true")
>
> will result in an error
There are other functions which behave similar wrong:
M-: (start-file-process "foo" (current-buffer) "true")
M-: (shell-command "true")
> + ;; Some operations respect file name handlers in
> + ;; `default-directory'. Because core function like
> + ;; `call-process' don't care about file name handlers in
> + ;; `default-directory', we here have to resolve the
> + ;; directory into a local one. For `process-file', this
> + ;; fixes Bug#25949.
> + (if (memq operation '(insert-directory process-file))
Maybe you could add them here (not tested).
Best regards, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
2017-03-03 19:31 ` Michael Albinus
@ 2017-04-04 12:35 ` Philipp Stephani
0 siblings, 0 replies; 5+ messages in thread
From: Philipp Stephani @ 2017-04-04 12:35 UTC (permalink / raw)
To: Michael Albinus, 25949-done
[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]
Michael Albinus <michael.albinus@gmx.de> schrieb am Fr., 3. März 2017 um
20:31 Uhr:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
> Hi Philippe,
>
> > emacs -Q
> > C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file
> > exists)
> > M-: (process-file "true")
> >
> > will result in an error
>
> There are other functions which behave similar wrong:
>
> M-: (start-file-process "foo" (current-buffer) "true")
> M-: (shell-command "true")
>
> > + ;; Some operations respect file name handlers in
> > + ;; `default-directory'. Because core function like
> > + ;; `call-process' don't care about file name handlers in
> > + ;; `default-directory', we here have to resolve the
> > + ;; directory into a local one. For `process-file', this
> > + ;; fixes Bug#25949.
> > + (if (memq operation '(insert-directory process-file))
>
> Maybe you could add them here (not tested).
>
Added and pushed as 604eb02fff to master.
[-- Attachment #2: Type: text/html, Size: 2057 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-04-04 12:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03 13:38 bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name Philipp Stephani
2017-03-03 16:37 ` Philipp Stephani
2017-03-03 16:59 ` Philipp Stephani
2017-03-03 19:31 ` Michael Albinus
2017-04-04 12:35 ` Philipp Stephani
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.