Having recently discovered reptyr, my first action was to do everything I could to break it. This included reptyring screen into a screen session as follows:

$ screen
My zshrc cats some stuff here.
$ reptyr $(pgrep screen)

I thought that this would fail either gracefully or badly, but the failure had some interesting side effects:

zsh: suspended  screen
Unable to attach to pid 24799: Operation not permitted
The kernel denied permission while attaching. If your uid matches
the target's, check the value of /proc/sys/kernel/yama/ptrace_scope.
For more information, see /etc/sysctl.d/10-ptrace.conf
$ jobs
zsh: command not found: jos
$ jobs
zsh: command not found: obs
$ jobs
[1]  + running screen
$ exit

My input is thoroughly garbled here, I'm not really sure what's going on with that process, and the exit command doesn't warn me about any jobs. What is the explanation for this?

  • This also creates an orphaned SCREEN process owned by root. – astex Sep 2 '14 at 15:08
  • 3
    +1 for actively trying to break things to see what happens. :) – peterph Sep 2 '14 at 15:27
  • For some reason there wasn't a "don't try this at home" tag. – astex Sep 2 '14 at 17:09
  • So if I try it at work, it's OK? ;-) – celtschk Sep 2 '14 at 17:47
  • Actually, it is a good question of how exactly it goes wrong. My gut feeling is that you created some race condition which caused some of the input getting "lost in the pty" or, more precisely, being delivered somewhere, where it wasn't visibly acted upon. But that's just hand-waving. – peterph Sep 2 '14 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.