bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57658: 28.1; shell-mode corrupts yanked text with zshell


From: John Dunagan
Subject: bug#57658: 28.1; shell-mode corrupts yanked text with zshell
Date: Tue, 06 Sep 2022 15:15:41 -0700

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: 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
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: 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcurl
  -X POST httpxx-H 'x-api-key: MyApiKey'
-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: 
xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 
'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: 
xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 
'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: 
xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 
'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: 
xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 
'authorization: xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: 
xxxxxxxxxxxx-H 'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 
'authorization: xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: 
xxxxxx-H 'authorization: xxxxxxxxxxxx-H 'authorization: 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 
Version 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=/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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]