From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#41099: 28.0.50; TRAMP process-file ignores exit status of remote process Date: Thu, 14 May 2020 14:38:59 +0200 Message-ID: References: <871rnyyyio.fsf@gmx.de> <87sggdmp9s.fsf@gmx.de> <87eerxwbjo.fsf@gmx.de> <87zhalrxyf.fsf@gmx.de> <87o8r1rmwv.fsf@gmx.de> <871rnwrvvn.fsf@gmx.de> <87v9kzl2ga.fsf@gmail.com> <87a72akcgz.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="51766"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41099@debbugs.gnu.org, Noam Postavsky To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 14:40:56 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZDAV-000DLm-J1 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 14:40:55 +0200 Original-Received: from localhost ([::1]:44242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZDAU-00083o-Ik for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 08:40:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZD9h-00076C-47 for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 08:40:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49035) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZD9e-00071s-Hj for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 08:40:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZD9e-0001lE-Ev for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 08:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 12:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41099 X-GNU-PR-Package: emacs Original-Received: via spool by 41099-submit@debbugs.gnu.org id=B41099.15894599596697 (code B ref 41099); Thu, 14 May 2020 12:40:02 +0000 Original-Received: (at 41099) by debbugs.gnu.org; 14 May 2020 12:39:19 +0000 Original-Received: from localhost ([127.0.0.1]:60581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZD8x-0001jx-Cf for submit@debbugs.gnu.org; Thu, 14 May 2020 08:39:19 -0400 Original-Received: from mail-oi1-f193.google.com ([209.85.167.193]:33569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZD8u-0001ji-T9 for 41099@debbugs.gnu.org; Thu, 14 May 2020 08:39:18 -0400 Original-Received: by mail-oi1-f193.google.com with SMTP id o24so24394662oic.0 for <41099@debbugs.gnu.org>; Thu, 14 May 2020 05:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ftnPvIZduXGLLEjBn+rXBPtVmRSuiXfLCyjm/nSSUrM=; b=X3tnFnYzIjpX+lyh8l4dCn/Gpi6Oy2Fmk7kUt2nq8jqaV0wq1jd4108jpaUeaAOyqY GFm51y6aRFgBMfD5LUMITMuWJfnnCFEWqH1woI2TNCHZJ2cgHV3O3OhXfvO0zJBVhM1w es7zQ2agCeQovvJXX0CE7kzknkNeScFzuxUdWDL5nOUI7dLIlDR5ElJYx+jUKyocBd1a e1Q01eLn851z05gVmf6WIMZEs9mHodvuMMuDOJaSEfqzIVvOAdKdT7Wj7nxrkJ73FmH2 N+ATgXZ8mw3knGuznJOe6NvymR323RDAMP+jvF80bKdKKLak/+X6JmCPRu/FFs5ijts+ D/sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ftnPvIZduXGLLEjBn+rXBPtVmRSuiXfLCyjm/nSSUrM=; b=FaknHjdHOcF/rY4qLp7MPLr6A+S5XacF/TI0e847t1OQII2BHBztVH+s6g22znw+iN 1CSs0LnQsxSTGcSx2iOHUMcuIFnkEXhJETrqixZrC9yWdoGegxlKx8G+cjwJziIezcBa opAyfxl5mUMWWJfVASP6KenY/OdjX94fD+8XqKZgpPz/2EUpo2Amad7229GzCgsQlhvz RGvXVl7lOfzLDsOYRiDeK7P+vIQts7S81McrtcDnMJhrpv6sT5cCvuzLloTKP8cHgWXR EczK+yb8qmPIRH8t+j+mBE+Cfmt9FhaZA8kC0aWU7WGAl8ZsdK67UIBlEd5jKCbOzxSA q8nQ== X-Gm-Message-State: AGi0PuYWPAoX5uhzHdvPzFxFVWxIBkTfq0VaTvQvg2g46VihjLcs9OL0 UEhAlR9kHLw0YG6HtdxTmMpiPF+msSfgViZaqDM= X-Google-Smtp-Source: APiQypLdJa1WE57nXef8xOpVXMJnZyexEC6qUvG3s4/cfQvzXYhnsq1tkc0NaJMhSWcoYumM83xs/I8Jsq9W3iuv0Ag= X-Received: by 2002:aca:ef44:: with SMTP id n65mr8467252oih.9.1589459950937; Thu, 14 May 2020 05:39:10 -0700 (PDT) In-Reply-To: <87a72akcgz.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180205 Archived-At: Am Do., 14. Mai 2020 um 13:00 Uhr schrieb Michael Albinus : > > Noam Postavsky writes: > > Hi Noam, > > >>> (defun tramp-process-file (...) > >>> (let ((code (...original code...))) > >>> (if (> code 128) > >>> ;; Probably a signal > >>> (format "Signal %d" (- code 128)) > >>> code)) > >> > >> I've pushed a patch to master along these lines. > > > > I don't think this is sufficiently reliable. With current master: > > > > (let ((default-directory "/sudo::/home/npostavs/.emacs.d/")) > > (process-file "git" nil nil nil "merge-base")) > > ;=> "Signal 1" > > > > (let ((default-directory "/home/npostavs/.emacs.d/")) > > (process-file "git" nil nil nil "merge-base")) > > ;=> 129 > > I see. A short test shows, that git is using exit code 129 in case of > error in invocation, although it isn't documented in the man pages. > > Hmm, this seems to be a contradiction to the specification of reserved > exit codes, as described in . > We cannot change git We can at least file a bug against Git. > so either > > - we keep Tramp's process-file implementation as it is, I'd (naturally) prefer that way. Exit codes > 128 are nonportable, as they don't allow shells to detect signals. > - we don't return a string in case a signal has interrupted the process, > - we install trap handlers in the remote shell in order to let Tramp > detect signals reliably. > Maybe I'm missing something, but I don't understand how this could work. Bash trap handlers only catch signals sent to the current process, not to subprocesses: $ trap 'echo SIGSYS caught' SYS $ bash -c 'kill -SYS $$' Bad system call: 12 Note that the trap handler isn't executed.