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 wF/UKQKVWGWMBQEA9RJhRA:P1 (envelope-from ) for ; Sat, 18 Nov 2023 11:42:10 +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 wF/UKQKVWGWMBQEA9RJhRA (envelope-from ) for ; Sat, 18 Nov 2023 11:42:10 +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 7DF2B34746 for ; Sat, 18 Nov 2023 11:42:10 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=igPsSimu; 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=1700304130; 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=9/ThZWcpB9IPGe+yK6Kyhrce5Z37H3ypQMqcVUFOvg0=; b=aFuhyq5wJii4ojEUCgbbsIeVy/shbDlMWmZT/R/FtLm3VK5PfEFZpH//78h6ZsFOb4j62C fwJbqF4vPY09CpWOk0eVY5oyQNUsNzIN65Rls9zKadr12JUxauuWd5CVhVxkamj1LBayCd 89cn5oUu64QlxWKfKFuXNzBt2aDVHbPPw/euH8XxU/s6PmOmTS2eAp6qvpVzrebBZNFyoR mcAXOVMGziZnSywEGnbN5vadIgwT9vUEF/u6F2EgddChtUbF/ztTbznPNY0NUFLHMRZj9W vJwX1xEhII7++fmQj90u6wuoqmZaU+eqgmvYhlyoDYP0VnoTjepWzxpVEpmJyA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=igPsSimu; 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=1700304130; a=rsa-sha256; cv=none; b=fSxWTmRridgzqIEeCyFO1nT6Wgz+XNdG7CXFxDt31kn7NFYff7bgBEQhjeUt6LocV6IGGD WfRtWHatIuR4rtEMze06rSOPibVora+B944o/Hd/MVz4pkFKnt5D0k7t2/XWDB4rV+iTfe LNJ5l09QIpKPrOihukN3nNMzXbR8q/mbLptna0SSdsQRBnMaZXDm8qEYDyWQuoULruwAZ5 sSlysn7g3zZqEFykogMUyHi+r51wxe8y3EqBB1oP3WyzMIpHu9miSP4gVUGdb+vjySxWaW NCZ4MYfd/nj6ma/1NlUgvr7t1a6rxFLqOcZklYT8fZrlweVyctE5M+JwwS9M+g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4IlN-0001U1-5t; Sat, 18 Nov 2023 05:41:21 -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 1r4IlL-0001Te-9q for emacs-orgmode@gnu.org; Sat, 18 Nov 2023 05:41:19 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4Il5-0001Nu-Jq for emacs-orgmode@gnu.org; Sat, 18 Nov 2023 05:41:19 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9CBF6240101 for ; Sat, 18 Nov 2023 11:41:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1700304060; bh=DoYP1KR0kh1DpcqXJxVid2vQNvlBxVGOTvIWdFwjmUA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=igPsSimuRVzx3g0L0j85cjm+nC0s0qQ6pbWl7CsPa/ifgoNtLDs48DT/GVaqGMuvu wESj+GD4bCW5aSQ5OD+M97fIkpkmBK0yWY1TZ/h+M5fXarDrC81lJ9F00fc8BV4PCz BZvOAxsDPrWC+akwVBa7uTsW8oUl59nsmvx1zAXT/AILYVb7NAoRL/7wv2pw+PUO1v CgRn42kLqp9Mcge80UppgaK0hTHKSn+SDaKDMXt+laNmEvEcmqhRws4jmdf4BJLvsL gUFZb+b9aU3AFcPtIrVXdCkHn0NV/D/vcPjKVqYAOJ2Ii7eSUF+JiOiyRXfra3dGIf SYKw6UG1ox6zA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SXVfz6XHWz6v0P; Sat, 18 Nov 2023 11:40:59 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: bash source code block: problem after ssh commands In-Reply-To: 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> Date: Sat, 18 Nov 2023 10:43:27 +0000 Message-ID: <87v89z1gvk.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de 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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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: -8.82 X-Spam-Score: -8.82 X-Migadu-Queue-Id: 7DF2B34746 X-Migadu-Scanner: mx10.migadu.com X-TUID: kENd6By8h1iq Max Nikulin writes: > ... > I have not expected this difference. > > dash reads a block from stdin (whole file in this case) and interprets > commands. > > BASH reads just the ssh command and executes it. SSH reads "echo done" > from stdin, so when control is returned to bash, stdin is exhausted and > no commands remain to execute by BASH. SSH can not "unread" part of > input not consumed by the remote command despite it might be possible in > the case of the regular file as stdin. > > Actually bash reads the whole script file as well when called as it is > shown above, but it calls lseek before executing ssh. To make difference > more apparent (e.g. for strace), force creation of pipe(7) for which > lseek is not supported > ... > I do not think it is an Org or an Emacs bug. It is rather POSIX vs. bash > vs. dash issue. I still see it as a bug - what Org mode does to run the shell blocks is not what users expect. _By default_, we _should_ produce more expected behavior. The observed inconsistency between different shells just indicates that our approach with `process-file' should not be used as it leads to potentially confusing results (they are not confusing only to people who dig deeply into ssh, bash/dash/etc, and Org mode internals). I cannot find any clear motivation behind using `process-file' + INFILE in the git logs. I assume that it was used simply because it is easier compared to trying to create and run temporary script file on remote hosts. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at