From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John Dunagan Newsgroups: gmane.emacs.bugs Subject: bug#57658: 28.1; shell-mode corrupts yanked text with zshell Date: Tue, 06 Sep 2022 15:15:41 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23729"; mail-complaints-to="usenet@ciao.gmane.io" To: 57658@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 08 04:10:55 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oW70I-0005wj-Ns for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Sep 2022 04:10:54 +0200 Original-Received: from localhost ([::1]:35538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oW70H-0005Q1-AM for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 22:10:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW6zU-0005PL-M3 for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 22:10:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oW6zT-0005Vn-Mm for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 22:10:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oW6zT-0000aj-He for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 22:10:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Dunagan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Sep 2022 02:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57658 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16626029652198 (code B ref -1); Thu, 08 Sep 2022 02:10:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Sep 2022 02:09:25 +0000 Original-Received: from localhost ([127.0.0.1]:56763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oW6yq-0000ZM-0E for submit@debbugs.gnu.org; Wed, 07 Sep 2022 22:09:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oW3H1-0000sj-5n for submit@debbugs.gnu.org; Wed, 07 Sep 2022 18:11:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW3H1-00008X-0p for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 18:11:55 -0400 Original-Received: from 52-119-126-75.public.monkeybrains.net ([52.119.126.75]:65447 helo=Johns-MacBook-Pro.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oW3Gy-00049k-Ri for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 18:11:54 -0400 Original-Received: by Johns-MacBook-Pro.local (Postfix, from userid 501) id 128E03B99968; Tue, 6 Sep 2022 15:15:42 -0700 (PDT) Received-SPF: none client-ip=52.119.126.75; envelope-from=dunagan@Johns-MacBook-Pro.local; helo=Johns-MacBook-Pro.local X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, KHOP_HELO_FCRDNS=0.001, NO_DNS_FOR_FROM=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_NONE=0.001, TVD_RCVD_IP=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 07 Sep 2022 22:09:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241811 Archived-At: This behavior occurs when yanking commands into a 'shell-mode' buffer. Could be MacOS specific, I'm not sure. RECIPE: 1. Start emacs with 'emacs -Q' 2. If necessary, set default shell to zsh (e.g. 'M-: (setq shell-file-name "/bin/zsh")') 3. Run 'M-x shell' 4. Copy following text to kill ring or to system clipboard: cat << EOF > sample_request curl -X POST https://example.api.com/page/another_page -H 'x-api-key: MyApiKey' -H 'authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxx' EOF 5. Yank the text into the shell prompt with 'C-y' or 'M-x clipboard-yank'. The text should appear normal at this point. 6. Run the command. 7. If command worked as expected, repeat steps 5 and 6. For me, the first time occasionally works but the second time never exits the heredoc 8. If the bug occurs, you might need to send "EOF" manually to exit the heredoc. 9. Examine the contents of 'sample_request'. Mine is corrupted like this: curl -X POST https://example.api.com/page/another_page -H 'x-api-key: MyApiKey' -H 'authorization: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxxxxxxxxxxcurl -X POST httpxx-H 'x-api-key: MyApiKey' -H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: = xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'aut= horization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-= H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: x= xxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'auth= orization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H= 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xx= xxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'autho= rization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H = 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxx= xxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'author= ization: xxxxxx-H 'authorization: ADDITIONAL NOTES: - Manually entering this command or yanking line-by-line works fine - This command works fine with 'sh'. I run into a different problem doing this with 'bash' but I haven't had time to test it thoroughly. - I don't think the problem is specific to using a heredoc. I found this bug when a CURL request worked in my terminal emulator but failed in Emacs. Wrapping the curl in a heredoc and catting to a file was just to examine what command was really being run. - Even if the command works the first time, repeating it with 'M-p' (i.e. 'M-x comint-previous-input') fails for me. In GNU Emacs 28.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Ve= rsion 10.14.6 (Build 18G95)) of 2022-05-11 built on builder10-14.lan Windowing system distributor 'Apple', version 10.3.2022 System Description: macOS 11.5.2 Configured using: 'configure --with-ns '--enable-locallisppath=3D/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS TOOLKIT_SCROLL_BARS ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Shell Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils repeat shell pcomplete comint ansi-color ring edmacro kmacro cl-loaddefs cl-lib chemacs iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 76827 6839) (symbols 48 7227 1) (strings 32 25520 1946) (string-bytes 1 803720) (vectors 16 14164) (vector-slots 8 197386 8759) (floats 8 22 41) (intervals 56 4849 0) (buffers 992 13))