From: Felipe Contreras <felipe.contreras@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Weird bug / missing feature with gvim interaction
Date: Sun, 5 Mar 2023 19:32:56 -0600 [thread overview]
Message-ID: <CAMP44s2C8mGy_dsni6hW+Cgu-78iBo3FfftNZ0YP_HqwvbOaUg@mail.gmail.com> (raw)
Hi,
I've been investigating for a while a weird interaction with vim and
zsh, and this is the closest I've gotten to narrowing down the
problem.
Essentially this doesn't work:
vim -g -c 'set shelltemp' -c ':!xdg-open "https://google.com"'
The reason it doesn't work is that xdg-open immediately spawns a fork,
which is why this doesn't work either:
vim -g -c 'set shelltemp' -c ':!touch /tmp/fork-cur &'
But that actually works in bash.
The two key lines of code from vim are:
setsid();
ioctl(slave, TIOCSCTTY, NULL);
If I remove those, the code works fine, but then it doesn't work with sudo:
vim -g -c 'set shelltemp' -c ':!sudo touch /tmp/sudo &'
But it does with bash.
It is a bit overwhelming, since there are many combinations:
{bash,zsh}{sudo,fork}{sid,}
But long story short, there's a combination that works with bash, but
there isn't a single one that works with zsh.
I wrote a program to be able to test this behavior outside of vim, and
I can reproduce the problem [1].
The two combinations that don't work with zsh are:
1. sudo without setsid (the program cannot feed input into sudo)
2. fork with setsid (the grandchilds are sent SIGHUP)
This is beyond my expertise, but I've tried my best to narrow down the problem.
Is there any way to solve this in zsh?
Cheers.
[1] https://gist.githubusercontent.com/felipec/8a820f3dbf67a5861491553e211400fb/raw/e7f537c0b5b5f4d742f90cfac5f7f046ea61d438/pty-test.c
--
Felipe Contreras
next reply other threads:[~2023-03-06 1:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 1:32 Felipe Contreras [this message]
2023-03-06 4:28 ` Bart Schaefer
2023-03-06 4:32 ` Bart Schaefer
2023-03-06 14:31 ` Felipe Contreras
2023-03-06 19:35 ` Bart Schaefer
2023-03-06 19:47 ` Felipe Contreras
2023-03-06 15:14 ` lilydjwg
2023-03-06 15:54 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP44s2C8mGy_dsni6hW+Cgu-78iBo3FfftNZ0YP_HqwvbOaUg@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).