GNU bug report logs -
#18515
Document call-process behaviour with respect to default-directory
Previous Next
Reported by: Eli Barzilay <eli <at> barzilay.org>
Date: Sun, 21 Sep 2014 03:35:01 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.3
Fixed in version 25.2
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18515 in the body.
You can then email your comments to 18515 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 21 Sep 2014 03:35:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 21 Sep 2014 03:35:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The documentation of `call-process' doesn't say anything about which
directory the process is started at, or the fact that it switches to
the directory in some way.
As the example that I ran into, I setq `ring-bell-function' in my
environment so it plays a nice ding. In some cases the dings didn't
play at all, or played after a huge delay etc. Since this is running
in a VM, I "obviously" concluded that something bad with the sound
driver configuration happened, and went on a wild chase that lead to
nothing.
Eventually, I noticed that the delay happens only when I have a file
open over sshfs -- and then I wrapped the `call-process' with a
(let ((default-directory "/")) ...) and all is well. A note about
switching to the directory in the documentation of `call-process', or
even just a mention of the directory in which it runs could have saved
me that chase...
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 02 Apr 2017 03:30:04 GMT)
Full text and
rfc822 format available.
Message #8 received at 18515 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 18515 patch
quit
Eli Barzilay <eli <at> barzilay.org> writes:
>
> Eventually, I noticed that the delay happens only when I have a file
> open over sshfs -- and then I wrapped the `call-process' with a
> (let ((default-directory "/")) ...) and all is well. A note about
> switching to the directory in the documentation of `call-process', or
> even just a mention of the directory in which it runs could have saved
> me that chase...
It's easy enough to add that of course, though I wonder if it really
would have helped. What other directory would the process run in?
[v1-0001-Mention-that-processes-start-in-default-directory.patch (text/x-diff, inline)]
From af7d3558d8557569c6d39b4dbf0e8cd53e8367f3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v1] Mention that processes start in default-directory
(Bug#18515)
* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that process starts in
`default-directory'.
---
lisp/subr.el | 4 +++-
src/callproc.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..0c9c852370 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,9 @@ start-process
If you want to separate standard output from standard error, use
`make-process' or invoke the command through a shell and redirect
-one of them using the shell syntax."
+one of them using the shell syntax.
+
+The process runs in `default-directory'."
(unless (fboundp 'make-process)
(error "Emacs was compiled without subprocess support"))
(apply #'make-process
diff --git a/src/callproc.c b/src/callproc.c
index 6d69e13757..1c37fa7054 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -239,6 +239,7 @@ t (mix it with ordinary output), or a file name string.
Otherwise it waits for PROGRAM to terminate
and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
+The process runs in `default-directory'.
usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
--
2.11.1
Added tag(s) patch.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 02 Apr 2017 03:30:05 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 02 Apr 2017 07:26:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 18515 <at> debbugs.gnu.org (full text, mbox):
npostavs <at> users.sourceforge.net writes:
> --- a/src/callproc.c
> +++ b/src/callproc.c
> @@ -239,6 +239,7 @@ t (mix it with ordinary output), or a file name string.
> Otherwise it waits for PROGRAM to terminate
> and returns a numeric exit status or a signal description string.
> If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
> +The process runs in `default-directory'.
That's not true if `default-directory' is remote.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 02 Apr 2017 13:41:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 18515 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
retitle 18515 Document call-process behaviour with respect to default-directory
quit
Michael Albinus <michael.albinus <at> gmx.de> writes:
>> +The process runs in `default-directory'.
>
> That's not true if `default-directory' is remote.
Aha, good point. This is an important thing to document.
[v2-0001-Mention-that-processes-start-in-default-directory.patch (text/x-diff, inline)]
From 6c450de9b474f1eb6255f8474b3dc5c5be81b9c7 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v2] Mention that processes start in default-directory
(Bug#18515)
* doc/lispref/processes.texi (Synchronous Processes):
(Asynchronous Processes):
* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that the subprocess starts in
`default-directory' when local, suggest `start-file-process' and
`process-file' otherwise.
---
doc/lispref/processes.texi | 9 ++++++++-
lisp/subr.el | 7 ++++++-
src/callproc.c | 4 ++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2a79cc781f..c76ca025d9 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -301,7 +301,9 @@ Synchronous Processes
This function calls @var{program} and waits for it to finish.
The current working directory of the subprocess is
-@code{default-directory}.
+@code{default-directory} if that is local (as determined by
+@code{unhandled-file-name-directory}), or "~" otherwise. If you want
+to run a process in a remote directory use @code{process-file}.
The standard input for the new process comes from file @var{infile} if
@var{infile} is not @code{nil}, and from the null device otherwise.
@@ -677,6 +679,11 @@ Asynchronous Processes
The original argument list, modified with the actual connection
information, is available via the @code{process-contact} function.
+
+The current working directory of the subprocess is
+@code{default-directory} if that is local (as determined by
+`unhandled-file-name-directory'), or "~" otherwise. If you want to
+run a process in a remote direcotry use @code{start-file-process}.
@end defun
@defun make-pipe-process &rest args
diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..472f931306 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,12 @@ start-process
If you want to separate standard output from standard error, use
`make-process' or invoke the command through a shell and redirect
-one of them using the shell syntax."
+one of them using the shell syntax.
+
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or \"~\"
+otherwise. If you want to run a process in a remote directory
+use `start-file-process'."
(unless (fboundp 'make-process)
(error "Emacs was compiled without subprocess support"))
(apply #'make-process
diff --git a/src/callproc.c b/src/callproc.c
index 6d69e13757..a781e47b17 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -240,6 +240,10 @@ t (mix it with ordinary output), or a file name string.
and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise. If
+you want to run a process in a remote directory use `process-file'.
+
usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
--
2.11.1
Changed bug title to 'Document call-process behaviour with respect to default-directory' from '24.3; Documentation of `call-process''
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 02 Apr 2017 13:41:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 02 Apr 2017 15:55:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 18515 <at> debbugs.gnu.org (full text, mbox):
> From: npostavs <at> users.sourceforge.net
> Date: Sun, 02 Apr 2017 09:41:48 -0400
> Cc: Eli Barzilay <eli <at> barzilay.org>, 18515 <at> debbugs.gnu.org
>
> retitle 18515 Document call-process behaviour with respect to default-directory
> quit
>
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> >> +The process runs in `default-directory'.
> >
> > That's not true if `default-directory' is remote.
>
> Aha, good point. This is an important thing to document.
I think at least the manual should say that the default-directory
alluded to here is that of the buffer which is current when the
respective functions are called.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Sun, 02 Apr 2017 16:25:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 18515 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> +The process runs in `default-directory'.
>> >
>> > That's not true if `default-directory' is remote.
>>
>> Aha, good point. This is an important thing to document.
>
> I think at least the manual should say that the default-directory
> alluded to here is that of the buffer which is current when the
> respective functions are called.
Hmm, seems a bit obvious to me, but okay.
[v3-0001-Mention-that-processes-start-in-default-directory.patch (text/x-diff, inline)]
From d750ec77e3f15c1cf4e94e288e097bc75904e5bd Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sat, 1 Apr 2017 23:15:46 -0400
Subject: [PATCH v3] Mention that processes start in default-directory
(Bug#18515)
* doc/lispref/processes.texi (Synchronous Processes):
(Asynchronous Processes):
* lisp/subr.el (start-process):
* src/callproc.c (call-process): Mention that the subprocess starts in
`default-directory' when local, suggest `start-file-process' and
`process-file' otherwise.
---
doc/lispref/processes.texi | 13 +++++++++++--
lisp/subr.el | 7 ++++++-
src/callproc.c | 4 ++++
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2a79cc781f..2acb7c99e0 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -300,8 +300,11 @@ Synchronous Processes
@defun call-process program &optional infile destination display &rest args
This function calls @var{program} and waits for it to finish.
-The current working directory of the subprocess is
-@code{default-directory}.
+The current working directory of the subprocess is set to the current
+buffer's value of @code{default-directory} if that is local (as
+determined by @code{unhandled-file-name-directory}), or "~" otherwise.
+If you want to run a process in a remote directory use
+@code{process-file}.
The standard input for the new process comes from file @var{infile} if
@var{infile} is not @code{nil}, and from the null device otherwise.
@@ -677,6 +680,12 @@ Asynchronous Processes
The original argument list, modified with the actual connection
information, is available via the @code{process-contact} function.
+
+The current working directory of the subprocess is set to the current
+buffer's value of @code{default-directory} if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise. If
+you want to run a process in a remote direcotry use
+@code{start-file-process}.
@end defun
@defun make-pipe-process &rest args
diff --git a/lisp/subr.el b/lisp/subr.el
index ebac2e0ef5..472f931306 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1970,7 +1970,12 @@ start-process
If you want to separate standard output from standard error, use
`make-process' or invoke the command through a shell and redirect
-one of them using the shell syntax."
+one of them using the shell syntax.
+
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or \"~\"
+otherwise. If you want to run a process in a remote directory
+use `start-file-process'."
(unless (fboundp 'make-process)
(error "Emacs was compiled without subprocess support"))
(apply #'make-process
diff --git a/src/callproc.c b/src/callproc.c
index 6d69e13757..a781e47b17 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -240,6 +240,10 @@ t (mix it with ordinary output), or a file name string.
and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
+The process runs in `default-directory' if that is local (as
+determined by `unhandled-file-name-directory'), or "~" otherwise. If
+you want to run a process in a remote directory use `process-file'.
+
usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
--
2.11.1
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18515
; Package
emacs
.
(Thu, 06 Apr 2017 23:20:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 18515 <at> debbugs.gnu.org (full text, mbox):
tags 18515 fixed
close 18515 25.2
quit
npostavs <at> users.sourceforge.net writes:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> >> +The process runs in `default-directory'.
>>> >
>>> > That's not true if `default-directory' is remote.
>>>
>>> Aha, good point. This is an important thing to document.
>>
>> I think at least the manual should say that the default-directory
>> alluded to here is that of the buffer which is current when the
>> respective functions are called.
>
> Hmm, seems a bit obvious to me, but okay.
Pushed to emacs-25 [1: c7ed57eaef].
1: 2017-04-06 18:50:54 -0400 c7ed57eaef46ed74ce926fc05dec9eaa5737f3d9
Mention that processes start in default-directory (Bug#18515)
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Thu, 06 Apr 2017 23:20:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.2, send any further explanations to
18515 <at> debbugs.gnu.org and Eli Barzilay <eli <at> barzilay.org>
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Thu, 06 Apr 2017 23:20:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 05 May 2017 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.