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

ls .** killed fish #7226

dontdieych opened this issue Jul 26, 2020 · 5 comments

ls .** killed fish #7226

dontdieych opened this issue Jul 26, 2020 · 5 comments


Copy link

dontdieych commented Jul 26, 2020

fish, version 3.1.2
Linux a 5.7.9-1-MANJARO #1 SMP PREEMPT Thu Jul 16 08:20:05 UTC 2020 x86_64 GNU/Linux

I was trying to find some file type(zip) recursively. While wondering about **/*.zip would work for hidden files. Tried ls .\**.

Then crashed.

$ ls .**

Warning: Program '/usr/bin/fish' crashed. # <- it might be from konsole.

journal log

What is recommend way in this case? Using find? or ...?


Copy link

mqudsi commented Jul 26, 2020

It's an out-of-memory crash.

Simply globbing .** shouldn't be allocating this much memory (I'm presuming you were in /?), so my guess is that it has to do with trying to pass them as arguments.

You are executing ls with each file fish finds as an argument, not passing * to ls (which doesn't support that concept). On Windows, dir * or dir *.exe does exactly what you are doing, and it's a common mistake for people on Linux to make.

If you want to use fish to list files, you can use printf '%s\n' .** (or whatever pattern you want), you don't need ls in there at all.

That doesn't explain the crash though, of course. Either it was an extremely memory constrained environment or there's some recursion here that fish isn't handling.

Copy link

I've tried that in ~/ . It's ok in /tmp. It looks like I tried globbing on too much files.

Copy link

zanchey commented Jul 26, 2020

Heh. My dotdirs contain a symlink to the root of our fileserver, so my fish instance is currently at a resident set size of 1.4 GB and growing... 24 GB of RAM on this server so I might be alright, but maybe fish should stop expanding wildcards once it hits ARG_MAX?

@zanchey zanchey added this to the fish-future milestone Jul 26, 2020
Copy link

krobelus commented Jul 26, 2020

Using find is a good idea here.

The log says anon-rss:6420136kB, so fish used around 6GB.
Hence the crash would probably also happen with printf .** (or even true .**).

A rough estimate is that for a million files, fish will need around one GB.

maybe fish should stop expanding wildcards once it hits ARG_MAX?

$fish_read_limit (default 100MB) is probably a reasonable limit here

Copy link

I added a limit on all expansions (including globs and variables) of 512k.

zanchey added a commit that referenced this issue Jan 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

No branches or pull requests

5 participants