brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.17k stars 615 forks source link

graphs are empty #1109

Closed PCCV closed 1 year ago

PCCV commented 3 years ago

Hi all!

Issue this bug appeared since version 1.11 and is always present with 1.12. the following code works very well with 1.10. Graphs (upspeedgraph / downspeedgraph / execgraph) are empty when called from templates but works outside templates.

Information the same behavior is observed on Ubuntu and openSUSE.

conky.config = {
-- ********************************
-- "Network Panel" for Conky by FG
-- ********************************
    background = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = true,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    own_window_argb_visual = true,
    own_window_argb_value = 0,
    own_window_colour = '#000000',

    double_buffer = true,
    no_buffers = false,
    use_spacer = 'none',
    use_xft = true,
    xftalpha = 1,

    font = 'Ubuntu:size=10',
    update_interval = 2,
    uppercase = false,
    override_utf8_locale = true,
    stippled_borders = 0,
    border_width = 5,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,

    show_graph_scale = false,
    show_graph_range = false,

    net_avg_samples = 2,
    cpu_avg_samples = 6,
    short_units = true,
    pad_percents = 2,
    text_buffer_size = 2048,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,

    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,

    minimum_width = 200, minimum_height = 0,
    default_graph_width = 200, default_graph_height = 50,

    template1 = [[
${if_up \1}${font Ubuntu:Italic:size=10}Wireless lan (\1) ${hr}\n${font FontAwesome}${font} AP ${alignr} ${wireless_essid}\n${font FontAwesome} ${font} ${alignr} ${wireless_link_bar 10,150 \1}\n${font FontAwesome}${font} bitrate ${alignr} ${wireless_bitrate \1} ${endif}]],

    template2 = [[
${if_up \1}${font Ubuntu:Italic:size=10}Wired lan (\1) ${hr} ${endif}]],

    template3 = [[
${font FontAwesome}${font} ${alignr}${addr \1}]],

    template4 = [[
${font FontAwesome}${font}${alignr}${downspeedf \1 }KiB/s (${totaldown \1})\n${downspeedgraph \1} \n${font FontAwesome}${font}${alignr}${upspeedf \1}KiB/s (${totalup \1})\n${upspeedgraph \1} ]],

};

conky.text = [[
${if_gw}
${if_match "${gw_iface}"=="multiple"}\
Multiple (showing ${execpi 10 sed -n "2p" /proc/net/route | sed 's/\t.*//'}) ${hr}
${else}\
${if_match "${wireless_mode}" != "" }\
${execpi 10000 cat /proc/net/route | sed -n '2p' | sed 's/\t.*//' | sed 's/^/\$\{template1 /;s/$/\}/'}
${else}\
${execpi 10000 cat /proc/net/route | sed -n '2p' | sed 's/\t.*//' | sed 's/^/\$\{template2 /;s/$/\}/'}
${endif}\
${endif}\
${font FontAwesome}${font} ${alignr}${execi 6000 wget http://ipinfo.io/ip -qO -}
${execpi 5 sed -n "2p" /proc/net/route | sed 's/\t.*//' | sed 's/^/\$\{template3 /;s/$/\}/'}
${voffset -5}${hr}
${execpi 5 sed -n "2p" /proc/net/route | sed 's/\t.*//' | sed 's/^/\$\{template4 /;s/$/\}/'}
${voffset -9}
${else}$hr
No network found !!!
$hr
${endif}
]];
PCCV commented 2 years ago

Hi all! I made a conkyrc reduced to the minimum to best describe this bug. change eth0 with your net device.

conky.config = {
    double_buffer = true,
    own_window = true,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',

    show_graph_scale = true,
    show_graph_range = true,
    net_avg_samples = 2,
    minimum_width = 200, minimum_height = 0,
    default_graph_width = 200, default_graph_height = 50,

    template1 = [[${downspeedgraph \1}]],
};
conky.text = [[
${template1 eth0}
${execpi 20 cat /proc/net/route | sed -n '2p' | sed 's/\t.*//' | sed 's/^/\$\{template1 /;s/$/\}/'}
]];

two lines to construct the same command based on "downspeedgraph" but the second graph stay empty. could someone tell me why? Best would be that we can use nested commands like ${gw_iface}

renbag commented 2 years ago

I confirm that the bug is true also when a graph is called from a lua function, as shown by the following example:

conky.conf.txt

conky_functions.lua.txt

The bug is the same of issues #1039 and #1105 and is not present in conky 1.10.8

natmey commented 2 years ago

I too can confirm a bug here. I'm running Debian, with conky version 1.11.6-2. All of my testing has been with scroll, but I suspect the graph and scroll issues to be related. I reproduced this in Bullseye/XFCE and Sid/LxQT.

The bug occurs when an external source is providing conky with conky formatting strings for parsing, some formatting is correctly parsed and works as expected (fonts, colors), but formatting which requires motion, like scroll behaves in unexpected ways.

Here is a simple example of how to produce this bug:

conky.config = {
    own_window = true,
    own_window_class = 'Conky',
    own_window_hints = 'below',
    own_window_type = 'desktop',
    use_xft = true,
    update_interval = 1.0,
}
conky.text = [[
The scroll bug happens on output that conky would otherwise parse.
${execp printf '${scroll left 20 This will NOT print.}'}
${scroll left 20 BUT this will print.}
]]

If you run that, you'll see that scroll code printed by execp just doesn't get parsed, but an almost identical scroll block below works just fine.

I've attached a slightly more complex example that uses catp as well, and illustrates some of the odd contours of the issue. For instance ${scroll left 50 Some text} will print, but only if there are <=42 characters.

I haven't gone looking for it in the code, but I suspect the issue occurs when formatting strings are getting parsed, and something chokes/fails(?) and it returns nothing/ an empty string. This would account for why this bug shows up with both catp and execp, as well as with graphs.

Hope this helps clarify the issue. Would love to see it fixed!

scroll-bug.conf.txt scroll-bug.txt

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 30 days with no activity.