Subject: bug#41099: 28.0.50; TRAMP process-file ignores exit status of remote process

From: Philipp Stephani <[email-masked]>
Date: Wed, 6 May 2020 19:56:06 +0200

Am Mi., 6. Mai 2020 um 19:30 Uhr schrieb Michael Albinus
<[email-masked]>:
>
> Philipp Stephani <[email-masked]> writes:
>
> Hi Philipp,
>
> >> As a second step, consider also translating signals: if the exit code
> >> is > 128, subtract 128 and return an appropriate string, like
> >> call-process does.
> >
> > Try
> > (call-process "bash" nil nil nil "-c" "kill -SYS $$")
> > "Bad system call"
>
> I see. Hmm, this would require to install a trap handler in the remote
> shell, and to add a mechanism transferring its result back to
> Tramp. Don't know whether this is worth the effort.

That wouldn't work because Bash translates signals from subprocesses:

$ bash -c 'kill -SYS $$'; echo $?
Bad system call (core dumped)
159

The 159 here is 128 + the signal number.