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 uJ+ALISTWGX00wAA9RJhRA:P1 (envelope-from ) for ; Sat, 18 Nov 2023 11:35:48 +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 uJ+ALISTWGX00wAA9RJhRA (envelope-from ) for ; Sat, 18 Nov 2023 11:35:48 +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 7896832CAF for ; Sat, 18 Nov 2023 11:35:48 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NNdYqHmP; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700303748; 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=O3bgl+cZ/hVilcABuAY500IOKVXJouKl87tvUGHx8BI=; b=SyxJFFOmZoOheGTwfpqIkxYSg2I0g+Or1WJOsEyWsa3OYwzLVxGjelP3NwEeF2Cd9gbSAw FNlQM3IpONnU2Zk5zW79DO+bw8GOwkIFw8DoGKdRID5/gqBwZWWi78aoGSZN9jMnJ1EOjQ OfaCsmvOjp0Ja/J95tbE6Tw93+q6cjzRasp17wjFYim58y5gvdSsOzrHBx8c6B4nJPeD4a tvIUnAshZE02brZA59NEvAT3+lrXuhWx8V9lGvP5A3C3634ahD+tK6VCTexxXFGXDKsgv4 QVxu9vVAySi+Eh8KjS7RuVrpD4zCHF/rGcnjVrEvwTHHeDIZsj6jmix1ZZ67mA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=NNdYqHmP; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700303748; a=rsa-sha256; cv=none; b=Y7VYEWI3ErBlHJ61oLDzwkp6z4bPY+EJxGKSGSUNigXOpIFZzWVKWMpkew4kiwpQWZ5ZYv vzFGrzUVkkd1ifDC5x17mG+s62SqcfTILThUcW+mTvEprKPfkUxpOLDzKnHsWZrOBj8RMZ Kx4YIrT+Y2B9ZlqHeI2sGutb5TmU7b9MpZFphcMFvbORIF9WUd6kImOcLrI1WY9bgJ+u2N KvNX5YQjP3C+ERvjkLJegNQ/K+6+OjMUjciuqK5nOImiFh1DTaNsnkm4qn9RQCM/WQaiT8 qcJ7l9mA/CDLskFsfsV0M4XOHvf7+NiBZBVVoQ0EiMK8h161KAh1V9poQjbCSw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4IfJ-0005XL-Ob; Sat, 18 Nov 2023 05:35:05 -0500 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 1r4IfI-0005XD-9g for emacs-orgmode@gnu.org; Sat, 18 Nov 2023 05:35:04 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4IfF-00033v-P4 for emacs-orgmode@gnu.org; Sat, 18 Nov 2023 05:35:04 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id EB7B6240027 for ; Sat, 18 Nov 2023 11:34:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1700303698; bh=Ho9nrrxInyxRNgc47agvFSuTOa7N/G3QZ+AQ/XJ6lYI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=NNdYqHmPfh13JmPthhHDXluVe60P8lU2MCeqIM0qkbveLgKwBqF7555pfwLfgDcKo SK7ApeXhfd0antM5N6XP/qqsithHmrQUHGyNgK7rzeTHGVb8A+feW3XzeY/2mYye4W j7jChbQj7XYhV/cLayZSZAsJ+Saq+Mked1EKbF289CEvF6VxWCzGuhjSqYXLOFn1BU KyNFj9fnh6p+Bk4/eUlI5CUsMhkWSPcvAZ7eFqiUwHaHtNCqvTsvhwd1S1pTh1lOrC v2mV5v7gBtlj4KAdE3uf/PMvbb+kJ3lItiWCBtlhmVZOwgvwkpAuNI802eoCfQ8Ccq jnvmhNspikViQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SXVX10F7zz6tvZ; Sat, 18 Nov 2023 11:34:56 +0100 (CET) From: Ihor Radchenko To: Bruno Barbier Cc: Alain.Cochard@unistra.fr, Matt , "emacs-orgmode@gnu.org" Subject: Re: bash source code block: problem after ssh commands In-Reply-To: <65578b29.050a0220.8941c.b420@mx.google.com> References: <25912.63830.726070.953843@gargle.gargle.HOWL> <87o7gldb78.fsf@localhost> <25914.26693.101108.954656@gargle.gargle.HOWL> <87fs1xbis1.fsf@localhost> <25916.238.191509.652552@gargle.gargle.HOWL> <653f8a93.050a0220.f2202.5816@mx.google.com> <87zfzr2ejj.fsf@localhost> <18ba5e231e3.f989cde147196.3154436412643995109@excalamus.com> <875y2e2b9y.fsf@localhost> <18bb07473e2.1007b1565819307.6938164403009000496@excalamus.com> <877cmr2ke4.fsf@localhost> <18bb5337346.dfcd5ebb1139895.801408740607633332@excalamus.com> <18bd3d38ff3.115b786cb2560022.7704006411630399228@excalamus.com> <87fs169h7f.fsf@localhost> <18bd984270d.1048050a22954105.2819987720224062869@excalamus.com> <25942.29051.701153.391260@gargle.gargle.HOWL> <18bd9ea2f7b.b77346232985684.5614027527324280790@excalamus.com> <871qcod9ad.fsf@localhost> <25943.14504.245343.443507@gargle.gargle.HOWL> <87sf54bs61.fsf@localhost> <65578b29.050a0220.8941c.b420@mx.google.com> Date: Sat, 18 Nov 2023 10:37:21 +0000 Message-ID: <87zfzb1h5q.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -7.79 X-Spam-Score: -7.79 X-Migadu-Queue-Id: 7896832CAF X-Migadu-Scanner: mx10.migadu.com X-TUID: eSJPwPIc3/+B Bruno Barbier writes: >> WRT M-x shell, feel free to submit a bug report. I mostly pointed that >> the problem with M-x shell is not the problem you originally ran to. It >> is a different problem (also, we ran into it in the past). > > FWIW, M-x shell differs from what a plain terminal is doing (xterm, in > my case), but, I do prefer 'M-x shell' behavior: it allows me to copy > multiple lines, getting the same results as when I type them manually, > or copy them line by line. My xterm doesn't seem to allow me to do that. The behavior of M-x shell can indeed be made use of. However, this particular difference with xterm, AFAIU, is not documented - unaware users may be surprised. The situation is worse with Org shell blocks - users naturally expect script-like behavior (even for :session), but run into edge cases like this and get confused. We should either document the caveats, or, preferably, make the behavior more consistent with expectations. At least, by default. That's why I think that filing a bug report makes sense from Org mode project point of view. > It looks like it is a known SSH "feature" (see > https://unix.stackexchange.com/a/688024): > > #+begin_src bash :results output > seq 1000000 | (ssh phone sleep 1; wc -l) > #+end_src > > #+RESULTS: > : 675173 > ... > IMHO, what ob-shell is doing today seems a valid way of evaluating > source blocks (and it seems to have been like that for a long time). It > should probably be documented somewhere, so that users know how to write > their source blocks, or switch to another way, like adding a :cmdline > parameter as mentionned in this thread. And, as Max demonstrated, this ssh feature only works with bash, but not necessarily other shells. Moreover, "-n" option that disables the above may depend on ssh configuration (see StdinNull in man 5 ssh_config). So, I believe that it only leads to confusion, even if we try to document it. __By default__, Org should produce more expected behavior - what users would get from running a script file rather than from redirecting stdin. We can optionally leave the stdin redirection as an option to be used by the users who understand the peculiarities. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at