From: Noam Postavsky <npostavs@gmail.com>
To: Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
Cc: 33016@debbugs.gnu.org
Subject: bug#33016: 26.1; (make-process ...) doesn't signal an error, when executable given as absolute Windows path does not exist
Date: Mon, 8 Apr 2019 14:34:41 -0400 [thread overview]
Message-ID: <CAM-tV-84b-Bxd_fFXynyL415DxvFoh321psLbpw68S+EWE4yVg@mail.gmail.com> (raw)
In-Reply-To: <CANtbJLHZ9a66NX3CsFh_jWpQUDauTn3GbNyQB0CY6=m0OO4G6A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
On Thu, 11 Oct 2018 at 08:57, Klaus-Dieter Bauer
<bauer.klaus.dieter@gmail.com> wrote:
> M-x eval-expression RET
> (make-process :name "test" :command '("c:/No Such Command"))
>
> will merely display in the echo-area message:
>
> eval: Spawning child process: Invalid argument
The confusing thing here is that the error is signaled between
block_input()...unblock_input(), which prevents the debugger from
triggering. E.g., the "-unless-debug" part in the expression below
appears not to work, even though the error flows normally in other
respects:
(condition-case-unless-debug err
(make-process :name "test" :command '("c:/No Such Command"))
(error (list :error err)))
;=> (:error (file-error "Spawning child process" "Invalid argument"))
The attached patch fixes this by moving the signal to after the unblock_input().
[-- Attachment #2: v1-0001-Let-debugger-handle-process-spawn-errors-on-w32-B.patch --]
[-- Type: application/octet-stream, Size: 2934 bytes --]
From d8716c1406301512fbbfce7f1eeb45fc8d531fd1 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 8 Apr 2019 13:16:38 -0400
Subject: [PATCH v1] Let debugger handle process spawn errors on w32
(Bug#33016)
When an error is signaled between block_input()...unblock_input(), the
Lisp debugger is prevented from starting.
* src/callproc.c (child_setup): Move the report_file_error call from here...
* src/process.c (create_process) [WINDOWSNT]: ... to here, after the
unblock_input() call.
---
src/callproc.c | 7 ++-----
src/lisp.h | 6 ++++++
src/process.c | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/callproc.c b/src/callproc.c
index fa12d02..a011250 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -695,7 +695,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
unblock_input ();
if (pid < 0)
- report_file_errno ("Doing vfork", Qnil, child_errno);
+ report_file_errno (CHILD_SETUP_ERROR_DESC, Qnil, child_errno);
/* Close our file descriptors, except for callproc_fd[CALLPROC_PIPEREAD]
since we will use that to read input from. */
@@ -1189,7 +1189,7 @@ exec_failed (char const *name, int err)
executable directory by the parent.
On GNUish hosts, either exec or return an error number.
- On MS-Windows, either return a pid or signal an error.
+ On MS-Windows, either return a pid or return -1 and set errno.
On MS-DOS, either return an exit status or signal an error. */
CHILD_SETUP_TYPE
@@ -1334,9 +1334,6 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
/* Spawn the child. (See w32proc.c:sys_spawnve). */
cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
reset_standard_handles (in, out, err, handles);
- if (cpid == -1)
- /* An error occurred while trying to spawn the process. */
- report_file_error ("Spawning child process", Qnil);
return cpid;
#else /* not WINDOWSNT */
diff --git a/src/lisp.h b/src/lisp.h
index 08c6dbd..c7eb471 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4233,6 +4233,12 @@ extern void setup_process_coding_systems (Lisp_Object);
#else
# define CHILD_SETUP_TYPE int
#endif
+#ifdef WINDOWSNT
+# define CHILD_SETUP_ERROR_DESC "Spawning child process"
+#else
+# define CHILD_SETUP_ERROR_DESC "Doing vfork"
+#endif
+
extern CHILD_SETUP_TYPE child_setup (int, int, int, char **, bool, Lisp_Object);
extern void init_callproc_1 (void);
extern void init_callproc (void);
diff --git a/src/process.c b/src/process.c
index 2df51cf..b8b7a3e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2204,7 +2204,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
unblock_input ();
if (pid < 0)
- report_file_errno ("Doing vfork", Qnil, vfork_errno);
+ report_file_errno (CHILD_SETUP_ERROR_DESC, Qnil, vfork_errno);
else
{
/* vfork succeeded. */
--
2.6.2.windows.1
next prev parent reply other threads:[~2019-04-08 18:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 12:55 bug#33016: 26.1; (make-process ...) doesn't signal an error, when executable given as absolute Windows path does not exist Klaus-Dieter Bauer
2018-10-11 14:22 ` Eli Zaretskii
2018-10-19 8:03 ` Klaus-Dieter Bauer
2018-10-19 8:30 ` Eli Zaretskii
2019-04-08 18:34 ` Noam Postavsky [this message]
2019-04-08 18:58 ` Eli Zaretskii
2019-04-09 14:13 ` Noam Postavsky
2019-04-09 14:33 ` Eli Zaretskii
2019-04-10 21:58 ` Noam Postavsky
2019-04-11 14:04 ` Eli Zaretskii
2019-04-11 17:34 ` Noam Postavsky
2019-04-11 17:55 ` Eli Zaretskii
2019-04-12 0:44 ` Noam Postavsky
2019-04-12 8:44 ` Eli Zaretskii
2019-04-12 18:20 ` Noam Postavsky
2019-04-12 18:44 ` Eli Zaretskii
2019-04-15 12:21 ` Noam Postavsky
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=CAM-tV-84b-Bxd_fFXynyL415DxvFoh321psLbpw68S+EWE4yVg@mail.gmail.com \
--to=npostavs@gmail.com \
--cc=33016@debbugs.gnu.org \
--cc=bauer.klaus.dieter@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).