"T.Lux" <t...@ghelew.net> writes: > On 15 October 2017 at 16:26 GMT, Sebastien Marie wrote: > >> On Sun, Oct 15, 2017 at 11:56:31AM -0400, T.Lux wrote: >>> On 15 October 2017 at 05:19 GMT, Sebastien Marie wrote: >>> >>> > 2) recompile the port with debugging symbol, and extract the > >>> backtrace >>> > of the failure with gdb ? >>> > >>> > $ cd /usr/ports/x11/dunst >>> > $ make FETCH_PACKAGES=yes CFLAGS=-g >>> > $ gdb /usr/ports/pobj/dunst-1.2.0/dunst-1.2.0/dunst >>> > (gdb) run >>> > ... >>> > Program received signal SIGABRT, Aborted. >>> > (gdb) backtrace >>> Attached file (within .tar.gz): gdb_dunst.txt >> >> inlined backtrace for lazy readers. >> >> Starting program: /usr/ports/pobj/dunst-1.2.0/dunst-1.2.0/dunst >> [New process 11913] >> >> Program received signal SIGABRT, Aborted. >> _dl___syscall () at -:1 >> 1 -: No such file or directory. >> in - >> Current language: auto; currently asm >> #0 _dl___syscall () at -:1 >> #1 0x0000050ef1a00d38 in _dl_tryload_shlib ( >> libname=0x50ef1c14b50 >> "/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", >> type=Variable "type" is not available. >> ) at syscall.h:67 >> #2 0x0000050ef1a08d70 in _dl_load_shlib (libname=Variable "libname" >> is not available. >> ) at /usr/src/libexec/ld.so/library_subr.c:421 >> #3 0x0000050ef1a094f7 in dlopen (libname=0x50ee660f500 >> "/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", >> flags=Variable "flags" is not available. >> ) at /usr/src/libexec/ld.so/dlfcn.c:83 >> #4 0x0000050f65b4c9a2 in g_module_open ( >> file_name=0x50f3de7f580 >> "/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", >> flags=Variable "flags" is not available. >> ) at gmodule-dl.c:97 >> #5 0x0000050eaedeb8db in _gdk_pixbuf_load_module () from >> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1 >> #6 0x0000050eaedec83f in gdk_pixbuf_new_from_file () from >> /usr/local/lib/libgdk_pixbuf-2.0.so.3200.1 >> #7 0x0000050ca6b0d1ba in get_pixbuf_from_file >> (icon_path=0x50f3de7eb80 >> "/usr/local/share/icons/Moka/16x16/status//info.png") >> at src/x11/x.c:310 >> #8 0x0000050ca6b0ce31 in get_pixbuf_from_path >> (icon_path=0x50f844bc980 "info") at src/x11/x.c:349 >> #9 0x0000050ca6b0c7f6 in r_init_shared (c=0x50f65466000, >> n=0x50f2ccf8100) at src/x11/x.c:414 >> #10 0x0000050ca6b0c488 in r_create_layout_from_notification >> (c=0x50f65466000, n=0x50f2ccf8100) at src/x11/x.c:482 >> #11 0x0000050ca6b0a011 in r_create_layouts (c=0x50f65466000) at >> src/x11/x.c:534 >> #12 0x0000050ca6b09c15 in x_win_draw () at src/x11/x.c:653 >> #13 0x0000050ca6b02849 in run (data=0x0) at src/dunst.c:242 >> #14 0x0000050ca6b02dfd in dunst_main (argc=1, argv=0x7f7ffffe8388) >> at src/dunst.c:378 >> #15 0x0000050ca6b0dcf2 in main (argc=1, argv=0x7f7ffffe8388) at >> main.c:5 >> The program is running. Exit anyway? (y or n) >> >>> OK, my inexperienced analysis is that I'm using icons in my dunstrc >>> which >>> uses: >>> (a) >>> /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so >>> to load png icons. the latter call mmap(2) with protection >>> "PROT_EXEC" >>> to load icons which failed since pledge(2) was already requested >>> without "prot_exec" promise. >> >> libgdk_pixbuf-2.0.so tries to load dynamic library with dlopen() on >> first need. but it is already too late for pledge. >> >>> I would guess that adding the line below into your dunstrc would >>> reproduce this problem. >>> >>> icon_folders = /usr/local/share/icons/gnome/16x16/status/ >>> >>> correct? >> >> unsure. I still couldn't reproduce. it should be part of the >> problem. >> but I don't really know how to use this port :) >> >> A bindly try is to pledge(2) really late... in fact it is at end of >> the >> run() function, just before the sleep, so: >> - the program will call pledge(2) at each loop (not a problem >> per se) >> - the first loop is unpledged (but as initialization occurs in >> the >> first loop...) >> >> else we should isolate exactly what trigger dlopen() in the config >> file, >> and run unpledged in this case. > > > > Your diff fix my problem, thank you for that! As to why you cannot > reproduce it with the addition of the icon_folders directive in your > configuration file is quite strange. > I've attached the configuration file I am using, just in case... just > launch it with dunst -config /path/to/config/file > > Regards, > Thierry
Hmm, It indeed seems that the setting causing this is icon_position in the config file. When its not off, the icons are enabled and the dlopen occurs. What do you think about following patch, it adds prot_exec to pledge promises when icon_position != off. Timo Index: Makefile =================================================================== RCS file: /cvs/ports/x11/dunst/Makefile,v retrieving revision 1.3 diff -u -p -r1.3 Makefile --- Makefile 31 Aug 2017 20:57:00 -0000 1.3 +++ Makefile 17 Dec 2017 15:13:56 -0000 @@ -5,12 +5,13 @@ COMMENT= customizable and lightweight no GH_ACCOUNT = dunst-project GH_PROJECT = dunst GH_TAGNAME = v1.2.0 +REVISION = 0 CATEGORIES = x11 HOMEPAGE= https://dunst-project.org/ -MAINTAINER = Timo Myyra <timo.my...@wickedbsd.net> +MAINTAINER = Timo Myyra <timo.my...@bittivirhe.fi> # BSD PERMIT_PACKAGE_CDROM= Yes Index: patches/patch-src_dunst_c =================================================================== RCS file: /cvs/ports/x11/dunst/patches/patch-src_dunst_c,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_dunst_c --- patches/patch-src_dunst_c 31 Aug 2017 20:57:00 -0000 1.1 +++ patches/patch-src_dunst_c 17 Dec 2017 15:13:56 -0000 @@ -13,13 +13,21 @@ Index: src/dunst.c #include "dbus.h" #include "menu.h" #include "notification.h" -@@ -325,6 +328,9 @@ int dunst_main(int argc, char *argv[]) - int owner_id = initdbus(); - - x_setup(); -+ -+ if (pledge("stdio rpath proc exec", NULL) == -1) +@@ -368,6 +371,17 @@ int dunst_main(int argc, char *argv[]) + * graceful termination */ + guint term_src = g_unix_signal_add(SIGTERM, quit_signal, NULL); + guint int_src = g_unix_signal_add(SIGINT, quit_signal, NULL); ++ ++ /* allow prot_exec if icons are used */ ++ char *pledge_str; ++ if (settings.icon_position != icons_off) { ++ pledge_str = "stdio rpath proc exec prot_exec"; ++ } else { ++ pledge_str = "stdio rpath proc exec"; ++ } ++ ++ if (pledge(pledge_str, NULL) == -1) + err(1, "pledge"); - if (settings.startup_notification) { - notification *n = notification_create(); + run(NULL); + g_main_loop_run(mainloop);