0

Anybody here use ChromeOS i.e., Chromebook?

Well I find that all I need to do in emacs is hold down C-k munching up line after line, for oh, 10 seconds, and voila, the entire mighty ChromeOS operating system can no longer access its disk anymore, and must wait for me to use shutdown(8) in that Linux container, whereupon suddenly all the browser windows come back to life and the File Manager app starts working again.

The problem is perhaps emacs is feeding too many snippets to ChromeOS's clipboard manager for it to deal with. You see with ESC w an entire region is just one copy. But with C-k, well you don't know when the user will send the next C-k, so some text is sent each time one presses it. (And each time it gets bigger of course.)

And the ChromeOS has a critical design flaw in that it cannot deal with such barrages and locks up until the entire Linux container sending such stuff dies.

So 1) how can I via .emacs get around this problem so I can eliminate my new C-k phobia? 2) How can I prove to the ChromeOS team that their entire OS is vulnerable?

Yes, one workaround is to always use emacs -nw, whereupon although the same copies occur, they are handled by non-emacs components that do not cause such problems.

1 Answer 1

1
  1. how can I via .emacs get around this problem so I can eliminate my new C-k phobia

Judging by you being okay with emacs -nw, you don't seem to be using the feature of killing operations sending data to the clipboard, which seems to be exactly the thing that causes ChromeOS to lock up. So what you can do is make Emacs behave like other editors in that regard and only keep the killed text in its internal kill-ring.

;; Don't overwrite clipboard content with deleted text
(setq select-enable-clipboard nil)

Looking at my config it seems that changing the behavior of select-enable-clipboard requires to also change the yank/copy functions, so here are ones I'm using:

(defun clipboard-yank-fixed ()
  "A version of clipboard-yank that pastes \"instead\" of selection if one
exists"
  (interactive)
  (when (use-region-p)
      (kill-region (region-beginning) (region-end)))
  (let ((select-enable-clipboard t))
    (clipboard-yank)))
(bind-key "C-y" 'clipboard-yank-fixed)

(defun clipboard-copy-fixed ()
  (interactive)
  (let ((select-enable-clipboard t))
    (clipboard-kill-ring-save (region-beginning) (region-end))))
(bind-key "M-w" 'clipboard-copy-fixed)

(I am using select-enable-clipboard equal to nil for a different reason though, for me it is simply annoying that any edits in Emacs result in clipboard content getting lost)

  1. How can I prove to the ChromeOS team that their entire OS is vulnerable?

Just write a simple testcase that involves launching emacs -Q, then pressing C-k to send stuff to the clipboard. You can automate it if you're good with coding, but I don't think it's strictly necessary in this case.

I don't see why anything else would be necessary, it's a huge problem if simply spamming the clipboard makes whole OS hang.

11
  • 1
    FTR, I tried to reproduce it with your config, but it has other deps, so it's not as trivial as just launching Emacs with it. You may need to reduce it to a config as minimal as possible if you want me to look at it.
    – Hi-Angel
    Commented Jul 17 at 20:38
  • 1
    Did you try removing (setq interprogram-cut-function 'wl-copy) line from the config? The problem isn't reproducible for me with your config, however when I hold C-k I see an error about missing wl-copy program appearing. I don't use Wayland (haven't found a comfortable environment yet, on X11 I'm a KDE + i3 user), so the program won't do anything for me anyway, but I would presume that your problem might be because of some interaction with this utility. Try commenting out the line and see if it changes anything in C-k behavior.
    – Hi-Angel
    Commented Jul 18 at 4:05
  • 1
    News flash: they can reproduce the bug issuetracker.google.com/issues/331051347 Commented Jul 19 at 7:07
  • 1
    Hey you were right about wl-copy. And now that the team is hot on the trail, it seems my life will be totally normal in about one week. Over and out, and double thanks! Commented Jul 19 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.