Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: clipetty--emit: Opening output file: Permission denied, /dev/pts/3 #20

Open
whjiang opened this issue Apr 9, 2020 · 8 comments · May be fixed by #22
Open

[BUG]: clipetty--emit: Opening output file: Permission denied, /dev/pts/3 #20

whjiang opened this issue Apr 9, 2020 · 8 comments · May be fixed by #22
Assignees
Labels
bug Something isn't working

Comments

@whjiang
Copy link

whjiang commented Apr 9, 2020

Describe the bug
I'm using the newest Doom Emacs with clipetty enabled in a ssh terminal. The client is ITerm2 on Mac and the target ssh machine is a linux docker. And I use dtach for nohup.
When performing delete/copy, I got clipetty--emit: Opening output file: Permission denied, /dev/pts/3.

To Reproduce
Steps to reproduce the behavior:

  1. from MAC ITerm2, ssh to linux docker.
  2. start emacs with dtach -A /tmp/emacs emacs.
  3. make some copy & paste under evil mode.

Expected behavior
no error report.

** System Info (please complete the following information):**

  • OS: Linux, macOS
  • Emacs Version 26.3
  • Terminal program iTerm2
  • Any terminal multiplexers in play dtach
  • Local or remote (over SSH) ssh

Additional context
Add any other context about the problem here.

@spudlyo
Copy link
Owner

spudlyo commented Apr 11, 2020

I think what's happening here is that you have a stale SSH_TTY environment variable. At one point when you were running Emacs under dtach your SSH_TTY was set to /dev/pts/3. At some point in the future, you reconnected using dtach -A on a different tty, but the environment variable in Emacs still pointed to the old tty.

Try starting Emacs like this instead: unset SSH_TTY; dtach -A /tmp/emacs emacs

Since you're not using a multiplexer like Tmux or Screen that intercepts OSC 52 escape sequences, this should just work for you.

@spudlyo spudlyo added the bug Something isn't working label Apr 15, 2020
@spudlyo
Copy link
Owner

spudlyo commented Apr 15, 2020

This seems to happen with some regularity. I should handle this condition in the code, and if I can't write to the SSH_TTY for some reason I should write to stdout as a fallback.

shka added a commit to shka/clipetty that referenced this issue May 21, 2020
@shka shka linked a pull request May 21, 2020 that will close this issue
@hartikainen
Copy link

hartikainen commented May 27, 2020

I'm regularly seeing this same issue on Ubuntu with tmux + emacs 26 + clipetty. Happy to provide any diagnostics if those would be of any help.

unset SSH_TTY seems to solve the immediate issue for me.

@Mic92
Copy link

Mic92 commented Jul 17, 2020

I am seeing this in combination with mosh. I suppose that SSH_TTY gets stale and mosh does not provide the correct value.

@spudlyo
Copy link
Owner

spudlyo commented Jan 10, 2021

This issue is definitely related to relying on SSH_TTY to stop tmux from grabbing the OSC-52 escape sequence and not passing it on. The good news is that there is another way preventing tmux from doing this that involves adding the correct terminfo capabilities via the tmux terminal-overrides option.

I believe that Clipetty can be reworked to do this rather than messing with SSH_TTY which should stop this issue from cropping up, as well as enable Mosh support in #9.

@pyloolex
Copy link

It happens to me too. Very often, actually.
I use Iterm2 + tmux + Emacs + clipetty.

@z3t0
Copy link

z3t0 commented Feb 18, 2024

What would a fix for this look like? I can put in the time to implement and submit a patch, just need a little guidance.

@sashkachan
Copy link

This happens when using kitty terminal, specifically - kitty ssh <host>. This command enables some extra integration between kitty terminal and the host. I don't use tmux or any other multiplexer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants