Skip to content

problem with ${if:...} when the condition is a variable with an operator inside #1627

@pascalpoitras

Description

@pascalpoitras

Bug summary

when you use a variable in the conditions part of the ${if:...} and the content of this variable contains an operator there will be a problem if your condition also use an operator. By the way this also cause problem in autosort.py I will report this to de-vri-es after this issue.

Steps to reproduce

1. /set plugins.var.test hello!=hello
2. /eval -n ${if:${plugins.var.test}?1:0}
3. it return 0 because hello != hello
4. now try with an explicit operator
5. /eval -n ${if:${plugins.var.test}!=?1:0}
6. now it return 1 because there is two operator and this dosn't make sense without logical operator
7. the default rule 0 of autosort.py use the core_first helper
8. the helper use the following condition ${if:${buffer.full_name}!=core.weechat}
9. install autosort and join a channel like #r3m==#r3m
10. autosort will not place it with other irc buffer

I guess this is hard to fix, since the variable is evaluated first and then the if evaluate the condition (with two operators in it). This is not the first time this issue cause me problem, what we really want is to tell weechat that the operator in the variable should not be treated as operator


  • WeeChat version: 3.2-dev
  • OS, distribution and version: debian stable
  • Terminal: urxvt
  • Terminal multiplexer (screen/tmux/…/none): tmux

Metadata

Metadata

Assignees

Labels

bugUnexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions