[vim/vim] Expanding wildcards in directories with several self-referential linksHangs when expanding wildcard in directory with several (Issue #10946)

3 views
Skip to first unread message

Henry Heino

unread,
Aug 20, 2022, 8:07:52 AM8/20/22
to vim/vim, Subscribed

Steps to reproduce

  1. In a UNIX shell, create a directory with several self-referential links:
$ mkdir foo
$ cd foo
$ ln -s ./ link1
$ ln -s ./ link2
$ ln -s ./ link3
$ ln -s ./ link4
$ ln -s ./ link5
$ ls
link1  link2  link3  link4  link5
  1. Open vim in that directory:
$ vim
  1. Expand **:
:echom expand('**')
  1. Press enter

Expected behaviour

  • Vim should expand the wildcard within a reasonable amount of time.
  • Vim should stop attempting to expand the wildcards when I press Ctrl+C.
  • Vim should stop attempting to expand the wildcards when I close the terminal tab in GNOME terminal
    • After closing all instances of vim (force-closing by closing the tab in GNOME terminal), I still see instances of vim running in gnome-system-monitor:

Version of Vim

8.2.3995

Environment

Operating system: PoP OS 22.04 LTS
Terminal: GNOME terminal
Value of $TERM: xterm-256color
Shell: bash

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10946@github.com>

Bram Moolenaar

unread,
Aug 20, 2022, 2:25:11 PM8/20/22
to vim/vim, Subscribed


> ### Steps to reproduce
>
> 1. In a UNIX shell, create a directory with several self-referential links:

> ```
> $ mkdir foo
> $ cd foo
> $ ln -s ./ link1
> $ ln -s ./ link2
> $ ln -s ./ link3
> $ ln -s ./ link4
> $ ln -s ./ link5
> $ ls
> link1 link2 link3 link4 link5
> ```
> 2. Open `vim` in that directory:
> ```
> $ vim
> ```
> 3. Expand `**`:
> ```vim
> :echom expand('**')
> ```
> 4. Press enter

And it hangs. The problem here is that it is very difficult that a
endless recursion exists. Well, with the example it would be obvious,
but the link could be several directory levels deep, pointing to the
top.

Instead of trying to prevent it, it should at least be possible to
interrupt. I can make CTRL-C get us out of the loops. Even that isn't
easy, after stopping to search for files the processing of the many
results also can take quite a bit of time, thus that also needs to be
interruptable.

--
There are three kinds of people: Those who can count & those who can't.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10946/1221381285@github.com>

Bram Moolenaar

unread,
Aug 20, 2022, 2:27:03 PM8/20/22
to vim/vim, Subscribed

Closed #10946 as completed via 57e9517.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10946/issue_event/7226635608@github.com>

Bram Moolenaar

unread,
Aug 20, 2022, 2:30:35 PM8/20/22
to vim...@googlegroups.com, Bram Moolenaar


I wrote:

> And it hangs. The problem here is that it is very difficult that a
> endless recursion exists.

I meant: "very difficult to detect that endless recursion exists".


--
Mental Floss prevents moral decay!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
Reply all
Reply to author
Forward
0 new messages