From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yNLqGqyUbWbcmgAAe85BDQ:P1 (envelope-from ) for ; Sat, 15 Jun 2024 13:18:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id yNLqGqyUbWbcmgAAe85BDQ (envelope-from ) for ; Sat, 15 Jun 2024 15:18:36 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=j+1X1ST6; 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=1718457516; 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=ISZwhydR6Jcbl7gjcW56UWehqsXIMD0sr9xE7VEl7ds=; b=Cm0j7FYzp62MSC7Zrik2ovB0hE+amB2oDmnHXMblJrqhzPzQaZYUfFoQYrtqs1Y06tmOf8 XRRBvUbL5uwjhIYXnacbFKy67FgRs4JYXxS8fxubmaxnnxLO+xiGp3dVtbd9F0P+03DevW jNJBIpvkWtd2HrAaMW/dwqgjbmwWbpSou7gRshb2vF/fnqOF7fWU194mYSUdDxP75II4CX /QRotZ/CXhkEiMngu0nJ3pdyn7G39wVsFkGArSt9Neu2voieAsGQYEDhCj/XW3i9dZ7946 1D590fFFVorRBp1DhhaiRiHfh1qmC4LuPKCjdKgfpU2mFqsXF4hlR8N8X+cX2g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=j+1X1ST6; 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=1718457516; a=rsa-sha256; cv=none; b=m6Ba7GBQPyYnEyFJlNZ++5wbkQUt8dVupL4cJAEpTNkW+jxC+y+GKPcxts1QBT9PUbKtkx Ta0W8F4MgMJzjGtI8jkBeFzI9vjkQHLv9XED2zrJuFvi+TP+li4HUuw4oYLQfqSN+SelXF IX0dHgvKDJ3f0j6r/mSmjJ9ESyuou7U0Nwx+SWHblOyktjU2STiSYUTtQLIUgOhU1Go/L0 gRdb2Isy/Xyr+slJSaQtvkIKnEdZ1p1NCtf+F7AhoCJk3RTFazSTp7sT9O9yQVd6MHKySC Y4o6NvEDrt4Vy7/MMKKF03t1rloXwQxdbVGoQZ5sTWJbHjx0KISxR72/fDu2hA== 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 3AA0862BDB for ; Sat, 15 Jun 2024 15:18:36 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sITHx-0001ZR-UC; Sat, 15 Jun 2024 09:17:49 -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 1sITHt-0001YR-Cq for emacs-orgmode@gnu.org; Sat, 15 Jun 2024 09:17:46 -0400 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 1sITHr-0001ju-Ka for emacs-orgmode@gnu.org; Sat, 15 Jun 2024 09:17:45 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4278C240101 for ; Sat, 15 Jun 2024 15:17:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1718457461; bh=cBEoRH9cVaR4LI2J6UZ6jlsnOXO7WdPQxv8rMKWsXEI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=j+1X1ST6aibH+Ou7exy+DhwW2T7BC+URj2d2/bV82+z/Ey8pU9Q5RvkPxjCdXHbbi dyjBKeuF6ItRYHhBnz95b28/gVlqcqVzPTVqFS1t8qGnHluRhrHTHyrrVzGqER3MHW weVxsdOe77kSYLYVoeiN7OSA5zD6DJQoG27E1wR3HHjnjIDFFBeMTDiLIRwnUURi6P c1BcmEJn1yNSKMOnnqe2vpe4OxHl1F4aQiK0A2X8cmktttySmQgwKa323IzVNzejJq IJ7B4GY1gRnnxk95uSzHKVp6EK1teGuq+ToP+slapIZZF+aagAaX/qrKDWyqtYRJsE ZRFl+S9GKQqUw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4W1cBr3Sjdz9rxB; Sat, 15 Jun 2024 15:17:40 +0200 (CEST) From: Ihor Radchenko To: "Cook, Malcolm" , Matthew Trzcinski Cc: Org-mode Subject: RE: org-babel-execute-src-block filters characters from :session *shell* output In-Reply-To: References: <87ikybk44c.fsf@localhost> Date: Sat, 15 Jun 2024 13:19:23 +0000 Message-ID: <87o782gx7o.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: -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_H3=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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.57 X-Spam-Score: -9.57 X-Migadu-Queue-Id: 3AA0862BDB X-Migadu-Scanner: mx13.migadu.com X-TUID: bDxjFiMmowqK "Cook, Malcolm" writes: >>> #+begin_src sh >>> printf 'a\nb\nc\n>d\n>> #+end_src >>> >>> #+RESULTS: >>> : a >>> : b >>> : c >>> : d >>> : >> >>> Huh? what happened to the ">" before the "d"? >> >>I cannot reproduce. >>May it be that you are setting global :session header argument? > > Yes, of course, so sorry, there is > > #+PROPERTY: header-args:sh :session *shell* :results output > > You should now be able to reproduce. > > Thanks, please let me know if you have a fix, workaround, or lesson for me. In theory, we may provide a workaround for this kind of problem. But it would have pros and cons. The underlying cause is limitation of Emacs API for interactive shells - we cannot easily distinguish command output from prompt and other extra staff your shell/other interactive command spits into the buffer. So, we have to either filter output the prompts ourselves to get the command output reliably or redirect output to files, where nothing litters the actual output with prompts. Redirecting output works fine when we do not use sessions and do not care what is displayed in the *shell* buffer for users. For sessions, we use more complex approach - filter out anything that looks like prompt. The problem with bash is that prompt is ">", and, as you showed in your example, having ">" in the commands output breaks everything. Again, we know this problem, and we normally force the prompt to be something more unique when creating sessions. But we do not touch the prompt when you point Org to an existing interactive shell buffer - that could be a surprise if Org mode changes the prompts by force in the shells you use interactively. TL;DR: It is complicated. When we pull one string out, several more get entangled. As a practical workaround, just do not use *shell* session names and session names that are the same as shell buffers you create manually. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at