Gary Johnson wrote:

> Starting with 8.2.1833, the :sh command no longer works when vim is
> reading text from stdin.  The screen flashes, but nothing else
> happens.
> 
> To demonstrate this, execute the following:
> 
>     $ ls | vim -N -u NONE -
>     :sh
> 
> Using git bisect, I found the offending commit.
> 
>     $ git bisect bad
>     204ade6bcb85f48f56e52e040d1ebf40548d92be is the first bad commit
>     commit 204ade6bcb85f48f56e52e040d1ebf40548d92be
>     Author: Bram Moolenaar <[email protected]>
>     Date:   Sun Oct 11 14:58:46 2020 +0200
> 
>         patch 8.2.1833: when reading from stdin dup() is called twice
> 
>         Problem:    When reading from stdin dup() is called twice.
>         Solution:   Remove the dup() in main.c. (Ken Takata, closes #7110)
> 
>      src/main.c    | 15 +++++----------
>      src/version.c |  2 ++
>      2 files changed, 7 insertions(+), 10 deletions(-)
> 
> The operating system I'm using is Ubuntu 20.04.1 LTS.
> 
> 
> More information:
> 
> If before executing :sh, you set the 'shell' to /bin/cat, then
> executing :sh will cause cat to report the following error.
> 
>     /bin/cat: -: Bad file descriptor
>     /bin/cat: closing standard input: Bad file descriptor
> 
> This problem also occurs when one of vim's arguments is a bash
> process substitution.  That's been a problem for a while.
> 
> My workaround is to detect the problematic conditions and then set
> 'shell' to a script containing the following.
> 
>     #!/bin/bash
>     exec < /dev/tty
>     exec $SHELL "$@"

I can reproduce the problem.  I don't understand why it happens, the
close(0)/dup(2) in readfile() is executed.  Somehow it needs to be done
again.

I'll remove the patch for now.  Perhaps someone can debug why this is
needed.

-- 
It is illegal for anyone to give lighted cigars to dogs, cats, and other
domesticated animal kept as pets.
                [real standing law in Illinois, United States of America]

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012081836.0B8Iaq791704662%40masaka.moolenaar.net.

Raspunde prin e-mail lui