Subject: 28.0.50; process-send-string broken on osx

From: Daniel Sutton <[email-masked]>
Date: Sat, 29 Aug 2020 00:26:35 -0500

I'm diagnosing some issues with inf-clojure which is based on comint
mode. When sending clojure forms with long docstrings, the repl would
would output "^G^G^G..." quite a bit and become unresponsive. This
problem is seemingly only present on OSX. I've tracked down the smallest
reproduction to be the following:

```
(let ((process (start-process "testing" "*process-output*" nil)))
  (process-send-string process

"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii")
  (stop-process process))
```

This prints out "^G^G ..." (repeated many times) in *process-output* on
OSX and prints the expected multiple "i"s on GNU/linux. A
similar interesting example of buggy behavior is

```
(let ((process (start-process "testing" "*process-output*" nil)))
  (process-send-string process
                       "hi")
  (stop-process process))
```

On OSX this leaves the buffer empty while on GNU/Linux this prints the
expected "hi". This bug seemingly affects all users of comint on OSX due
to its usage of process-send-string. One can demonstrate this by trying
to evaluate the preceding "iiii..." string in a scheme buffer (for
example `(run-scheme "chez")`. This is also demonstrated by trying to
evaluate a form like `(+ 1 1 1 ...)` which is sufficiently long.

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60
Version 10.15.6 (Build 19G73))
of 2020-08-11 built on dan-mbp.local
Repository revision: 0d0aad213f941efc0fa0ec032e37dc9c2b08c9fb
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.6

Recent messages:
Checking 57 files in /Users/dan/projects/emacs/lisp/eshell...
Checking 71 files in /Users/dan/projects/emacs/lisp/erc...
Checking 34 files in /Users/dan/projects/emacs/lisp/emulation...
Checking 182 files in /Users/dan/projects/emacs/lisp/emacs-lisp...
Checking 24 files in /Users/dan/projects/emacs/lisp/cedet...
Checking 59 files in /Users/dan/projects/emacs/lisp/calendar...
Checking 87 files in /Users/dan/projects/emacs/lisp/calc...
Checking 107 files in /Users/dan/projects/emacs/lisp/obsolete...
Checking for load-path shadows...done
Mark set

Configured features:
JPEG TIFF GIF PNG RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Message

Minor modes in effect:
  recentf-mode: t
  global-magit-file-mode: t
  magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  mml-mode: t
  async-bytecomp-package-mode: t
  projectile-mode: t
  shell-dirtrack-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  ivy-rich-mode: t
  ivy-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  delete-selection-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  global-company-mode: t
  company-mode: t
  which-key-mode: t
  minions-mode: t
  pixel-scroll-mode: t
  save-place-mode: t
  winner-mode: t
  show-paren-mode: t
  global-auto-revert-mode: t
  auto-compile-on-load-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
~/projects/dev/clojure-mode/clojure-mode hides
/Users/dan/.emacs.d/elpa/clojure-mode-20200419.559/clojure-mode

Features:
(shadow sort mail-extr emacsbug sendmail novice cl-print apropos tabify
eieio-opt speedbar ezimage dframe recentf tree-widget magit-bookmark
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode magit-core magit-autorevert magit-margin magit-transient
magit-process magit-mode git-commit transient magit-git magit-section
magit-utils crm log-edit message rfc822 mml mml-sec epa epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log with-editor
async-bytecomp async loccur cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs bug-reference help-fns
radix-tree crux vc-git diff-mode all-the-icons-dired smart-mode-line
rich-minority projectile grep ibuf-ext ibuffer ibuffer-loaddefs
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb exec-path-from-shell ediprolog
haskell-mode haskell-cabal haskell-utils haskell-font-lock
haskell-indentation haskell-string haskell-sort-imports haskell-lexeme
haskell-align-imports haskell-complete-module haskell-ghc-support
flymake-proc flymake dabbrev haskell-customize cider tramp-sh
cider-debug cider-browse-ns cider-mode cider-inspector cider-completion
cider-profile cider-eval cider-repl-history pulse cider-repl
cider-resolve cider-test cider-overlays cider-stacktrace cider-doc
cider-browse-spec cider-clojuredocs cider-eldoc cider-client
cider-common etags fileloop cider-connection cider-util cider-popup
sesman-browser nrepl-client tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell parse-time iso8601 ls-lisp
nrepl-dict cider-compat inf-clojure thingatpt assess m-buffer
m-buffer-at m-buffer-macro clojure-mode derived align imenu
flycheck-clj-kondo buttercup warnings ert ewoc debug backtrace
buttercup-compat sesman vc vc-dispatcher spinner queue pkg-info url-http
url url-proxy url-privacy url-expand url-methods url-history mailcap
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-cookie url-domsuf url-util url-gw nsm rmc puny lisp-mnt
epl parseedn parseclj-parser parseclj-lex a yasnippet fish-mode flycheck
rainbow-delimiters paredit counsel xdg xref project swiper ivy-rich ivy
ivy-faces ivy-overlay colir pcre2el rxt re-builder rx htmlize ox-reveal
cl ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn
nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar
ox-html table ox-ascii ox-publish ox org-element avl-tree generator
org-tempo org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete org-list
org-faces org-entities time-date noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs tempo pdf-tools
compile comint ansi-color pdf-view bookmark text-property-search pp
jka-compr pdf-cache pdf-info tq pdf-util format-spec image-mode dired
dired-loaddefs exif undo-tree diff browse-kill-ring delsel all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons memoize company-quickhelp
pos-tip company pcase hydra lv diminish which-key brin-theme
gruvbox-theme gruvbox sublime-themes kaolin-themes kaolin-themes-lib
autothemer dash solarized-theme solarized solarized-faces color hl-line
moody minions pixel-scroll advice saveplace winner ring paren autorevert
filenotify edmacro kmacro resize-window cl-extra help-mode server
auto-compile packed use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf cus-edit cus-start cus-load wid-edit info
package easymenu browse-url url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
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 elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu 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 charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 781232 166059)
(symbols 48 49330 50)
(strings 32 223936 15043)
(string-bytes 1 6578514)
(vectors 16 79064)
(vector-slots 8 1690412 127179)
(floats 8 1118 737)
(intervals 56 28290 2564)
(buffers 992 34))