pamac-daemon coredumps on database sync with `upgrade`

As per title.

When running upgrade, pamac-daemon core dumps.

No issue happens when using pacman or pkcon (PackageKit).

Expected behavior

pamac update works as intended

What happens

Updating via pamac does not work.

How to reproduce

  1. pamac update

Logs

Core dump logs
$ coredumpctl debug 3831
           PID: 3831 (pamac-daemon)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Tue 2024-03-19 08:27:31 CET (1min 21s ago)
  Command Line: /usr/bin/pamac-daemon
    Executable: /usr/bin/pamac-daemon
 Control Group: /system.slice/pamac-daemon.service
          Unit: pamac-daemon.service
         Slice: system.slice
       Boot ID: cb2cc75e04c44c55a9fb8ba5282f33df
    Machine ID: 80a4412da0344f419c61a790576c4aba
      Hostname: archlinux-tug
       Storage: /var/lib/systemd/coredump/core.pamac-daemon.0.cb2cc75e04c44c55a9fb8ba5282f33df.3831.1710833251000000.zst (present)
  Size on Disk: 1.6M
       Message: Process 3831 (pamac-daemon) of user 0 dumped core.
                
                Stack trace of thread 10171:
                #0  0x0000718ca65d7272 n/a (libalpm.so.14 + 0x16272)
                #1  0x0000718ca65d2d8e alpm_db_update (libalpm.so.14 + 0x11d8e)
                #2  0x00005bfa31fec3fc pamac_alpm_utils_update_dbs (pamac-daemon + 0x1f3fc)
                #3  0x00005bfa31ff0315 pamac_alpm_utils_trans_refresh (pamac-daemon + 0x23315)
                #4  0x00005bfa3200e3ae ___lambda84_ (pamac-daemon + 0x413ae)
                #5  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #6  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #7  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 3833:
                #0  0x0000718ca5fa80bf __poll (libc.so.6 + 0xfb0bf)
                #1  0x0000718ca62f22f6 n/a (libglib-2.0.so.0 + 0xb82f6)
                #2  0x0000718ca6292162 g_main_context_iteration (libglib-2.0.so.0 + 0x58162)
                #3  0x0000718ca62921b2 n/a (libglib-2.0.so.0 + 0x581b2)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 3832:
                #0  0x0000718ca5fb388d syscall (libc.so.6 + 0x10688d)
                #1  0x0000718ca62ed337 g_cond_wait (libglib-2.0.so.0 + 0xb3337)
                #2  0x0000718ca625f1b4 n/a (libglib-2.0.so.0 + 0x251b4)
                #3  0x0000718ca62c7ace n/a (libglib-2.0.so.0 + 0x8dace)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 3831:
                #0  0x0000718ca5fa80bf __poll (libc.so.6 + 0xfb0bf)
                #1  0x0000718ca62f22f6 n/a (libglib-2.0.so.0 + 0xb82f6)
                #2  0x0000718ca6294b97 g_main_loop_run (libglib-2.0.so.0 + 0x5ab97)
                #3  0x00005bfa31fde0ec _vala_main (pamac-daemon + 0x110ec)
                #4  0x0000718ca5ed2cd0 n/a (libc.so.6 + 0x25cd0)
                #5  0x0000718ca5ed2d8a __libc_start_main (libc.so.6 + 0x25d8a)
                #6  0x00005bfa31fde125 _start (pamac-daemon + 0x11125)
                
                Stack trace of thread 10190:
                #0  0x0000718ca5fb388d syscall (libc.so.6 + 0x10688d)
                #1  0x0000718ca62edd13 g_cond_wait_until (libglib-2.0.so.0 + 0xb3d13)
                #2  0x0000718ca625f185 n/a (libglib-2.0.so.0 + 0x25185)
                #3  0x0000718ca62c857b n/a (libglib-2.0.so.0 + 0x8e57b)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 10188:
                #0  0x0000718ca5fb388d syscall (libc.so.6 + 0x10688d)
                #1  0x0000718ca62edd13 g_cond_wait_until (libglib-2.0.so.0 + 0xb3d13)
                #2  0x0000718ca625f185 n/a (libglib-2.0.so.0 + 0x25185)
                #3  0x0000718ca62c857b n/a (libglib-2.0.so.0 + 0x8e57b)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 3835:
                #0  0x0000718ca5fa80bf __poll (libc.so.6 + 0xfb0bf)
                #1  0x0000718ca62f22f6 n/a (libglib-2.0.so.0 + 0xb82f6)
                #2  0x0000718ca6294b97 g_main_loop_run (libglib-2.0.so.0 + 0x5ab97)
                #3  0x0000718ca64fa19c n/a (libgio-2.0.so.0 + 0x11219c)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                
                Stack trace of thread 10185:
                #0  0x0000718ca5fa80bf __poll (libc.so.6 + 0xfb0bf)
                #1  0x0000718ca62f22f6 n/a (libglib-2.0.so.0 + 0xb82f6)
                #2  0x0000718ca6292162 g_main_context_iteration (libglib-2.0.so.0 + 0x58162)
                #3  0x0000718ca660afde n/a (libdconfsettings.so + 0x5fde)
                #4  0x0000718ca62c5a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #5  0x0000718ca5f3855a n/a (libc.so.6 + 0x8b55a)
                #6  0x0000718ca5fb5a3c n/a (libc.so.6 + 0x108a3c)
                ELF object binary architecture: AMD x86-64

GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/pamac-daemon...

warning: Can't open file /root/.cache/dconf/user during file-backed mapping note processing
[New LWP 10171]
[New LWP 3833]
[New LWP 3832]
[New LWP 3831]
[New LWP 10190]
[New LWP 10188]
[New LWP 3835]
[New LWP 10185]
Downloading separate debug info for /usr/lib/libalpm.so.14
Downloading separate debug info for /usr/lib/libsoup-3.0.so.0                                                                                                                                                                                                                            
Downloading separate debug info for /usr/lib/libpolkit-gobject-1.so.0                                                                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libarchive.so.13                                                                                                                                                                                                                            
Downloading separate debug info for /usr/lib/libgpgme.so.11                                                                                                                                                                                                                              
Downloading separate debug info for /usr/lib/libsqlite3.so.0                                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/libpsl.so.5                                                                                                                                                                                                                                 
Downloading separate debug info for /usr/lib/libbz2.so.1.0                                                                                                                                                                                                                               
Downloading separate debug info for /usr/lib/libassuan.so.0                                                                                                                                                                                                                              
--Type <RET> for more, q to quit, c to continue without paging--                                                                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libcom_err.so.2
Downloading separate debug info for /usr/lib/libjson-glib-1.0.so.0                                                                                                                                                                                                                       
Downloading separate debug info for /usr/lib/libappstream.so.5                                                                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libxmlb.so.2                                                                                                                                                                                                                                
Downloading separate debug info for /usr/lib/libxml2.so.2                                                                                                                                                                                                                                
Downloading separate debug info for /usr/lib/libyaml-0.so.2                                                                                                                                                                                                                              
Downloading separate debug info for /usr/lib/libstemmer.so.0                                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/libicuuc.so.74                                                                                                                                                                                                                              
Downloading separate debug info for /usr/lib/libicudata.so.74                                                                                                                                                                                                                            
Downloading separate debug info for /usr/lib/gio/modules/libgiognomeproxy.so                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/gio/modules/libdconfsettings.so                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/gio/modules/libgiolibproxy.so                                                                                                                                                                                                               
Downloading separate debug info for /usr/lib/libnss_mymachines.so.2                                                                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libnss_mdns_minimal.so.2                                                                                                                                                                                                                    
Downloading separate debug info for /usr/lib/libnss_resolve.so.2                                                                                                                                                                                                                         
Downloading separate debug info for /usr/lib/libnss_myhostname.so.2                                                                                                                                                                                                                      
Downloading separate debug info for /usr/lib/libp11-kit.so.0                                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/gio/modules/libgiognutls.so                                                                                                                                                                                                                 
Downloading separate debug info for /usr/lib/libgnutls.so.30                                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/libbrotlienc.so.1                                                                                                                                                                                                                           
Downloading separate debug info for /usr/lib/libtasn1.so.6                                                                                                                                                                                                                               
Downloading separate debug info for /usr/lib/libnettle.so.8                                                                                                                                                                                                                              
Downloading separate debug info for /usr/lib/libhogweed.so.6                                                                                                                                                                                                                             
Downloading separate debug info for /usr/lib/libgmp.so.10                                                                                                                                                                                                                                
Downloading separate debug info for /usr/lib/pkcs11/p11-kit-trust.so                                                                                                                                                                                                                     
Downloading separate debug info for system-supplied DSO at 0x7ffc07c39000                                                                                                                                                                                                                
[Thread debugging using libthread_db enabled]                                                                                                                                                                                                                                            
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/bin/pamac-daemon'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  _alpm_download (handle=0x718c9000abd0, payloads=<optimized out>, localpath=0x718c90015cb0 "/var/lib/pacman/sync/") at ../lib/libalpm/dload.c:1045
Downloading source file /usr/src/debug/pacman/pacman-6.1.0/build/../lib/libalpm/dload.c
1045                                            size_t sig_len = strlen(s->data) + strlen(payload->filepath) + 6;                                                                                                                                                                        
[Current thread is 1 (Thread 0x718ca32006c0 (LWP 10171))]
(gdb) backtrace full
#0  _alpm_download (handle=0x718c9000abd0, payloads=<optimized out>, localpath=0x718c90015cb0 "/var/lib/pacman/sync/") at ../lib/libalpm/dload.c:1045
        sig_fileurl = <optimized out>
        sig_len = <optimized out>
        retsig = <optimized out>
        payload = 0x718c900131f0
        s = 0x0
        ret = 0
        p = 0x718c900139b0
        updated = 1
        __func__ = {<optimized out> <repeats 15 times>}
#1  0x0000718ca65d2d8e in _alpm_download (localpath=0x718c90015cb0 "/var/lib/pacman/sync/", payloads=0x718c90012c10, handle=0x718c9000abd0) at ../lib/libalpm/dload.c:1002
        __func__ = {<optimized out> <repeats 15 times>}
        p = <optimized out>
        updated = <optimized out>
        payload = <optimized out>
        s = <optimized out>
        ret = <optimized out>
        sig_fileurl = <optimized out>
        sig_len = <optimized out>
        retsig = <optimized out>
        sig_fileurl = <optimized out>
        sig_len = <optimized out>
        retsig = <optimized out>
#2  alpm_db_update (handle=handle@entry=0x718c9000abd0, dbs=0x718c9000b360, force=force@entry=0) at ../lib/libalpm/be_sync.c:208
        syncpath = 0x718c90015cb0 "/var/lib/pacman/sync/"
        dbext = 0x718c9000ad70 ".db"
        i = 0x0
        ret = -1
        oldmask = 18
        payloads = 0x718c90012c10
        event = {type = ALPM_EVENT_DB_RETRIEVE_START, any = {type = ALPM_EVENT_DB_RETRIEVE_START}, package_operation = {type = ALPM_EVENT_DB_RETRIEVE_START, operation = 4294967295, oldpkg = 0x2, newpkg = 0x718c900063d0}, optdep_removal = {type = ALPM_EVENT_DB_RETRIEVE_START, pkg = 0x2, optdep = 0x718c900063d0}, scriptlet_info = {type = ALPM_EVENT_DB_RETRIEVE_START, line = 0x2 <error: Cannot access memory at address 0x2>}, database_missing = {type = ALPM_EVENT_DB_RETRIEVE_START, dbname = 0x2 <error: Cannot access memory at address 0x2>}, pkgdownload = {type = ALPM_EVENT_DB_RETRIEVE_START, file = 0x2 <error: Cannot access memory at address 0x2>}, pacnew_created = {type = ALPM_EVENT_DB_RETRIEVE_START, from_noupgrade = -1, oldpkg = 0x2, newpkg = 0x718c900063d0, file = 0x718ca5f48e93 <__GI___libc_free+115> "d\211+H\203\304\030[]\303\017\037"}, pacsave_created = {type = ALPM_EVENT_DB_RETRIEVE_START, oldpkg = 0x2, file = 0x718c900063d0 "x86_64"}, hook = {type = ALPM_EVENT_DB_RETRIEVE_START, when = (ALPM_HOOK_PRE_TRANSACTION | ALPM_HOOK_POST_TRANSACTION | unknown: 0xfffffffc)}, hook_run = {type = ALPM_EVENT_DB_RETRIEVE_START, name = 0x2 <error: Cannot access memory at address 0x2>, desc = 0x718c900063d0 "x86_64", position = 124848893628051, total = 45}, pkg_retrieve = {type = ALPM_EVENT_DB_RETRIEVE_START, num = 2, total_size = 124848525304784}}
        __func__ = "alpm_db_update"
#3  0x00005bfa31fec3fc in pamac_alpm_utils_update_dbs (self=self@entry=0x5bfa32e944f0, alpm_handle=alpm_handle@entry=0x718c9000abd0, force=force@entry=0) at src/pamac-daemon.p/alpm_utils.c:1939
        success = 1
        syncdbs = <optimized out>
        _tmp0_ = <optimized out>
        _tmp1_ = <optimized out>
        _tmp2_ = <optimized out>
        _inner_error0_ = 0x0
        result = <optimized out>
        __func__ = "pamac_alpm_utils_update_dbs"
#4  0x00005bfa31ff0315 in pamac_alpm_utils_trans_refresh (self=0x5bfa32e944f0, sender=<optimized out>, force_refresh=0) at src/pamac-daemon.p/alpm_utils.c:2085
        _tmp0_ = <optimized out>
        _tmp1_ = <optimized out>
        _tmp2_ = 0x0
        _tmp3_ = <optimized out>
        _tmp4_ = <optimized out>
        force = <optimized out>
        alpm_handle = 0x718c9000abd0
        _tmp12_ = 0x718c9000abd0
        _tmp13_ = 0x718c9000abd0
        success = 0
        _tmp14_ = 0x718c9000abd0
        _tmp15_ = <optimized out>
        _tmp19_ = <optimized out>
        _tmp20_ = <optimized out>
        _inner_error0_ = 0x0
        result = <optimized out>
        __func__ = "pamac_alpm_utils_trans_refresh"
#5  0x00005bfa3200e3ae in ___lambda84_ (_data14_=0x718c880025b0) at src/pamac-daemon.p/daemon.c:4128
        _tmp3_ = <optimized out>
        _data13_ = 0x718c88003450
        self = 0x5bfa32e65590
        success = <optimized out>
        _tmp0_ = <optimized out>
        result = <optimized out>
        _data13_ = <optimized out>
        self = <optimized out>
        _tmp0_ = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        success = <optimized out>
        result = <optimized out>
        _tmp1_ = <optimized out>
        _tmp2_ = <optimized out>
        _tmp3_ = <optimized out>
#6  ____lambda84__gthread_func (self=0x718c880025b0) at src/pamac-daemon.p/daemon.c:4141
        result = <optimized out>
#7  0x0000718ca62c5a45 in g_thread_proxy (data=0x5bfa32ead530) at ../glib/glib/gthread.c:831
        thread = 0x5bfa32ead530
        __func__ = "g_thread_proxy"
#8  0x0000718ca5f3855a in start_thread (arg=<optimized out>) at pthread_create.c:447
        ret = <optimized out>
        pd = <optimized out>
        out = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {124848846145216, 4654479111721388666, -120, 0, 140720438692032, 124848837754880, -6664960037529515398, -6664971273547871622}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#9  0x0000718ca5fb5a3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
/etc/pacman.conf
$ tail -n 60 /etc/pacman.conf | grep -v -e "^#" -e "^$"
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
[home_ItachiSan_archlinux]
Server = https://download.opensuse.org/repositories/home:/ItachiSan:/archlinux/standard/$arch
[openSUSE_Tools_Arch]
Server = https://download.opensuse.org/repositories/openSUSE:/Tools/Arch/$arch
[aur_dependencies]
SigLevel = Optional
Server = file:///home/giovanni/Projects/AUR/deps_repo
Edited by Giovanni Santini