From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AO9cLBSLP2XOZwEA9RJhRA:P1 (envelope-from ) for ; Mon, 30 Oct 2023 11:53:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AO9cLBSLP2XOZwEA9RJhRA (envelope-from ) for ; Mon, 30 Oct 2023 11:53:08 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5507114D39 for ; Mon, 30 Oct 2023 11:53:08 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nY8U0sRA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698663188; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8MfJ8Qsp8byatoxAbk+it41vKLzlYMvhzQSQifblMys=; b=n2JhcMKI+QSYNqaHh3RwblAsQPY2/DldS10rQa3WkWa4ZvQmQIfgZEHxFiMM948FSBbQSI H7VlL+Bcwk6oVe08yTTmXQ739ofwNEGtIGJg1H1kqmI+YNaEi6eMgqpx+S/Q9uJP+aE5fz 5Jo3A7QGzwWsyzaXIebFJQqRI/GhrI7XXRGuy4a09XJHfSOez4Ha1Qdmk40GZUCBnKOKxn /PoiejVD4pYHUM8GUU1L4+yftUH996w28mMdJhusAaYx07mFkWz88cLu3LeoOEMS/UvxXs kQpWgwI4w6DKo+0IP6hy1RN5bXcElgsDKwDVpQa4RMB9emxZZQGWQX5H/01Z6g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nY8U0sRA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698663188; a=rsa-sha256; cv=none; b=m4NwzFosLXtb4DuL73T0rjT3RtoapTx/zbb3X2xA0O2AWgNpdScO0PIve3ejj/6tQiBuVU 5jXvAEQiuOjI5fy9Wy2YoF763Rx6+P21ZM6T6EFpb1SKZPi4QtyfAg9i25/bZ1H5S3KBDu j+Pr4nIWxI4pRhEkVEyOS+74ZAUaasGVa7PhhjvEs6B38QtZo8MnUqt8g/AqVO7fUBc43W QosikwHhcm3PVF4k2HZWOFY6bbtwTJoS+sXF3Dl4n/9B6PhzSNKdedMoiA7+5/iB3j1Ivb Jip3nELepPY2KnMfccnZkmDMIheFmq/ihvYtUrq3XmojJekrrdFZHSXTe2+Adw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxPrr-0004GQ-5f; Mon, 30 Oct 2023 06:51:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxPrM-00044X-8Q for emacs-orgmode@gnu.org; Mon, 30 Oct 2023 06:51:05 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxPrK-0003Lk-II for emacs-orgmode@gnu.org; Mon, 30 Oct 2023 06:51:03 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c50cf61f6dso62094611fa.2 for ; Mon, 30 Oct 2023 03:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698663060; x=1699267860; darn=gnu.org; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=8MfJ8Qsp8byatoxAbk+it41vKLzlYMvhzQSQifblMys=; b=nY8U0sRApeFWX72cPy/HWs29FE21Lo7HHMB19bBJ3EguxNV/npEuWuMjykUjseC/1a IX94D2+55cOIgi0xhaiwZ/Bp6brW7tZ2tKWZRy1yFqMhlyySzGJQuQckejdS0uCQpeCM xn5pmOoycH4lZJuAgVgA8u9rD834FRtKS2EX5Zbbicmb1Y7gL9JFxc1qIoXfh043lb7R fRXH7UDWZLNRluZzd878MBKkF2GvLFMuP1/3cshchPlu8dOZ4RVz/IhQywWg25aMbdVx h6/R13riswPNDtyBaC2uo+O+cc6L0FRaiX0Oqu+9BqUZBDf5tY0GjHQk4UQgzkzZQFKx fM6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698663060; x=1699267860; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8MfJ8Qsp8byatoxAbk+it41vKLzlYMvhzQSQifblMys=; b=oJZwOjNNW6siGYq1DxDDPm+BPYV7KKhMlmQXtIQa8p4/yoGSlfyCt1PPGV1Eh2weQm UwYId4w5G8ULINGEGrIwBuZhXasB0EqXk2pZpZKQCOHSWniUxA/CbklDsCUL1u436Vo9 WBVc6sIA493XU3bdXqS5Z+zLORoa6hcjfdg0Dp02rku58Se0PtN6HAzkKmHNxzY2VL9E PM+6DJ+ra1IaUH33b0XwpfAVw4pi8AlkW4x1beTjEvdbGzopljNxW1xzrzji1jbqvbkE Exh4/c8Fg54W0FFCI70leQj5e3m27UtowXg7F7w7BdwWykL4JFhj4uqz82u/GYf5lfmY JOCA== X-Gm-Message-State: AOJu0YyqsF0P/H5B1PhNlyAn7/3IqorxyjrjbXfxEwd+1gaf1kybyW1a b5tIRIUfYFgz2wBwM1rZAfE= X-Google-Smtp-Source: AGHT+IHkFxLu8AGnAlPSfIMTpGIU55sRW8wO2VlWexuJ0OdpIJKoeGuXN/vKHKZw5NeD7ftOrhDF1A== X-Received: by 2002:a2e:3017:0:b0:2c5:1c12:cb85 with SMTP id w23-20020a2e3017000000b002c51c12cb85mr6729881ljw.16.1698663059845; Mon, 30 Oct 2023 03:50:59 -0700 (PDT) Received: from keynux ([2a01:e0a:505:3460:1c18:688d:ece4:372e]) by smtp.gmail.com with ESMTPSA id a1-20020a05600c348100b00402ff8d6086sm8821644wmq.18.2023.10.30.03.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:50:59 -0700 (PDT) Message-ID: <653f8a93.050a0220.f2202.5816@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Mon, 30 Oct 2023 11:50:57 +0100 From: Bruno Barbier To: Alain.Cochard@unistra.fr, Ihor Radchenko Cc: alain.cochard@unistra.fr, Leo Butler , "emacs-orgmode@gnu.org" Subject: Re: bash source code block: problem after ssh commands In-Reply-To: <25916.238.191509.652552@gargle.gargle.HOWL> References: <25912.63830.726070.953843@gargle.gargle.HOWL> <87bkcmlor9.fsf@t14.reltub.ca> <87o7gldb78.fsf@localhost> <25914.26693.101108.954656@gargle.gargle.HOWL> <87fs1xbis1.fsf@localhost> <25916.238.191509.652552@gargle.gargle.HOWL> Date: Mon, 30 Oct 2023 11:50:57 +0100 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=brubar.cs@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.40 X-Spam-Score: -9.40 X-Migadu-Queue-Id: 5507114D39 X-Migadu-Scanner: mx10.migadu.com X-TUID: M6+O7n3eQbZU Hi, Alain.Cochard@unistra.fr writes: > Ihor Radchenko writes on Thu 26 Oct 2023 13:44: > > > I can now reproduce the problem locally. > > > > It boils down to > > > > (setq exit-status > > (process-file shell-file-name input-file > > (if error-file > > (list t error-file) > > t) > > nil shell-command-switch command)) > > > > that is an equivalent of > > > > bash -c bash /path/to/file-containing-the-source-code.sh > > ... > I am confused about what you specifically do to "evaluate the above". > To start with, I have to use quotes to make your command be performed: > > bash -c "bash /path/to/file-containing-the-source-code.sh" > ... > > But most importantly, the second line *is* produced, either if I use > an SSH key for passwordless access or if I enter the password > manually. IIUC, the elisp expression: (process-file "bash" "/tmp/test.sh") is more equivalent to: cat /tmp/test.sh | bash i.e. the shell is getting the commands from stdin. Thus, any command that uses stdin might change what gets executed or not. I'm able to reproduce using the following minimal script, without passwords nor SSH (where the cryptic first line closes stdin). #+begin_src shell :results output exec 0>&- echo OK #+end_src The result is "OK" only when commenting out the first line; else, the echo command is not executed (because stdin has been closed). Here is an other example, where the second echo is eaten by the script itself: #+begin_src shell :results output echo 1 read -p "Next command? " NEXT_COMMAND echo 2 echo 3 #+end_src #+RESULTS: : 1 : 3 Bruno