Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dunstify Crashes with Segmentation Fault when using -r #1443

Open
DanielLeviLucas opened this issue Feb 22, 2025 · 17 comments
Open

dunstify Crashes with Segmentation Fault when using -r #1443

DanielLeviLucas opened this issue Feb 22, 2025 · 17 comments

Comments

@DanielLeviLucas
Copy link

DanielLeviLucas commented Feb 22, 2025

Issue description:

  • The dunstify command crashes with a segmentation fault when the -r (replace) option is used.
  • Example command:
    ➜ dunstify -r "9999" "foo" "bar"
    zsh: segmentation fault (core dumped)  dunstify -r "9999" "foo" "bar"
    ➜ coredumpctl list dunstify
    
    Sat 2025-02-22 18:29:41 IST   21990 1000 1000 SIGSEGV present  /usr/bin/dunstify 396.4K

Installation info

  • Version: 1.12.1
    Dunst - A customizable and lightweight notification-daemon 1.12.1 (2024-12-17)
    Compiled on 2024-12-22 with the following options:
    X11 support: enabled
    Wayland support: enabled
    SYSCONFDIR set to: /etc
    Compiler flags: -g -std=gnu11 -pedantic -Wall -Wno-overlength-strings -Os -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/dunst/src=/usr/src/debug/dunst -flto=auto -pthread -MMD -MP
    Linker flags: -lm -lrt -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -lgio-2.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -lwayland-client -lwayland-cursor -lX11 -lXinerama -lXext -lXrandr -lXss
  • Install type: arch extras/dunst
  • Window manager / Desktop environment: qtile
  • Distro: Arch Linux
  • libnotify 0.8.4-1
@bynect
Copy link
Member

bynect commented Feb 22, 2025

it may be related to #1442
what version of libnotify >=0.8.4 do you have?

DanielLeviLucas added a commit to DanielLeviLucas/dotfiles that referenced this issue Feb 22, 2025
- An issue has been raised on the Dunst GitHub regarding this problem.
- dunst-project/dunst#1443
@DrWarpMan
Copy link

it may be related to #1442 what version of libnotify >=0.8.4 do you have?

I am also experiencing this, I have 0.8.4-1.

@Narrat
Copy link

Narrat commented Feb 22, 2025

Likely to be related. My dunstify was build with libnotify 0.8.3 and crashes with a segfault on 0.8.4.
And a rebuild fails the same way as mentioned in #1442

@0fflineuser
Copy link

Hi,
I have the same problem with libnotify 0.8.4-1 and rolling back to 0.8.3-1 fixes it.

@misterhackerman
Copy link

misterhackerman commented Feb 23, 2025

I'm not a programmer but i think If n->priv is NULL, the crash happens because it's being dereferenced.

typedef struct _NotifyNotificationPrivate
{
        guint32         id;
        char           *app_name;
        char           *summary;
        char           *body;

        /* NULL to use icon data. Anything else to have server lookup icon */
        char           *icon_name;

        /*
         * -1   = use server default
         *  0   = never timeout
         *  > 0 = Number of milliseconds before we timeout
         */
        gint            timeout;

        GSList         *actions;
        GHashTable     *action_map;
        GHashTable     *hints;

        gboolean        has_nondefault_actions;
        gboolean        updates_pending;

        gulong          proxy_signal_handler;

        gint            closed_reason;
} knickers;

int get_id(NotifyNotification *n)
{
    knickers *kn = n->priv;

    /* I'm sorry for taking a peek */
    return kn->id;
}

void put_id(NotifyNotification *n, guint32 id)
{
    knickers *kn = n->priv;

    /* And now I'm putting stuff into
     * your knickers. I'm sorry.
     * I'm so sorry.
     * */

    kn->id = id;
}

@bynect
Copy link
Member

bynect commented Feb 23, 2025

Yes, the previous version used a private pointer. I will push a fix asap

@bynect
Copy link
Member

bynect commented Feb 24, 2025

I don't see a way to modify ids in libnotify without private access. Which means that the -r options has to be disabled on newer libnotify or migrated to a dunst specific dbus call. Neither of these are ideal. Thoughts?

@misterhackerman
Copy link

misterhackerman commented Feb 24, 2025

Notify-send works well with the r option
Maybe cheat from that code

@bynect
Copy link
Member

bynect commented Feb 24, 2025

Notify-send works well with the r option
Maybe cheat from that code

Notify send does not provide the r option to begin with

@0fflineuser
Copy link

Yes it does, when you man notify-send there is :

       -r, --replace-id=REPLACE_ID
           The ID of the notification to replace.

@Nama
Copy link

Nama commented Feb 24, 2025

Same with dunstify -C 1234. Prolly related.

@bynect
Copy link
Member

bynect commented Feb 24, 2025

Yes it does, when you man notify-send there is :

       -r, --replace-id=REPLACE_ID
           The ID of the notification to replace.

On my system there is no such line. It seems it is a newer feature of notify send. I will check out how they do it

@bynect
Copy link
Member

bynect commented Feb 24, 2025

I made #1444 as an initial attempt. if someone can test it i will appreciate 👍🏻

@Darukutsu
Copy link

got same error as in ci

@bynect
Copy link
Member

bynect commented Feb 24, 2025

got same error as in ci

The ci error is just a warning with Werror.
But i will fix it asap anyway

@Nocturnalx
Copy link

tested #1446 on arch, compiles and runs, maintaining previous replacement bahaviour.

@bynect
Copy link
Member

bynect commented Feb 25, 2025

fixed by #1444
I will make a subrelease soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants