Add feature flag to turn off %self#10262
Conversation
This is the last remnant of the old percent expansion. It has the downsides of it, in that it is annoying to combine with anything: ```fish echo %self/foo ``` prints "%self/foo", not fish's pid. We have introduced $fish_pid in 3.0, which is much easier to use - just like a variable, because it is one. If you need backwards-compatibility for < 3.0, you can use the following shim: ```fish set -q fish_pid or set -g fish_pid %self ``` So we introduce a feature-flag called "remove-percent-self" to turn it off. "%self" will simply not be special, e.g. `echo %self` will print "%self".
|
I didn't know fish had this expansion of I understand this PR is not yet disabling this, just adding an opt-out feature flag for it. But i was wondering if a deprecation warning message could be useful too. |
This is the deprecation. We're telling you that we're planning to turn it off, and individual users can already try it out. And that is also how users catch it. In the meantime, the status quo is untouched, everything still works as before. The next phase, some time in the future, is to disable After that, it will eventually be permanently removed. Warnings just make it more annoying, especially in this case where finding uses is trival - you can actually just run In particular, in this case, either we turn on the warnings by default and then every end user sees them when they use an affected plugin, and they're not the ones to fix it. Or we have them opt-in and then we're no better off than allowing you to disable it yourself. Especially when finding uses of %self is that easy. |
|
Ok, that's fair, thanks for your thorough reply. I was thinking more from the perspective of:
If this version starts warning about uses of I don't really know if this is too far fetched. It probably is. But it's the kind of use-case that came immediately to mind 😅 |
| qmark-noglob on 3.0 ? no longer globs | ||
| regex-easyesc on 3.1 string replace -r needs fewer \\'s | ||
| ampersand-nobg-in-token on 3.4 & only backgrounds if followed by a separating character | ||
| remove-percent-self off 3.8 %self is no longer expanded (use $fish_pid) |
There was a problem hiding this comment.
sounds fine to me. Actually turning it on is a separate decision, possibly not for many years
There was a problem hiding this comment.
It will be a while, yes, but I would imagine shorter than qmark-noglob.
I expect fewer issues than with stderr-nocaret - that one was bloody everywhere, and it was harder to find than this.
%self was never a huge thing, the main reason why there are still uses is that oh-my-fish is dead more than it being important.
This is the last remnant of the old percent expansion.
It has the downsides of it, in that it is annoying to combine with anything:
echo %self/fooprints "%self/foo", not fish's pid.
We have introduced $fish_pid in 3.0, which is much easier to use - just like a variable, because it is one.
If you need backwards-compatibility for < 3.0, you can use the following shim:
So we introduce a feature-flag called "remove-percent-self" to turn it off.
"%self" will simply not be special, e.g.
echo %selfwill print "%self".Current uses of %self:
Here's a few notable uses of %self I can still find in the wild:
There are in total 386 matches on Github I can find. These are all easily, almost mechanically replaced with
$fish_pid, with optional backwards-compatibility by setting the variable yourself if it doesn't exist (see above).It is worth pointing out that $fish_pid was introduced in fish 3.0, which is 45% of commits up to 3.7.0 behind. It was released 5 years ago.