Increase default read limit to 1GiB

The current limit can be reached in actual use and still be a usable shell.

E.g. in #11095 someone had `git status` print over 100MiB of file
information.
This commit is contained in:
Fabian Boehm
2025-01-31 16:44:25 +01:00
parent 5eee4fc2c7
commit 9a46b66d04
2 changed files with 3 additions and 3 deletions

View File

@@ -870,7 +870,7 @@ but if you need multiple or the command doesn't read from standard input, "proce
This creates a temporary file, stores the output of the command in that file and prints the filename, so it is given to the outer command.
Fish has a default limit of 100 MiB on the data it will read in a command substitution. If that limit is reached the command (all of it, not just the command substitution - the outer command won't be executed at all) fails and ``$status`` is set to 122. This is so command substitutions can't cause the system to go out of memory, because typically your operating system has a much lower limit, so reading more than that would be useless and harmful. This limit can be adjusted with the ``fish_read_limit`` variable (`0` meaning no limit). This limit also affects the :doc:`read <cmds/read>` command.
Fish has a default limit of 1 GiB on the data it will read in a command substitution. If that limit is reached the command (all of it, not just the command substitution - the outer command won't be executed at all) fails and ``$status`` is set to 122. This is so command substitutions can't cause the system to go out of memory, because typically your operating system has a much lower limit, so reading more than that would be useless and harmful. This limit can be adjusted with the ``fish_read_limit`` variable (`0` meaning no limit). This limit also affects the :doc:`read <cmds/read>` command.
.. [#] One exception: Setting ``$IFS`` to empty will disable line splitting. This is deprecated, use :doc:`string split <cmds/string-split>` instead.

4
src/env/mod.rs vendored
View File

@@ -10,9 +10,9 @@
};
pub use var::*;
/// Limit `read` to 100 MiB (bytes, not wide chars) by default. This can be overridden with the
/// Limit `read` to 1 GiB (bytes, not wide chars) by default. This can be overridden with the
/// `fish_read_limit` variable.
pub const DEFAULT_READ_BYTE_LIMIT: usize = 100 * 1024 * 1024;
pub const DEFAULT_READ_BYTE_LIMIT: usize = 1024 * 1024 * 1024;
/// The actual `read` limit in effect, defaulting to [`DEFAULT_READ_BYTE_LIMIT`] but overridable
/// with `$fish_read_limit`.