Skip to content

[Bug]: Blinking custom/script module on continuous script failure with unchanged output #2636

@Equaraphanus

Description

@Equaraphanus

Checklist

  • I have read the appropriate section in the contributing guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part
  • I have searched for other open and closed issues that may have already reported this problem
  • I have checked the known issues page for this problem.
  • I have followed the debugging guide to narrow down the problem to a minimal config.

Steps to reproduce

  1. Put the minimal config into blinking_error.ini;
  2. Run polybar -c blinking_error.ini;
  3. Witness the blinking error text.

Minimal config

[bar/test]
modules-left = test-error

[module/test-error]
type = custom/script
exec = "echo error && false"
interval = 1
format = <label>
label = %output%

Polybar log

notice: Parsing config file: blinking_error.ini
warn: No fonts specified, using fallback font "fixed"
notice: Loaded font "fixed" (name=DejaVu Sans, offset=0, file=/usr/share/fonts/TTF/DejaVuSans.ttf)
notice: Received signal(2): Interrupt
notice: Termination signal received, shutting down...

Expected behavior

As long as the output is not actually empty, the module should not disappear, instead it should stay as it is, displaying the output (error in this case) with all appropriate formatting applied (if provided), regardless of the command's exit status and if its output has changed since last time or not.

Actual behavior

What actually happens is this:
the error text is blinking

Every other script run the output gets reset to "" and the module disappears completely only to reappear again on the next run.

Window Manager and Version

bspwm 0.9.10

Linux Distribution

Arch Linux

Polybar version

polybar 3.6.1

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wsuggest-override
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wall -Wextra -Wpedantic -Wsuggest-override  -Wall -Wextra -Wpedantic -Wsuggest-override

Additional Context / Screenshots

After some time of m_log.warn() debugging, I came across this piece of code, located (as of 880fbc2) in script_runner.cpp, line 130:

if (!changed && m_exit_status != 0) {
  clear_output();
}

Basically it forcefully resets the output to "" when the script prints the same thing again while exiting with non-zero code.

I can't think of any case when this behavior could be useful, especially after the formatting for script failure was introduced in #2596.

If this behavior is required for some reason, it would be nice to have an ability to opt-out of it with some per-module config setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions