Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.86k stars 661 forks source link

Core dump with the Upower module #2283

Closed StayPirate closed 3 months ago

StayPirate commented 1 year ago

When I try to use the newly introduced Upower feature https://github.com/Alexays/Waybar/pull/2229, I get a core dump. Tagging @LukashonakV as the father of the new implemented feature.

> waybar -l trace
[2023-07-05 12:38:02.043] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/config
[2023-07-05 12:38:02.043] [debug] Found config file: $XDG_CONFIG_HOME/waybar/config
[2023-07-05 12:38:02.043] [info] Using configuration file /home/crazybyte/.config/waybar/config
[2023-07-05 12:38:02.043] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style.css
[2023-07-05 12:38:02.043] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style.css
[2023-07-05 12:38:02.043] [info] Using CSS file /home/crazybyte/.config/waybar/style.css
[2023-07-05 12:38:02.052] [debug] Output detection done: eDP-1 (Chimei Innolux Corporation 0x150C)
zsh: segmentation fault (core dumped)  waybar -l trace
Device: /org/freedesktop/UPower/devices/headphones_dev_04_52_C7_7E_67_82
  native-path:          /org/bluez/hci0/dev_04_52_C7_7E_67_82
  model:                Crazybyte QC35
  serial:               04:52:C7:7E:67:82
  power supply:         no
  updated:              Wed 05 Jul 2023 12:09:06 CEST (1593 seconds ago)
  has history:          yes
  has statistics:       no
  headphones
    warning-level:       none
    percentage:          70%
    icon-name:          'battery-missing-symbolic'
// -*- mode: json -*-

[{
    "layer": "top",
    "position": "top",

    "modules-left": [
        "sway/workspaces",
        "custom/right-arrow-dark"
    ],
    "modules-right": [
        "custom/left-arrow-dark",
        "cpu",
        "temperature#cpu",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "disk",
        "temperature#disk",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "memory",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "battery",
        "upower#boseqc35",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "pulseaudio",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "bluetooth",
        "network#wifi",
        "network#eth",
        "network#tun",
        "network#tap",
        "custom/left-arrow-light",
        "custom/left-arrow-dark",
        "custom/notification"
    ],

[...]

    "battery": {
        "states": {
            "full": 100,
            "good": 90,
            "warning": 30,
            "critical": 10
        },
        "format": "<b>{icon}</b> {capacity:3}%",
        "format-icons": [
            "",
            "",
            "",
            "",
            ""
        ]
    },
    "upower#boseqc35": {
        "native-path": "/org/bluez/hci0/dev_04_52_C7_7E_67_82",
        "icon-size": 20,
        "hide-if-empty": true,
        "tooltip": true,
        "tooltip-spacing": 20
    },

[...]
> pacman -Qii waybar
Name            : waybar
Version         : 0.9.19-1
Description     : Highly customizable Wayland bar for Sway and Wlroots based compositors
Architecture    : x86_64
URL             : https://github.com/Alexays/Waybar/
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : gtkmm3  libjsoncpp.so=25-64  libsigc++  fmt  jack  libjack.so=0-64  wayland  libdate-tz.so=3-64  libspdlog.so=1.11-64  gtk-layer-shell  libupower-glib.so=3-64  upower  libevdev  libinput
                  libpulse  libnl  libappindicator-gtk3  libdbusmenu-gtk3  libmpdclient  libsndio.so=7-64  libxkbcommon  libwireplumber  playerctl
Optional Deps   : otf-font-awesome: Icons in the default configuration
Required By     : None
Optional For    : sway
Conflicts With  : None
Replaces        : None
Installed Size  : 1567.09 KiB
Packager        : Brett Cornwall <ainola@archlinux.org>
Build Date      : Wed 05 Jul 2023 03:19:24 CEST
Install Date    : Wed 05 Jul 2023 12:15:49 CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
Backup Files    :
UNMODIFIED      /etc/xdg/waybar/config
UNMODIFIED      /etc/xdg/waybar/style.css
StayPirate commented 1 year ago

Not sure if gdb output could help, in any case here it is:

205                  clara::detail::Opt(config_opt, "config")["-c"]["--config"]("Config path") |
(gdb)
100           ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
206                  clara::detail::Opt(style_opt, "style")["-s"]["--style"]("Style path") |
(gdb)
100           ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
209                      "trace|debug|info|warning|error|critical|off")["-l"]["--log-level"]("Log level") |
(gdb)
100           ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
210                  clara::detail::Opt(bar_id, "id")["-b"]["--bar"]("Bar id");
(gdb)
100           ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
211       auto res = cli.parse(clara::detail::Args(argc, argv));
(gdb)
548       explicit operator bool() const { return m_type == ResultBase::Ok; }
(gdb)
216       if (show_help) {
(gdb)
220       if (show_version) {
(gdb)
1072          size() const _GLIBCXX_NOEXCEPT
(gdb)
227       gtk_app = Gtk::Application::create(argc, argv, "fr.arouillard.waybar",
(gdb)
[New Thread 0x7ffff1bff6c0 (LWP 669913)]
[New Thread 0x7ffff13fe6c0 (LWP 669914)]
[New Thread 0x7ffff0bfd6c0 (LWP 669915)]
[New Thread 0x7fffe3fff6c0 (LWP 669924)]
[New Thread 0x7fffe37fe6c0 (LWP 669925)]
228                                          Gio::APPLICATION_HANDLES_COMMAND_LINE);
(gdb)
229       gdk_display = Gdk::Display::get_default();
(gdb)
230       if (!gdk_display) {
(gdb)
233       if (!GDK_IS_WAYLAND_DISPLAY(gdk_display->gobj())) {
(gdb)
236       wl_display = gdk_wayland_display_get_wl_display(gdk_display->gobj());
(gdb)
237       config.load(config_opt);
(gdb)
[2023-07-05 15:15:35.343] [info] Using configuration file /home/crazybyte/.config/waybar/config
238       auto css_file = getStyle(style_opt);
(gdb)
[2023-07-05 15:15:41.409] [info] Using CSS file /home/crazybyte/.config/waybar/style.css
239       setupCss(css_file);
(gdb)
240       bindInterfaces();
(gdb)
[Thread 0x7ffff0bfd6c0 (LWP 669915) exited]
259     inline T_CppObject* RefPtr<T_CppObject>::operator->() const noexcept
(gdb)
[New Thread 0x7ffff0bfd6c0 (LWP 670684)]
[New Thread 0x7fffe2ffd6c0 (LWP 670685)]
[New Thread 0x7fffe27fc6c0 (LWP 670686)]
[New Thread 0x7fffe1ffb6c0 (LWP 670687)]
[New Thread 0x7fffe17fa6c0 (LWP 670688)]
[New Thread 0x7fffe0ff96c0 (LWP 670689)]
[New Thread 0x7fffdbfff6c0 (LWP 670690)]
[New Thread 0x7fffdb7fe6c0 (LWP 670691)]
[New Thread 0x7fffdaffd6c0 (LWP 670692)]
[New Thread 0x7fffda7fc6c0 (LWP 670693)]

Thread 1 "waybar" received signal SIGSEGV, Segmentation fault.
g_type_check_instance (type_instance=0x5555559fce20) at ../glib/gobject/gtype.c:4272
4272              TypeNode *node = lookup_type_node_I (type_instance->g_class->g_type);
(gdb)
Couldn't get registers: No such process.
(gdb) [Thread 0x7fffda7fc6c0 (LWP 670693) exited]
[Thread 0x7fffdaffd6c0 (LWP 670692) exited]
[Thread 0x7fffdb7fe6c0 (LWP 670691) exited]
[Thread 0x7fffdbfff6c0 (LWP 670690) exited]
[Thread 0x7fffe0ff96c0 (LWP 670689) exited]
[Thread 0x7fffe17fa6c0 (LWP 670688) exited]
[Thread 0x7fffe1ffb6c0 (LWP 670687) exited]
[Thread 0x7fffe27fc6c0 (LWP 670686) exited]
[Thread 0x7fffe2ffd6c0 (LWP 670685) exited]
[Thread 0x7ffff0bfd6c0 (LWP 670684) exited]
[Thread 0x7fffe37fe6c0 (LWP 669925) exited]
[Thread 0x7ffff13fe6c0 (LWP 669914) exited]
[Thread 0x7ffff1bff6c0 (LWP 669913) exited]
[Thread 0x7ffff27d56c0 (LWP 666679) exited]
[Thread 0x7ffff27f99c0 (LWP 666493) exited]
[Thread 0x7fffe3fff6c0 (LWP 669924) exited]
[New process 666493]

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
StayPirate commented 1 year ago

Here the compilation flags used for the build.

build() {
    cd "Waybar-$pkgver"
    # TODO tests depend on catch2 v3
    meson --prefix=/usr \
          --buildtype=plain \
          --auto-features=enabled \
          --wrap-mode=nodownload \
          -Dexperimental=true \
          -Dcava=disabled \
          -Dtests=disabled \
          build
    ninja -C build
}
LukashonakV commented 1 year ago

Here the compilation flags used for the build.

build() {
    cd "Waybar-$pkgver"
    # TODO tests depend on catch2 v3
    meson --prefix=/usr \
          --buildtype=plain \
          --auto-features=enabled \
          --wrap-mode=nodownload \
          -Dexperimental=true \
          -Dcava=disabled \
          -Dtests=disabled \
          build
    ninja -C build
}

Thank you @StayPirate , will check it soon

LukashonakV commented 11 months ago

Hi @StayPirate , can you please apply provided upower.patch.zip to the freshest trunk , build waybar and provide the output. Thank you. Result should be something like this


ps_2023-07-27-17_12_46

StayPirate commented 11 months ago

Hi @LukashonakV, I just tried it out and unfortunately it didn't work. Same issue as before. Are you able to reproduce this problem from your side?

StayPirate commented 11 months ago

This is the PKGBUILD file I used to test your patch. Is the same currently on the Archlinux repo, I just added your patch and compiled it.


# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>

pkgname=waybar
pkgver=0.9.20
pkgrel=2
pkgdesc='Highly customizable Wayland bar for Sway and Wlroots based compositors'
arch=('x86_64')
url="https://github.com/Alexays/Waybar/"
license=('MIT')
depends=(
    'gtkmm3'
    'libjsoncpp.so'
    'libsigc++'
    'fmt'
    'jack' 'libjack.so'
    'wayland'
    'libdate-tz.so'
    'libspdlog.so'
    'gtk-layer-shell'
    'libupower-glib.so'
    'upower'
    'libevdev'
    'libinput'
    'libpulse'
    'libnl'
    'libappindicator-gtk3'
    'libdbusmenu-gtk3'
    'libmpdclient'
    'libsndio.so'
    'libxkbcommon'
    'libwireplumber'
    'playerctl'
)
makedepends=(
    'cmake'
    'catch2'
    'meson'
    'scdoc' # For generating manpages
    'wayland-protocols'
)
backup=(
    etc/xdg/waybar/config
    etc/xdg/waybar/style.css
)
optdepends=(
    'otf-font-awesome: Icons in the default configuration'
)
source=("$pkgname-$pkgver.tar.gz::https://github.com/Alexays/Waybar/archive/$pkgver.tar.gz"
         https://github.com/Alexays/Waybar/commit/e9b29613.patch
         upower.patch)
sha256sums=('e300183defece4799b6dfb7aea72400492ec6e330217c22158a334f35532d014'
            'b5dc01bb96ad7cbe1f9e0683e3276e3fee0aebb2d824aa97e7a36d765aa3f1e4'
            '28a597ded842d6f9a665bc54422a4e05fd4a6770c31f5e3927b75783b0ff4e3e')

prepare() {
    cd Waybar-$pkgver
    patch -p1 -i ../e9b29613.patch # Fix build with fmt 10
    patch -p1 -i ../upower.patch
}

build() {
    cd "Waybar-$pkgver"
    # TODO tests depend on catch2 v3
    CXXFLAGS+=" -std=c++20" \
    meson --prefix=/usr \
          --buildtype=plain \
          --auto-features=enabled \
          --wrap-mode=nodownload \
          -Dexperimental=true \
          -Dcava=disabled \
          -Dtests=disabled \
          build
    ninja -C build
}

package() {
    cd "Waybar-$pkgver"
    DESTDIR="$pkgdir" ninja -C build install
    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
LukashonakV commented 11 months ago

@StayPirate actually I provided patch due to on my machine I don't have any issues so far and not able nor reproduce neither catch the issue. Please:

  1. mkdir ~/Documents/Waybar
  2. cd ~/Documents
  3. git clone https://github.com/Alexays/Waybar.git Waybar
  4. unzip provided patch into ~/Documents/Waybar
  5. cd Waybar
  6. git apply upower.patch
  7. make
  8. ./build/waybar
StayPirate commented 11 months ago

The following is what I ran and the compiling error I got... can you help me, pls?

  1. mkdir ~/Documents/Waybar
  2. cd ~/Documents
  3. git clone https://github.com/Alexays/Waybar.git Waybar
  4. unzip provided patch into ~/Documents/Waybar
  5. cd Waybar

5.5 git reset --hard 0.9.20

  1. git apply upower.patch
  2. make
[68/223] Compiling C++ object waybar.p/src_modules_upower_upower.cpp.o
FAILED: waybar.p/src_modules_upower_upower.cpp.o
c++ -Iwaybar.p -I. -I.. -I../include -I../subprojects/cava-0.8.4/include -Iprotocol -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/gtkmm-3.0 -I/usr/lib/gtkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/atkmm-1.6 -I/usr/lib/atkmm-1.6/include -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/gdkmm-3.0/include -I/usr/include/libdbusmenu-gtk3-0.4 -I/usr/include/libdbusmenu-glib-0.4 -I/usr/include/libnl3 -I/usr/include/libupower-glib -I/usr/include/playerctl -I/usr/include/wireplumber-0.4 -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2 -I/usr/include/libevdev-1.0 -I/usr/include/gtk-layer-shell -I -I/usr/include/libxml2 -I/usr/include/SDL2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 -O3 '-DVERSION="0.9.20 (branch '"'"'master'"'"')"' -DHAVE_LANGINFO_1STDAY '-DSYSCONFDIR="//usr/local/etc"' -DHAVE_CPU_LINUX -DHAVE_MEMORY_LINUX -DHAVE_SWAY -DHAVE_WLR -DHAVE_RIVER -DHAVE_DWL -DHAVE_HYPRLAND -DHAVE_LIBNL -DHAVE_GAMEMODE -DHAVE_UPOWER -DHAVE_MPRIS -DHAVE_LIBPULSE -DHAVE_LIBJACK -DHAVE_LIBWIREPLUMBER -DHAVE_DBUSMENU -DHAVE_LIBUDEV -DHAVE_LIBEVDEV -DHAVE_LIBINPUT -DHAVE_LIBMPDCLIENT -DHAVE_GTK_LAYER_SHELL -DHAVE_LIBSNDIO -DHAVE_GIO_UNIX -DHAVE_LIBDATE -DHAVE_LIBCAVA -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DUSE_OS_TZDB=1 -DONLY_C_LOCALE=0 -pthread -D_REENTRANT -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -MD -MQ waybar.p/src_modules_upower_upower.cpp.o -MF waybar.p/src_modules_upower_upower.cpp.o.d -o waybar.p/src_modules_upower_upower.cpp.o -c ../src/modules/upower/upower.cpp
In file included from ../src/modules/upower/upower.cpp:3:
/usr/include/fmt/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v10::detail::parse_format_specs(ParseContext&) [with T = UpDeviceState; ParseContext = compile_parse_context<char>; decltype (ctx.begin()) = const char*]’:
/usr/include/fmt/core.h:2620:22:   required from ‘constexpr fmt::v10::detail::format_string_checker<Char, Args>::format_string_checker(fmt::v10::basic_string_view<Char>) [with Char = char; Args = {double, char*, long int, long int, UpDeviceState, UpDeviceKind}]’
../src/modules/upower/upower.cpp:327:17:   required from here
/usr/include/fmt/core.h:2561:10: error: use of deleted function ‘fmt::v10::formatter<T, Char, Enable>::formatter() [with T = UpDeviceState; Char = char; Enable = void]’
 2561 |   return formatter<mapped_type, char_type>().parse(ctx);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fmt/core.h:792:3: note: declared here
  792 |   formatter() = delete;
      |   ^~~~~~~~~
/usr/include/fmt/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v10::detail::parse_format_specs(ParseContext&) [with T = UpDeviceKind; ParseContext = compile_parse_context<char>; decltype (ctx.begin()) = const char*]’:
/usr/include/fmt/core.h:2620:22:   required from ‘constexpr fmt::v10::detail::format_string_checker<Char, Args>::format_string_checker(fmt::v10::basic_string_view<Char>) [with Char = char; Args = {double, char*, long int, long int, UpDeviceState, UpDeviceKind}]’
../src/modules/upower/upower.cpp:327:17:   required from here
/usr/include/fmt/core.h:2561:10: error: use of deleted function ‘fmt::v10::formatter<T, Char, Enable>::formatter() [with T = UpDeviceKind; Char = char; Enable = void]’
 2561 |   return formatter<mapped_type, char_type>().parse(ctx);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fmt/core.h:792:3: note: declared here
  792 |   formatter() = delete;
      |   ^~~~~~~~~
/usr/include/fmt/core.h: In instantiation of ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_value(T&&) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = UpDeviceState&]’:
/usr/include/fmt/core.h:1711:29:   required from ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; type <anonymous> = fmt::v10::detail::type::custom_type; T = UpDeviceState&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
/usr/include/fmt/core.h:1827:77:   required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {double, char*, long int, long int, UpDeviceState, UpDeviceKind}]’
/usr/include/fmt/core.h:1844:31:   required from ‘constexpr fmt::v10::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<T>::type>::type ...> fmt::v10::make_format_args(T&& ...) [with Context = basic_format_context<appender, char>; T = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}]’
/usr/include/spdlog/logger.h:374:75:   required from ‘void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; spdlog::string_view_t = fmt::v10::basic_string_view<char>]’
/usr/include/spdlog/logger.h:90:13:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/logger.h:96:12:   required from ‘void spdlog::logger::log(spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/logger.h:158:12:   required from ‘void spdlog::logger::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/spdlog.h:161:31:   required from ‘void spdlog::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
../src/modules/upower/upower.cpp:327:17:   required from here
/usr/include/fmt/core.h:1691:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
 1691 |       formattable,
      |       ^~~~~~~~~~~
/usr/include/fmt/core.h:1691:7: note: ‘formattable’ evaluates to false
/usr/include/fmt/core.h: In instantiation of ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_value(T&&) [with Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = UpDeviceKind&]’:
/usr/include/fmt/core.h:1711:29:   required from ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&&) [with bool IS_PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; type <anonymous> = fmt::v10::detail::type::custom_type; T = UpDeviceKind&; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’
/usr/include/fmt/core.h:1827:77:   required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {double, char*, long int, long int, UpDeviceState, UpDeviceKind}]’
/usr/include/fmt/core.h:1844:31:   required from ‘constexpr fmt::v10::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<T>::type>::type ...> fmt::v10::make_format_args(T&& ...) [with Context = basic_format_context<appender, char>; T = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}]’
/usr/include/spdlog/logger.h:374:75:   required from ‘void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; spdlog::string_view_t = fmt::v10::basic_string_view<char>]’
/usr/include/spdlog/logger.h:90:13:   required from ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/logger.h:96:12:   required from ‘void spdlog::logger::log(spdlog::level::level_enum, fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/logger.h:158:12:   required from ‘void spdlog::logger::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
/usr/include/spdlog/spdlog.h:161:31:   required from ‘void spdlog::info(fmt::v10::format_string<T ...>, Args&& ...) [with Args = {double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&}; fmt::v10::format_string<T ...> = fmt::v10::basic_format_string<char, double&, char*&, long int&, long int&, UpDeviceState&, UpDeviceKind&>]’
../src/modules/upower/upower.cpp:327:17:   required from here
/usr/include/fmt/core.h:1691:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
/usr/include/fmt/core.h:1691:7: note: ‘formattable’ evaluates to false
[85/223] Compiling C++ object waybar.p/src_modules_bluetooth.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:7: build] Error 1
M3t0r commented 9 months ago

I also can't apply the patch, but here is a GDB session with a bit more information:

(gdb) run -l trace
Starting program: /usr/bin/waybar -l trace
[Thread debugging using libthread_db enabled]                                                                                                                
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff4b956c0 (LWP 29223)]                                                                                                                      
[New Thread 0x7fffe6bff6c0 (LWP 29224)]
[New Thread 0x7fffdffff6c0 (LWP 29225)]
[New Thread 0x7fffe63fe6c0 (LWP 29226)]
[New Thread 0x7fffe5bfd6c0 (LWP 29227)]                                                                                                                      
[New Thread 0x7fffe53fc6c0 (LWP 29228)]
[2023-09-27 17:08:27.589] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/config                                                                              
[2023-09-27 17:08:27.589] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/config.jsonc
[2023-09-27 17:08:27.589] [debug] Try expanding: $HOME/.config/waybar/config
[2023-09-27 17:08:27.589] [debug] Found config file: $HOME/.config/waybar/config
[2023-09-27 17:08:27.589] [info] Using configuration file /home/simon/.config/waybar/config
[2023-09-27 17:08:27.589] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style.css
[2023-09-27 17:08:27.589] [debug] Try expanding: $HOME/.config/waybar/style.css
[2023-09-27 17:08:27.589] [debug] Found config file: $HOME/.config/waybar/style.css
[2023-09-27 17:08:27.589] [info] Using CSS file /home/simon/.config/waybar/style.css
[2023-09-27 17:08:27.592] [debug] Output detection done: eDP-1 (AU Optronics 0xC693)
[2023-09-27 17:08:27.593] [debug] Output detection done: HDMI-A-1 (Samsung Electric Company LC27G7xT H4ZN500371)
[New Thread 0x7fffe4a9a6c0 (LWP 29229)]
[New Thread 0x7fffdf7fe6c0 (LWP 29230)]
[2023-09-27 17:08:27.596] [trace] actual output HDMI-A-1, output found HDMI-A-1, node (focused) found simon:~
[New Thread 0x7fffdeffd6c0 (LWP 29231)]
[New Thread 0x7fffde7fc6c0 (LWP 29232)]
[New Thread 0x7fffddffb6c0 (LWP 29233)]
[2023-09-27 17:08:27.597] [debug] network: new default route via 192.168.1.1 on if2 metric 600
[2023-09-27 17:08:27.597] [debug] network: wlp0s20f3, new addr 192.168.1.115/24
[2023-09-27 17:08:27.597] [debug] network: wlp0s20f3, new addr 192.168.1.115/24
[New Thread 0x7fffdd7fa6c0 (LWP 29234)]
[New Thread 0x7fffdcff96c0 (LWP 29235)]                                                                                                                      
[2023-09-27 17:08:27.615] [debug] [wireplumber]: preparing object manager
[2023-09-27 17:08:27.615] [debug] [wireplumber]: loading required modules
[2023-09-27 17:08:27.618] [debug] [wireplumber]: connecting to pipewire...                                                                                   
[2023-09-27 17:08:27.618] [debug] [wireplumber]: connected!
[2023-09-27 17:08:27.618] [debug] [wireplumber]: activating plugins
[New Thread 0x7fffc7fff6c0 (LWP 29236)]
[New Thread 0x7fffc77fe6c0 (LWP 29237)]
[New Thread 0x7fffc6ffd6c0 (LWP 29238)]

Thread 1 "waybar" received signal SIGSEGV, Segmentation fault.
g_type_check_instance (type_instance=0x3686) at ../gobject/gtype.c:4270
4270         if (type_instance->g_class)                                                                                                                    
(gdb) bt
#0  g_type_check_instance (type_instance=0x3686) at ../gobject/gtype.c:4270
#1  0x00007ffff6bfbf1e in g_signal_connect_data (instance=0x3686, detailed_signal=0x5555556a579e "notify", 
    c_handler=0x555555630f40 <waybar::modules::upower::UPower::deviceNotify_cb(UpDevice*, _GParamSpec*, void*)>, data=0x5555558eb170, destroy_data=0x0, 
    connect_flags=G_CONNECT_DEFAULT) at ../gobject/gsignal.c:2583
#2  0x0000555555633fe1 in waybar::modules::upower::UPower::setDisplayDevice (this=0x5555558eb170) at ../src/modules/upower/upower.cpp:217
#3  0x00005555555b395c in waybar::modules::upower::UPower::UPower (id=..., config=..., this=0x5555558eb170) at ../src/modules/upower/upower.cpp:98
#4  waybar::Factory::makeModule (this=<optimized out>, name="upower") at ../src/factory.cpp:22
#5  0x00005555555d936e in waybar::Bar::getModules (this=this@entry=0x55555582d240, factory=..., pos="modules-right", group=group@entry=0x0)
    at ../src/bar.cpp:756
#6  0x00005555555daf52 in waybar::Bar::setupWidgets (this=0x55555582d240) at ../src/bar.cpp:806
#7  waybar::Bar::Bar (this=<optimized out>, w_output=<optimized out>, w_config=..., this=<optimized out>, w_output=<optimized out>, w_config=...)
    at ../src/bar.cpp:619
#8  0x00005555555e43bc in std::make_unique<waybar::Bar, waybar::waybar_output*, Json::Value const&> () at /usr/include/c++/13/bits/unique_ptr.h:1069
#9  waybar::Client::handleOutputDone (data=<optimized out>) at ../src/client.cpp:87
#10 0x00007ffff66cebe6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#11 0x00007ffff66cb4bf in ffi_call_int (cif=cif@entry=0x7fffffffcad0, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, 
    closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
#12 0x00007ffff66ce18e in ffi_call (cif=cif@entry=0x7fffffffcad0, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7fffffffcba0)
    at ../src/x86/ffi64.c:710
#13 0x00007ffff7fa6f0e in wl_closure_invoke (closure=closure@entry=0x5555559f5480, target=<optimized out>, target@entry=0x55555595bfc0, 
    opcode=opcode@entry=2, data=<optimized out>, flags=1) at ../src/connection.c:1025
#14 0x00007ffff7fa7793 in dispatch_event (display=display@entry=0x555555770f80, queue=0x555555771070) at ../src/wayland-client.c:1631
#15 0x00007ffff7fa7a3c in dispatch_queue (queue=0x555555771070, display=0x555555770f80) at ../src/wayland-client.c:1777
#16 wl_display_dispatch_queue_pending (display=display@entry=0x555555770f80, queue=queue@entry=0x555555771070) at ../src/wayland-client.c:2019
#17 0x00007ffff7fa9664 in wl_display_dispatch_queue (queue=<optimized out>, display=<optimized out>) at ../src/wayland-client.c:1995
#18 0x00007ffff7faa86f in wl_display_roundtrip_queue (display=display@entry=0x555555770f80, queue=queue@entry=0x555555771070)
    at ../src/wayland-client.c:1403
#19 0x00007ffff7faa8b0 in wl_display_roundtrip (display=display@entry=0x555555770f80) at ../src/wayland-client.c:1432
#20 0x00007ffff680e927 in gtk_wayland_init_if_needed () at ../src/gtk-wayland.c:164
#21 gtk_wayland_init_if_needed () at ../src/gtk-wayland.c:152
#22 0x00007ffff6818c45 in gtk_layer_init_for_window (window=0x555555866c30) at ../src/api.c:80
#23 0x00005555555d11e7 in waybar::GLSSurfaceImpl::GLSSurfaceImpl (this=<optimized out>, window=..., output=..., this=<optimized out>, window=..., 
    output=...) at ../src/bar.cpp:114
#24 0x00005555555da9f0 in std::make_unique<waybar::GLSSurfaceImpl, Gtk::Window&, waybar::waybar_output&> () at /usr/include/c++/13/bits/unique_ptr.h:1069
#25 waybar::Bar::Bar (this=<optimized out>, w_output=<optimized out>, w_config=..., this=<optimized out>, w_output=<optimized out>, w_config=...)
    at ../src/bar.cpp:569
#26 0x00005555555e43bc in std::make_unique<waybar::Bar, waybar::waybar_output*, Json::Value const&> () at /usr/include/c++/13/bits/unique_ptr.h:1069
#27 waybar::Client::handleOutputDone (data=<optimized out>) at ../src/client.cpp:87
#28 0x00007ffff66cebe6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#29 0x00007ffff66cb4bf in ffi_call_int (cif=cif@entry=0x7fffffffd540, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, 
    closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
#30 0x00007ffff66ce18e in ffi_call (cif=cif@entry=0x7fffffffd540, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7fffffffd610)
    at ../src/x86/ffi64.c:710
#31 0x00007ffff7fa6f0e in wl_closure_invoke (closure=closure@entry=0x5555559f7460, target=<optimized out>, target@entry=0x55555588ffa0, 
    opcode=opcode@entry=2, data=<optimized out>, flags=1) at ../src/connection.c:1025
#32 0x00007ffff7fa7793 in dispatch_event (display=display@entry=0x555555770f80, queue=0x555555771070) at ../src/wayland-client.c:1631
#33 0x00007ffff7fa7a3c in dispatch_queue (queue=0x555555771070, display=0x555555770f80) at ../src/wayland-client.c:1777
#34 wl_display_dispatch_queue_pending (display=0x555555770f80, queue=0x555555771070) at ../src/wayland-client.c:2019
#35 0x00007ffff7fa7aa0 in wl_display_dispatch_pending (display=<optimized out>) at ../src/wayland-client.c:2082
#36 0x00007ffff76d2c90 in _gdk_wayland_display_queue_events (display=<optimized out>) at ../gdk/wayland/gdkeventsource.c:201
#37 0x00007ffff769e70b in gdk_display_get_event (display=0x555555775d50) at ../gdk/gdkdisplay.c:442
#38 0x00007ffff76d9dfe in gdk_event_source_dispatch (base=<optimized out>, callback=<optimized out>, data=<optimized out>)
    at ../gdk/wayland/gdkeventsource.c:120
#39 0x00007ffff6ae04fc in g_main_dispatch (context=0x55555577e680) at ../glib/gmain.c:3460
#40 g_main_context_dispatch (context=0x55555577e680) at ../glib/gmain.c:4200
#41 0x00007ffff6b3e6b8 in g_main_context_iterate.isra.0 (context=0x55555577e680, block=1, dispatch=1, self=<optimized out>) at ../glib/gmain.c:4276
#42 0x00007ffff6addb83 in g_main_context_iteration (context=context@entry=0x55555577e680, may_block=may_block@entry=1) at ../glib/gmain.c:4343
#43 0x00007ffff6d1501d in g_application_run (application=0x55555576b7a0, argc=<optimized out>, argv=0x7fffffffe5b8) at ../gio/gapplication.c:2573
#44 0x00005555555a6d26 in waybar::Client::main (this=0x555555707ce0, argc=<optimized out>, argv=<optimized out>)
    at /usr/include/glibmm-2.4/glibmm/refptr.h:259
#45 0x00005555555a4afd in main (argc=3, argv=0x7fffffffe5b8) at ../src/main.cpp:106

The displayDevice is 0x3686 and it segfaults when dereferencing it in g_signal_connect_data(). Looking at your logging patch that's the information you wanted, no? @LukashonakV

StayPirate commented 8 months ago

Hi all, is there any update on this? @M3t0r are you facing the same issue?

xvladqt commented 6 months ago

Hi all, i have same problem, when i set "native-path" and try run waybar

➜ waybar
[2023-12-24 12:21:12.403] [info] Using configuration file /home/xvladqt/.config/waybar/config
[2023-12-24 12:21:12.404] [info] Discovered appearance 'dark'
[2023-12-24 12:21:12.404] [info] Using CSS file /home/xvladqt/.config/waybar/style.css
[2023-12-24 12:21:12.406] [warning] Mapping is not an object
[2023-12-24 12:21:12.406] [info] Hyprland IPC starting
[1]    235248 segmentation fault (core dumped)  waybar

upower --dump

Device: /org/freedesktop/UPower/devices/headphones_dev_00_0A_45_23_95_FA
  native-path:          /org/bluez/hci0/dev_00_0A_45_23_95_FA
  model:                LE_ATH-M50xBT2
  serial:               00:0A:45:23:95:FA
  power supply:         no
  updated:              нд, 24-гру-2023 10:30:19 +0200 (6692 seconds ago)
  has history:          yes
  has statistics:       no
  headphones
    warning-level:       none
    percentage:          70%
    icon-name:          'battery-missing-symbolic'
  History (charge):
    1703413311  0,000   unknown
  History (rate):
    1703413311  0,000   unknown

config

    "upower": { 
        "native-path": "/org/bluez/hci0/dev_00_0A_45_23_95_FA"
    }

gdp run

Reading symbols from waybar...
(No debugging symbols found in waybar)
(gdb) run
Starting program: /usr/bin/waybar
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff27ff6c0 (LWP 236645)]
[New Thread 0x7ffff19ff6c0 (LWP 236646)]
[New Thread 0x7fffe91fe6c0 (LWP 236647)]
[New Thread 0x7ffff11fe6c0 (LWP 236648)]
[New Thread 0x7ffff09fd6c0 (LWP 236649)]
[New Thread 0x7fffebfff6c0 (LWP 236650)]
[2023-12-24 12:22:48.575] [info] Using configuration file /home/xvladqt/.config/waybar/config
[2023-12-24 12:22:48.576] [info] Discovered appearance 'dark'
[2023-12-24 12:22:48.576] [info] Using CSS file /home/xvladqt/.config/waybar/style.css
[2023-12-24 12:22:48.578] [warning] Mapping is not an object
[New Thread 0x7fffeb7fe6c0 (LWP 236652)]
[2023-12-24 12:22:48.579] [info] Hyprland IPC starting
[Detaching after fork from child process 236653]
[New Thread 0x7fffeafa56c0 (LWP 236654)]
[New Thread 0x7fffea7a46c0 (LWP 236655)]
[New Thread 0x7fffe9fa36c0 (LWP 236656)]
[New Thread 0x7fffe89fd6c0 (LWP 236657)]
[New Thread 0x7fffc7fff6c0 (LWP 236658)]
[New Thread 0x7fffc77fe6c0 (LWP 236659)]
[2023-12-24 12:22:48.589] [warning] module temperature: Disabling module "temperature", Can't open /sys/class/thermal/thermal_zone0/temp
[2023-12-24 12:22:48.590] [warning] module backlight: Disabling module "backlight", No backlight found
[2023-12-24 12:22:48.596] [warning] Timezone: Europe/Kiyv. Europe/Kiyv not found in timezone database
[New Thread 0x7fffc6ffd6c0 (LWP 236660)]
[New Thread 0x7fffc67fc6c0 (LWP 236661)]
[Thread 0x7fffc67fc6c0 (LWP 236661) exited]
[New Thread 0x7fffc67fc6c0 (LWP 236662)]
[New Thread 0x7fffc5ffb6c0 (LWP 236663)]
[Thread 0x7fffc67fc6c0 (LWP 236662) exited]
[Thread 0x7fffc5ffb6c0 (LWP 236663) exited]
[New Thread 0x7fffc5ffb6c0 (LWP 236664)]
[New Thread 0x7fffc67fc6c0 (LWP 236665)]
[Thread 0x7fffc5ffb6c0 (LWP 236664) exited]
[Thread 0x7fffc67fc6c0 (LWP 236665) exited]

(waybar:236642): GLib-GObject-CRITICAL **: 12:22:48.602: ../glib/gobject/gsignal.c:2088: type 'GtkWindow' is already overridden for signal id '73'

(waybar:236642): GLib-GObject-CRITICAL **: 12:22:48.602: ../glib/gobject/gsignal.c:2088: type 'GtkWindow' is already overridden for signal id '72'
[2023-12-24 12:22:48.602] [warning] Mapping is not an object
[Detaching after fork from child process 236666]
[New Thread 0x7fffc67fc6c0 (LWP 236667)]

Thread 1 "waybar" received signal SIGSEGV, Segmentation fault.
0x00007ffff6c0071d in g_type_check_instance () from /usr/lib/libgobject-2.0.so.0
Frankkkkk commented 5 months ago

BTW, #2855 fixes it for me :-) Thanks @SquishyPandaDev :-)

xvladqt commented 4 months ago

BTW, #2855 fixes it for me :-) Thanks @SquishyPandaDev :-)

Thanks, i install waybar-git from aur, and now this problem fixed for me.