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
kill the IFS
variable
#4156
Comments
So, there's two ways we're using $IFS currently:
The former can currently already be replaced by just reading the line and then The second could be solved by implementing |
Faho's first example, as they noted, can be handled by explicitly using something like There are only two places in fish where we unset IFS to get the second behavior noted by faho. One is |
I have some initial work on that. I'm calling it "--delimiter" (and "-d"), though, both because "-s" is already taken and for symmetry with things like |
In case it isn't obvious: When I say "kill the IFS variable" I only mean that no core fish C++ code or fish script will be affected by it. The user can still set it and export it to affect non-fish sub-shells. Although why you would ever do so is a mystery. This change is to make it even clearer that fish is not a POSIX 1003 shell with all the extremely weird string tokenization rules implied by that standard. That fish currently uses |
Of course. Though since IFS isn't exported right now, we would actually remove it completely from fish. |
Note that this is readily dealt with using our
I replaced that with this:
|
Also, unsetting IFS to avoid splitting command substitutions can be handled by replacing
with
Since the command substitution should not be producing null delimited output that is equivalent to the first idiom. So while there are good reasons to introduce things like |
This is a step towards resolving issue #4156. It replaces uses of `$IFS` with other solutions.
This is a step towards resolving issue #4156. It replaces uses of `$IFS` with other solutions.
I've removed all the IFS uses from our completions and functions. That just leaves modifying the |
This takes a string that is then split upon like `string split`. Unlike $IFS, the string is used as one piece, not a set of characters. There is still a fallback to IFS if no delimiter is given, that behaves exactly as before. Work towards fish-shell#4156.
This takes a string that is then split upon like `string split`. Unlike $IFS, the string is used as one piece, not a set of characters. There is still a fallback to IFS if no delimiter is given, that behaves exactly as before. Fixes #4156.
Okay, we've done 95% of the work. The remaining use in |
The discussion about doing a major release of fish prompted someone to add a comment to an issue targeted for that major release. Specifically, they said that having to set
IFS
to get the desired behavior isn't a big deal. To which I replied:So I'm opening this issue to ask that we consider doing so in the next fish major release.
The text was updated successfully, but these errors were encountered: