"tag range end is not an integer" for some values #60

Closed
opened 6 months ago by watertruce · 3 comments

I'm using Yambar with a small script that outputs my CPU frequency.
The relevant config is:

    - script:
        path: /usr/local/bin/cpufreq.sh
        args: [1]
        content: {string: {text: "{cpufreq} MHz", right-margin: 16}}

Said script outputs the following:

echo "cpufreq|range:${MINFREQ}-${MAXFREQ}|${FREQ}"
echo ""

However, for some values of the upper limit, Yambar seems to consider the int as being invalid:

 err: modules/script.c:225: invalid tag: cpufreq|range:800-4900|4887
 err: modules/script.c:184: tag range end is not an integer: 4900

After some testing, it seems to only happen for values >= 3889 and < 5000.

This is happening on Yambar v.1.6.1 (Alpine Linux Edge package).

I'm using Yambar with a small script that outputs my CPU frequency. The relevant config is: ``` - script: path: /usr/local/bin/cpufreq.sh args: [1] content: {string: {text: "{cpufreq} MHz", right-margin: 16}} ``` Said script outputs the following: ``` echo "cpufreq|range:${MINFREQ}-${MAXFREQ}|${FREQ}" echo "" ``` However, for some values of the upper limit, Yambar seems to consider the int as being invalid: ``` err: modules/script.c:225: invalid tag: cpufreq|range:800-4900|4887 err: modules/script.c:184: tag range end is not an integer: 4900 ``` After some testing, it seems to only happen for values >= 3889 and < 5000. This is happening on Yambar v.1.6.1 (Alpine Linux Edge package).
watertruce changed title from "tag range end is not an integer" for some value to "tag range end is not an integer" for some values 6 months ago
Owner

Interresting... it obviously is an integer... 🤔

Interresting... it obviously is an integer... 🤔
dnkl added the
bug
label 6 months ago
Owner

Just a stupid typo... fix incoming, sorry about this :)

diff --git a/modules/script.c b/modules/script.c
index 7e07365..a938f7d 100644
--- a/modules/script.c
+++ b/modules/script.c
@@ -180,7 +180,7 @@ process_line(struct module *mod, const char *line, size_t len)
 
         long end = 0;
         for (size_t i = 0; i < end_len; i++) {
-            if (!(_end[i] >= '0' && _end[i] < '9')) {
+            if (!(_end[i] >= '0' && _end[i] <= '9')) {
                 LOG_ERR(
                     "tag range end is not an integer: %.*s",
                     (int)end_len, _end);
Just a stupid typo... fix incoming, sorry about this :) ```diff diff --git a/modules/script.c b/modules/script.c index 7e07365..a938f7d 100644 --- a/modules/script.c +++ b/modules/script.c @@ -180,7 +180,7 @@ process_line(struct module *mod, const char *line, size_t len) long end = 0; for (size_t i = 0; i < end_len; i++) { - if (!(_end[i] >= '0' && _end[i] < '9')) { + if (!(_end[i] >= '0' && _end[i] <= '9')) { LOG_ERR( "tag range end is not an integer: %.*s", (int)end_len, _end); ```
dnkl referenced this issue from a commit 6 months ago
dnkl closed this issue 6 months ago
Owner

Done! Thanks for the report!

Done! Thanks for the report!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.