From: Jim Porter <jporterbugs@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: the_wurfkreuz <the_wurfkreuz@proton.me>, 72013@debbugs.gnu.org
Subject: bug#72013: The eshell/kill command doesn't work with eshell/sudo correctly
Date: Sun, 14 Jul 2024 15:14:47 -0700 [thread overview]
Message-ID: <7d55215c-bd61-3cb4-aab2-177a74fc1d08@gmail.com> (raw)
In-Reply-To: <87frsh8zw4.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
On 7/10/2024 12:33 AM, Michael Albinus via Bug reports for GNU Emacs,
the Swiss army knife of text editors wrote:
> Tramp ought to support signal-process (and interrupt-process). See
> optional argument REMOTE of signal-process.
>
> Best regards, Michael.
Ok, I figured out why I thought Tramp didn't support 'signal-process'.
Elsewhere in Emacs, you can provide the signal to use like so:
'SIGKILL'. However, Tramp's 'tramp-signal-process' passes the name
directly to the POSIX "kill" command, which expects the "SIG" to be
removed. Here's a patch which does this.
[-- Attachment #2: 0001-Support-passing-signals-like-SIGCODE-to-tramp-signal.patch --]
[-- Type: text/plain, Size: 1330 bytes --]
From b0be4e33627bc94d1fb80b61e7013f3cf3b981b1 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sun, 14 Jul 2024 15:07:28 -0700
Subject: [PATCH] Support passing signals like 'SIGCODE' to
'tramp-signal-process'
POSIX specifies that "kill" should take signal names without the "SIG"
prefix.
* lisp/net/tramp.el (tramp-signal-process): Strip the "SIG" prefix when
present.
---
lisp/net/tramp.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e8329c82743..16ba4dc8e1c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -6986,8 +6986,13 @@ tramp-signal-process
(setq pid process
vec (and (stringp remote) (tramp-dissect-file-name remote))))
(t (signal 'wrong-type-argument (list #'processp process))))
- (unless (or (numberp sigcode) (symbolp sigcode))
- (signal 'wrong-type-argument (list #'numberp sigcode)))
+ (cond
+ ((symbolp sigcode)
+ (setq sigcode (symbol-name sigcode))
+ (when (string-prefix-p "SIG" sigcode)
+ (setq sigcode (substring sigcode 3))))
+ ((not (numberp sigcode))
+ (signal 'wrong-type-argument (list #'numberp sigcode))))
;; If it's a Tramp process, send SIGCODE remotely.
(when (and pid vec)
(tramp-message
--
2.25.1
next prev parent reply other threads:[~2024-07-14 22:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 13:04 bug#72013: The eshell/kill command doesn't work with eshell/sudo correctly the_wurfkreuz via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-09 17:02 ` Jim Porter
[not found] ` <FzIMSNqLEmByDFP6l93Tg2cAkopa20KM4W1sArsq0kPAfLqDZg5egeKf4wLaqxkGI5DCexUsNta70roOjORbqHIB4w4zZeB_kUgaN8her48=@proton.me>
2024-07-10 0:08 ` Jim Porter
2024-07-10 0:22 ` Jim Porter
2024-07-18 19:33 ` Jim Porter
2024-07-10 7:33 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-14 22:14 ` Jim Porter [this message]
2024-07-14 22:17 ` Jim Porter
2024-07-15 7:10 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-15 11:00 ` Eli Zaretskii
2024-07-15 16:36 ` Jim Porter
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d55215c-bd61-3cb4-aab2-177a74fc1d08@gmail.com \
--to=jporterbugs@gmail.com \
--cc=72013@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
--cc=the_wurfkreuz@proton.me \
/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 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.