Comments (4)
Looked into the code, I can confirm it's a bug in the following two functions in algebra.cc
:
int find_match_op(const char *expr) {
unsigned int idx;
for (idx = 0; idx < strlen(expr); idx++) {
switch (expr[idx]) {
case '=':
case '!':
if (expr[idx + 1] != '=') { return -1; }
/* falls through */
case '<':
case '>':
return idx;
}
}
return -1;
}
int get_match_type(const char *expr) {
int idx;
const char *str;
if ((idx = find_match_op(expr)) == -1) { return -1; }
str = expr + idx;
if (*str == '=' && *(str + 1) == '=') { return OP_EQ; }
if (*str == '!' && *(str + 1) == '=') { return OP_NEQ; }
if (*str == '>') {
if (*(str + 1) == '=') { return OP_GEQ; }
return OP_GT;
}
if (*str == '<') {
if (*(str + 1) == '=') { return OP_LEQ; }
return OP_LT;
}
return -1;
}
get_match_type
finds the first occurrence of !
via find_match_op
and then tries matching it to !=
, given that the text can contain arbitrary number of !
before an actual !=
, or even the whole !=
expression, the function get_match_type
is faulty because it assumes the comparison is after the first !
. FRITZ! routers are very common consumer grade routers provided by ISPs so this was only the most likely failure point.
It should instead parse the first value (string or float), skip the value, skip whitespace, then parse operator, fail if wrong operator or end of text (first string not closed), skip whitespace, parse second value/operand, fail if types not comparable (handle string to number conversion), return comparison result.
Workaround: use exec
and get the same information from shell, pipe through sed s/!//g
from conky.
Marking as low priority because #1001 needs to be addressed first (work on #1879). My guess is that this has to do with if_match
instead of networking.
Can you provide an example which doesn't use the wireless_essid
variable, even if echoing from a file with similar content? Doing so would allow us to unlink the issues.
from conky.
You are right, the same problem exists when using exec
:
conky.text = [[${color white}
TEST: ${if_match "${exec echo FRITZ!Box 7520 HI}" == "off/any"}a${else}b$endif
]]
This configuration produces the same error. Is there any special meaning for the exclamation mark in if_match
?
from conky.
Thank you for the triage!
I will use the workaround for now. Unfortunately, I don't think I can help in the development for now, but I am available for any test/experimenti :-)
from conky.
Related Issues (20)
- [Bug]: 1.21.1 /usr/share/doc/conky name mistake? HOT 2
- [Bug]: Wrong hr line thickness HOT 6
- [Bug]: 1.21.1 conky display is truncated HOT 8
- if_updatenr config in wayland/sway always crashes after a couple hours or so
- [Bug]: conky 1.21. does not start consistently HOT 1
- [Bug]: Tests fail with BUILD_COLOUR_NAME_MAP=OFF HOT 1
- [Bug]: Version 1.21.1 Images larger HOT 7
- [Bug]: attempt to call a nil value (global 'cairo_xlib_surface_create') HOT 4
- [Bug]: Build failure on aarch64 on Mageia Cauldron HOT 2
- Border_width ignored on top and bottom borders HOT 20
- [Bug]: $desktop variable not changing when switching desktops Linux Mint HOT 3
- [Bug]: blank window HOT 1
- [Bug]: set_struts wrong with large DPI HOT 2
- [Bug]: Middle not working as second argument in Alignment HOT 2
- [Bug]: append_file doesn't append to config HOT 1
- [Bug]: Conky not sizing its own window properly on KDE Plasma 6 / X11 HOT 2
- [Bug]: cairo_xlib_surface_create nil value error with Lua Cairo HOT 1
- [Bug]: Border not rendering at the top and bottom HOT 2
- [Documentation, Project Management] Would it be possible to use a short-ish changelog, for more important changes? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conky.