Subject: bug#39075: 28.0.50; Emacs hangs on 100% CPU and grows beyond bounds in shell-mode

From: Eli Zaretskii <[email-masked]>
Date: Sun, 12 Jan 2020 19:43:18 +0200

> From: Pieter van Oostrum <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 12 Jan 2020 18:11:22 +0100
> 
> I ran it under gdb, and interrupted it several times with C-z in gdb. Most of the stack traces were in the garbage collector, suggesting that it is collecting like crazy. This doesn't surprise me, as it is constantly allocating new memory. The rest of this stack trace doesn't have useful information.
> 
> I managed to get a stack trace where it is processing. I haven't analysed these yet, but I include both here.

Thanks, this was very useful.  It turns out to reproduce one must do
this at the shell's prompt, after "M-x shell":

  $ cd /some/directory/;

The /some/directory/ part should be a real directory.  Once one types
the semi-colon, Emacs hangs.  Here's the Lisp backtrace:

  "Automatic GC" (0x0)
  "looking-at" (0x766f5fc8)
  "shell--parse-pcomplete-arguments" (0x766f64f8)
  "pcomplete-parse-arguments" (0x766f6a90)
  "pcomplete-completions" (0x766f6f60)
  "pcomplete-completions-at-point" (0x766f7698)
  "run-hook-with-args-until-success" (0x766f7690)
  "comint-completion-at-point" (0x766f7b10)
  0x317f7b0 PVEC_COMPILED
  "completion-in-region--postch" (0x766f8450)

So I think shell--parse-pcomplete-arguments infloops in this case.