From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id OFscKCEDd2P6xAAAbAwnHQ (envelope-from ) for ; Fri, 18 Nov 2022 04:59:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GID0JyEDd2MaEwEAauVa8A (envelope-from ) for ; Fri, 18 Nov 2022 04:59:29 +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 1C5041D62F for ; Fri, 18 Nov 2022 04:59:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovsWT-0002DS-6c; Thu, 17 Nov 2022 22:58:37 -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 1ovic7-00068s-Sm for emacs-orgmode@gnu.org; Thu, 17 Nov 2022 12:23:47 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovic5-0005pH-U7 for emacs-orgmode@gnu.org; Thu, 17 Nov 2022 12:23:47 -0500 Received: by mail-lf1-x12b.google.com with SMTP id g7so3915684lfv.5 for ; Thu, 17 Nov 2022 09:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sig-gis-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=JiGBr0l0HBWPlTl8XHJTxXfWffQtC6R26h+3S4W3V2A=; b=znlKLTJi8Q51haXIqa8fdyGZjtQt2nT1MFpPNRzVGSJo2jKCJwQ3e28mwN74JmfGIm SPeDg2AR8em1WOpNNIfnv1cx+Qn1FO+Fm8H/aQ23mAL3a+ktHiLMfTGRxtdzKbAndp89 iIPjWfWQQMGMvv36g57klSs1pKBZ6aImy8gYkcVw5mX0D+lInR0yFQV46RCkmUlUtYYB gFrUuOBMf2s9uN9xDfAEqRec7Qzx4YFUgkFdI2U7lWFeF25uNcQNkVODvHERq7avihkG o/R+UtU7n8rcviNKVnc5sd/QYspKvQwPu2FggTuSe2yh3oRa3HBFP3q6Y1pYrSz/kYeh P2YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JiGBr0l0HBWPlTl8XHJTxXfWffQtC6R26h+3S4W3V2A=; b=ol3csk153mvo5WNlVmqubBfM/q9f0MI5ugnywJw50jwoWJhtyxw1zJiZQ2JX6D7TiL KSYYlXB6RZjW9MgE/c8deWkyXTYJlcGvGSAy8/gHj1CDfSdMti7BDaC8klOyaN8cBPsP zKXcjldPB3abBO9LTJLJauR2S/J73YFjJZrCUDKYPNBDozY3/0fasli00z4bITkmsJOc u+RNhFJE0PddHurLUOYtXP6h5hxzQIMxhczHp43UgXeyK9x0w9gXO5I+KUC9a4Sz7eyb gmRpVHYYwFhwLnNoXPJs4l/7nR58xqnTY8hpNqmIDguuAqlyeEmCyNScYc9zsVUWljqg bkfw== X-Gm-Message-State: ANoB5pnRPi4pTkHpz6qshxxdhoKVmiHKZ2JCEzLFvIFAGANMzlVZWs6a z+hDjxQpbtxVDWxD2d9pit9DVJnRLVctdekS+IgxqX4GvAxx X-Google-Smtp-Source: AA0mqf6Tk5YrjUZ24lF2B51JpSaUWdpAqdoZq/wU1xIgb0Jt+KaYxYX3ECjDnanr1LGrCwNKu/gYpbpcowj7l1CsAUo= X-Received: by 2002:a05:6512:1085:b0:4ae:cc0f:4d73 with SMTP id j5-20020a056512108500b004aecc0f4d73mr1389605lfg.436.1668705822940; Thu, 17 Nov 2022 09:23:42 -0800 (PST) MIME-Version: 1.0 From: Alice Liquori Date: Thu, 17 Nov 2022 12:23:32 -0500 Message-ID: Subject: Bash blocks with :session pollute results with 'org_babel_sh_prompt>' To: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000cfbc5c05edadd95a" Received-SPF: none client-ip=2a00:1450:4864:20::12b; envelope-from=aliquori@sig-gis.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 17 Nov 2022 22:58:33 -0500 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668743969; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JiGBr0l0HBWPlTl8XHJTxXfWffQtC6R26h+3S4W3V2A=; b=VwY/xN3V6nQEzZQWJLbGeMJz/ziVZMRz7d483ce7fGW2Ozt319N0m3xSbFvOQQMEk0tfGg hTF8TCgTFLAZekm6eU+fmU4s9cc7sm91VeoxO2DE57IX7wMSFKv+wsTHdOFsETzysOrnWO wxbZsGnjnx+H592m/Aq/RwFX6PRz5mQyr9OWwXSpsS5SvArhGP3zLQzBZWxiFWdxsi2WwX dNUXpO6HDfXxEU0xUzZYg3e0dWIn4jxZNYY1OaP3LUvMxRCGC1/d2uk0W/0lies1wE1srs KmWWDGxRutAybsxYRdsEyrX/irxxBbsXg0NrfIIKrKAEuhF1XWc4l4a3OARj8A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668743969; a=rsa-sha256; cv=none; b=pw0rgI1J8NWVBHjwYrVfXgWwtavoMxs4pvbmlvB0/yPeByD+LEtZ1EuQpF3cUzxgHm0CxP QR6GYa0RKm3Z4BmvbkX1ddaavP01YZoVmL7k65ZNvhnIn9cHcNNdW6Qo/BnSBBnfLb3F80 XSnSxpEo8jETMJfHtL8X7L55dw8IqybK2At/DOGEnq1G2193RNp5e3lNXZpy1S9oENCWwU a6gFdkGxjFDBPgdGTlTvx0azcN6rkIcCD9o1JT9Pio7YMqLh7yuRswt8FIFsePn/K5vPuT katz/Aq9qg9D+cjcIR8+1eFza64fPTsOd2NZF8alPPibQvFrT4BYc0K3NDWpSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=sig-gis-com.20210112.gappssmtp.com header.s=20210112 header.b=znlKLTJi; dmarc=none; 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" X-Migadu-Spam-Score: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=sig-gis-com.20210112.gappssmtp.com header.s=20210112 header.b=znlKLTJi; dmarc=none; 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" X-Migadu-Queue-Id: 1C5041D62F X-Spam-Score: -2.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: W1XeboI5ekVk --000000000000cfbc5c05edadd95a Content-Type: text/plain; charset="UTF-8" I ran into an issue with bash blocks that use a session where 'org_babel_sh_prompt> ' is strewn throughout the output. For large blocks the intended output can be completely buried. Here is an example. #+begin_src bash :session test :results output echo "hello" #+end_src #+RESULTS: : org_babel_sh_prompt> org_babel_sh_prompt> org_babel_sh_prompt> org_babel_sh_prompt> hello This is caused by a leading carat in the `comint-prompt-regexp` regex in `org-babel-sh-initiate-session` in `ob-shell.el`, and the fix is incredibly simple. Here is the diff that I've generated. --- ob-shell-old.el 2022-11-15 14:29:34.351598206 -0500 +++ ob-shell-new.el 2022-11-15 14:31:28.416924869 -0500 @@ -255,8 +255,7 @@ (current-buffer) (format org-babel-prompt-command org-babel-sh-prompt)) (setq-local comint-prompt-regexp - (concat "^" (regexp-quote org-babel-sh-prompt) - " *")) + (concat (regexp-quote org-babel-sh-prompt) " *")) ;; Needed for Emacs 23 since the marker is initially ;; undefined and the filter functions try to use it without ;; checking. This is my first OSS contribution, I initially reported this to the main emacs bug report email using their guidelines. If I need to alter this in any way, let me know and I am willing to make changes. --000000000000cfbc5c05edadd95a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I ran into an issue with bash blocks that use a sessi= on where=20 'org_babel_sh_prompt> ' is strewn throughout the output. For lar= ge=20 blocks the intended output can be completely buried. Here is an example.
#+begin_src bash :session test :results output
echo "= hello"
#+end_src

#+RESULTS:
: org_babel_sh_prompt>= ; org_babel_sh_prompt> org_babel_sh_prompt> org_babel_sh_prompt> h= ello

This is caused by a leading carat in the `com= int-prompt-regexp` regex in `org-babel-sh-initiate-session` in `ob-shell.el= `, and the fix is incredibly simple.

Here is the d= iff that I've generated.

--- ob-shell-old.el 2022-11-15 1= 4:29:34.351598206 -0500
+++ ob-shell-new.el 2022-11-15 14:31:28.41692486= 9 -0500
@@ -255,8 +255,7 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 (current-buffer)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (format org-babel-prompt-command org-babel-sh-prompt))
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local comint-prompt-regexp
- = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(concat "^" (regexp-quote org-babel-sh-prompt)
- =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" *"))
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat (= regexp-quote org-babel-sh-prompt) " *"))
=C2=A0 =C2=A0 =C2=A0= ;; Needed for Emacs 23 since the marker is initially
=C2=A0 =C2=A0 =C2= =A0;; undefined and the filter functions try to use it without
=C2=A0 = =C2=A0 =C2=A0;; checking.

This is my first OSS con= tribution, I initially reported this to the main emacs bug report email usi= ng their guidelines. If I need to alter this in any way, let me know and I = am willing to make changes.
--000000000000cfbc5c05edadd95a--