GNU bug report logs - #59289
Fix for clobbered output with bash sessions

Previous Next

Package: emacs;

Reported by: Alice Liquori <aliquori <at> sig-gis.com>

Date: Tue, 15 Nov 2022 21:24:02 UTC

Severity: normal

To reply to this bug, email your comments to 59289 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59289; Package emacs. (Tue, 15 Nov 2022 21:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alice Liquori <aliquori <at> sig-gis.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 15 Nov 2022 21:24:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alice Liquori <aliquori <at> sig-gis.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Fix for clobbered output with bash sessions
Date: Tue, 15 Nov 2022 14:38:54 -0500
[Message part 1 (text/plain, inline)]
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 and a space before an asterisk 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 tried to follow the guidelines on
sending patches. Let me know if there are any issues.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59289; Package emacs. (Wed, 16 Nov 2022 03:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 59289 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alice Liquori <aliquori <at> sig-gis.com>
Cc: 59289 <at> debbugs.gnu.org
Subject: Re: bug#59289: Fix for clobbered output with bash sessions
Date: Wed, 16 Nov 2022 05:30:43 +0200
> From: Alice Liquori <aliquori <at> sig-gis.com>
> Date: Tue, 15 Nov 2022 14:38:54 -0500
> 
> 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 and a space before an asterisk 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 tried to follow the guidelines on sending patches. Let me know if there are
> any issues.

Thanks, but I think this should be reported to the Org developers, not
here.




This bug report was last modified 1 year and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.