Giter Club home page Giter Club logo

alpm.rs's People

Contributors

0x1793d1 avatar 0x61nas avatar bluskript avatar daaku avatar fosskers avatar foxiedev avatar grego avatar morganamilo avatar nyasakiat avatar sapphirusberyl avatar xxxxxxxxxxxxxxxxxx-x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alpm.rs's Issues

filename method of Package should return Option<&str>

Local packages don't have a "filename" field. Therefore, calling filename() results in a panic.

Minimal reproducible example:

use alpm::Alpm;

fn main() {
    let alpm = Alpm::new("/", "/var/lib/pacman").unwrap();
    let pkg = alpm.localdb().pkgs().find_satisfier("systemd").unwrap();
    dbg!(pkg.name());
    dbg!(pkg.filename());
}

Output:

[src/main.rs:6] pkg.name() = "systemd"
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/lightquantum/.cargo/registry/src/github.com-1ecc6299db9ec823/alpm-2.0.0/src/utils.rs:7:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/657bc01888e6297257655585f9c475a0801db6d2/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/657bc01888e6297257655585f9c475a0801db6d2/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/657bc01888e6297257655585f9c475a0801db6d2/library/core/src/panicking.rs:50:5
   3: core::option::Option<T>::unwrap
             at /rustc/657bc01888e6297257655585f9c475a0801db6d2/library/core/src/option.rs:386:21
   4: alpm::utils::from_cstr
             at /home/lightquantum/.cargo/registry/src/github.com-1ecc6299db9ec823/alpm-2.0.0/src/utils.rs:5:5
   5: alpm::package::Pkg::filename
             at /home/lightquantum/.cargo/registry/src/github.com-1ecc6299db9ec823/alpm-2.0.0/src/package.rs:94:18
   6: alpm_rust_min_reprod::main
             at ./src/main.rs:7:10
   7: core::ops::function::FnOnce::call_once
             at /rustc/657bc01888e6297257655585f9c475a0801db6d2/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Build fails

Current master f2768ea, and tag alpm-v2.1.3 build fails with this error

❯ cargo build
   Compiling pkg-config v0.3.22
   Compiling cini v0.1.1
   Compiling bitflags v1.3.2
   Compiling pacmanconf v1.0.0
   Compiling alpm-sys v2.1.2 (/tmp/tmp.lSWwTHHApn/alpm.rs/alpm-sys)
   Compiling alpm v2.1.3 (/tmp/tmp.lSWwTHHApn/alpm.rs/alpm)
error: doc alias attribute expects a string: #[doc(alias = "0")]
  --> alpm/src/db.rs:13:7
   |
13 | #[doc(alias("repo", "repository"))]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `alpm`

To learn more, run the command again with --verbose.

Non-optional `Package::arch` ?

I noticed that Package::arch returns in Option:

    pub fn arch(&self) -> Option<&'a str> {
        let arch = unsafe { alpm_pkg_get_arch(self.pkg) };
        unsafe { from_cstr_optional(arch) }
    }

Yet alpm itself seems total:

/** Returns the architecture for which the package was built.
 * @param pkg a pointer to package
 * @return a reference to an internal string
 */
const char *alpm_pkg_get_arch(alpm_pkg_t *pkg);

which has the exact same structure as name:

const char *alpm_pkg_get_name(alpm_pkg_t *pkg);

which is a total function in the Rust. Could the Rust also return a plain &'a str for arch()?

Static feature flag doesn't actually work

I built with alpm/static but it doesn't seem to actually do anything:

$ ldd target/release/unnamed_project
        linux-vdso.so.1 (0x00007ffe29feb000)
        libalpm.so.13 => /usr/lib/libalpm.so.13 (0x00007dc3617c3000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007dc36179e000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007dc3615bc000)
        libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x00007dc361000000)
        libarchive.so.13 => /usr/lib/libarchive.so.13 (0x00007dc360f36000)
        libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007dc360e72000)
        libgpgme.so.11 => /usr/lib/libgpgme.so.11 (0x00007dc361566000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007dc361a76000)
        libacl.so.1 => /usr/lib/libacl.so.1 (0x00007dc361a23000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007dc36153b000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007dc360e3f000)
        libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007dc360d6c000)
        liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007dc360d47000)
        libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007dc361a0e000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007dc360d2d000)
        libnghttp3.so.9 => /usr/lib/libnghttp3.so.9 (0x00007dc360d09000)
        libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x00007dc360cde000)
        libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007dc360cbc000)
        libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007dc360c73000)
        libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007dc360c5f000)
        libssl.so.3 => /usr/lib/libssl.so.3 (0x00007dc360b7f000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007dc360b2b000)
        libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007dc360b1c000)
        libassuan.so.0 => /usr/lib/libassuan.so.0 (0x00007dc360b07000)
        libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007dc360ae1000)
        libunistring.so.5 => /usr/lib/libunistring.so.5 (0x00007dc360927000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007dc36084f000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007dc360821000)
        libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007dc361535000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007dc360813000)
        libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007dc36080c000)
        libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007dc3607fb000)
        libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007dc3607d8000)

If I build with my Arch Linux backend disabled I get:

        linux-vdso.so.1 (0x00007ffeccfe0000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x000074a149e8a000)
        libc.so.6 => /usr/lib/libc.so.6 (0x000074a149ca8000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x000074a14a0b0000)

This is unfortunate as my plans involve making a cross platform binary that you can run on any (supported) distro and will set up your preferred packages and configs (I'm tired of having to remember what I need to install on new systems)

AlpmList and Lifetimes

Hey there, a quick question about lifetimes. I had thought that given Db<'a>, anything that comes out of it would also be 'a. Usually that's true, say with Db::pkg. When we call Package::depends(), we get an AlpmList<'a, Dep<'a>>. Okay, still looks good. The issue is when we try to do something with this list. The following doesn't compile:

let v: Vec<_> = p.depends().iter().map(|d| d.name()).collect();

We are told:

error[E0515]: cannot return value referencing function parameter `d`
  --> aura-core/src/deps.rs:71:60
   |
71 |                 let v: Vec<_> = p.depends().iter().map(|d| d.name()).collect();
   |                                                            -^^^^^^^
   |                                                            |
   |                                                            returns a value referencing data owned by the current function
   |                                                            `d` is borrowed here

I was surprised that it thinks the .map owns d, considering iter() is usually the borrowing variant (vs into_iter()). As a consequence I'm having trouble using this AlpmList specifically (other uses of it have been fine).

Is the depends() call freshly allocating, hence iter() owns the contents of the list?

`Alpm` handles and Concurrency

Related to #6 . We've talked in the past about sharing a single Alpm handle across threads, and now I've come to a point in my coding where it's finally (seeming) necessary.

There are a number of read-only operations I'd like to perform, namely native package lookups, and I'd like to do so concurrently. In my particular case I'm using rayon, and as a rule am keeping all usage of async of out this code base:

pkgs.into_par_iter()
        .map(|p| resolve_one(alpm, res.clone(), p))
        .collect::<Validated<(), Error>>();

Here alpm is passed in by the caller as &'a Alpm. References are normally fine to send across threads without any other Arcing or Mutexing, and I intend nothing mutable. Unfortunately this doesn't seem possible at the moment, with the compiler telling me:

error[E0277]: `UnsafeCell<std::option::Option<Box<(dyn alpm::cb::QuestionCbTrait + 'static)>>>` cannot be shared between threads safely

Wrapping the handle in Arcs, etc., doesn't solve it. So:

  1. Is there a way to do this already that I'm not seeing?
  2. If not, is there a reasonable change that could be made to allow this?

I suppose I could open a handle per thread, but that's really not ideal. I could also using the r2d2 pooling strategy that I figured out in the original Rust PoC. Although maybe that would fail now for the same reason? I will check.

Anyway, let me know your thoughts. Thank you kindly.

alpm.rs 3.0.4 fails to build with pacman 6.1.0

since libalpm.so.13 has been replaced with libalpm.so.14, the alpm crate fails to compile: error while loading shared libraries: libalpm.so.13: cannot open shared object file: No such file or directory

Segfault when dropping Alpm after calling Db::groups()

Minimal reproducible example:

#![allow(unused)]
fn main() {
    let conf = pacmanconf::Config::new().unwrap();
    let mut alpm = alpm::Alpm::new2(&conf.root_dir, &conf.db_path).unwrap();
    alpm_utils::configure_alpm(&mut alpm, &conf).unwrap();
    alpm::Alpm::new(conf.root_dir, conf.db_path)
        .unwrap()
        .localdb()
        .groups();
}

Dependencies: cargo add pacmanconf alpm alpm_utils

GDB backtrace:
image

Valgrind Output
==107909== Memcheck, a memory error detector
==107909== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==107909== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==107909== Command: ./target/debug/segfault
==107909== 
==107909== Invalid read of size 8
==107909==    at 0x486DA46: free_groupcache (db.c:494)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==  Address 0x58e5620 is 0 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid write of size 8
==107909==    at 0x486DA55: free_groupcache (db.c:495)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==  Address 0x58e5620 is 0 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid read of size 8
==107909==    at 0x486DA60: free_groupcache (db.c:493)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==  Address 0x58e5630 is 16 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid read of size 8
==107909==    at 0x485E513: alpm_list_free_inner (alpm_list.c:53)
==107909==    by 0x486DA88: free_groupcache (db.c:497)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==  Address 0x58e5620 is 0 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid read of size 8
==107909==    at 0x485E52F: alpm_list_free_inner (alpm_list.c:56)
==107909==    by 0x486DA88: free_groupcache (db.c:497)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==  Address 0x58e5630 is 16 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid read of size 8
==107909==    at 0x485E4C7: alpm_list_free (alpm_list.c:41)
==107909==    by 0x486DA98: free_groupcache (db.c:497)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==  Address 0x58e5630 is 16 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== Invalid free() / delete / delete[] / realloc()
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x486DA98: free_groupcache (db.c:497)
==107909==    by 0x486DB6C: _alpm_db_free_pkgcache (db.c:517)
==107909==    by 0x486D166: _alpm_db_free (db.c:329)
==107909==    by 0x486C57D: _alpm_db_unregister (db.c:75)
==107909==    by 0x485E409: alpm_release (alpm.c:106)
==107909==    by 0x118693: <alpm::alpm::Alpm as core::ops::drop::Drop>::drop (alpm.rs:33)
==107909==    by 0x1180C6: core::ptr::drop_in_place<alpm::alpm::Alpm> (mod.rs:490)
==107909==    by 0x1152FA: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==  Address 0x58e5620 is 0 bytes inside a block of size 24 free'd
==107909==    at 0x484426F: free (vg_replace_malloc.c:884)
==107909==    by 0x485E4DA: alpm_list_free (alpm_list.c:42)
==107909==    by 0x11494A: <alpm::list::AlpmListMut<T> as core::ops::drop::Drop>::drop (list.rs:250)
==107909==    by 0x1148F9: core::ptr::drop_in_place<alpm::list::AlpmListMut<alpm::types::Group>> (mod.rs:490)
==107909==    by 0x114860: core::ptr::drop_in_place<core::result::Result<alpm::list::AlpmListMut<alpm::types::Group>,alpm::error::Error>> (mod.rs:490)
==107909==    by 0x1152E7: segfault::main (main.rs:9)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909==    by 0x114A69: std::rt::lang_start (rt.rs:165)
==107909==    by 0x11585D: main (in /home/user/tmp/rust/segfault/target/debug/segfault)
==107909==  Block was alloc'd at
==107909==    at 0x4841888: malloc (vg_replace_malloc.c:393)
==107909==    by 0x485E583: alpm_list_append (alpm_list.c:74)
==107909==    by 0x485E563: alpm_list_add (alpm_list.c:66)
==107909==    by 0x486E119: load_grpcache (db.c:669)
==107909==    by 0x486E215: _alpm_db_get_groupcache (db.c:688)
==107909==    by 0x486CF3F: alpm_db_get_groupcache (db.c:281)
==107909==    by 0x119D5C: alpm::db::Db::groups (db.rs:153)
==107909==    by 0x1152D8: segfault::main (main.rs:6)
==107909==    by 0x11482A: core::ops::function::FnOnce::call_once (function.rs:250)
==107909==    by 0x11456D: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:134)
==107909==    by 0x114A90: std::rt::lang_start::{{closure}} (rt.rs:166)
==107909==    by 0x146A9B: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:287)
==107909==    by 0x146A9B: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:487)
==107909==    by 0x146A9B: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:140)
==107909==    by 0x146A9B: {closure#2} (rt.rs:148)
==107909==    by 0x146A9B: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:487)
==107909==    by 0x146A9B: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:451)
==107909==    by 0x146A9B: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:140)
==107909==    by 0x146A9B: std::rt::lang_start_internal (rt.rs:148)
==107909== 
==107909== 
==107909== HEAP SUMMARY:
==107909==     in use at exit: 0 bytes in 0 blocks
==107909==   total heap usage: 51,041 allocs, 51,064 frees, 7,679,068 bytes allocated
==107909== 
==107909== All heap blocks were freed -- no leaks are possible
==107909== 
==107909== For lists of detected and suppressed errors, rerun with: -s
==107909== ERROR SUMMARY: 161 errors from 7 contexts (suppressed: 0 from 0)

I can also reproduce this in the latest version of paru (commit 257e01155501e3f93ed218f3853156a030b20c58) so I don't think it's from how I'm setting up the Alpm struct.
paru patch file:

diff --git a/src/config.rs b/src/config.rs
index 946d2d2..a9938d0 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -853,6 +853,8 @@ impl Config {
                 )
             })?;
 
+        alpm.localdb().groups().unwrap();
+
         alpm.set_question_cb((self.no_confirm, self.color), question);
         alpm.set_dl_cb((), download);
         alpm.set_log_cb(self.color, log);

Lifetime on callbacks

Hi everybody,

Is there a possibility to make the callbacks (e.g. the params passed to set_log_cb) have a shorter lifetime (e.g. the lifetime of the Alpm instance) than 'static? I don't know enough about libalpm itself to know if this is a possibility and if we have a guarantee of the callbacks never being called after the handle is destroyed. But as far as I see it, the moment the Alpm instance is dropped, it takes all the callbacks with it anyways, right?

The reason I am asking is, that a 'static lifetime prevents me from doing pretty much anything but logging the passed log messages. If I'd like to send the messages to a database, suddenly my database handle needs to have a static lifetime etc.

If this is an extremely nonsensical and/or impossible idea, please just disregard it :)

Thanks for your work on this library,

Florian

Missing `Send` impl for `Alpm`?

Hi there. Between major versions 2 and 3, the Alpm type lost its Send implementation. This prevents it from being passed to other threads, even when wrapped in lock types like in Arc<Mutex<Alpm>>. Was this change intentional, or am I overlooking something?

Thanks,

Colin

Should CommitData::FileConflict carry OwnedFileConflict instead of OwnedConflict?

Hi, so I finally got around to updating a project of mine to v3 of this library. I stumbled across the changes to trans_commits return type, namely that I used to be able to get detailed data about file conflicts. Based on my previous usage, it feels like CommitData::FileConflict should carry an OwnedFileConflict, but it does not.

So I was wondering if this is a mistake on the libraries part or if I'm doing something wrong :)

Compilation error on aarch64

While trying to compile paru for aarch64, it seems compilation fails here:

error[E0308]: mismatched types
   --> /home/alarm/.cargo/git/checkouts/alpm.rs-a0070a235cf20bfa/306342e/alpm/src/cb.rs:244:60
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ---- ^^ expected fn pointer, found fn item
    |                                                       |
    |                                                       arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, _, _, *mut __va_list_tag)`
                  found fn item `extern "C" fn(_, _, _, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}`
help: the type constructed contains `extern "C" fn(*mut c_void, u32, *const u8, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}` due to the type of the argument passed
   --> /home/alarm/.cargo/git/checkouts/alpm.rs-a0070a235cf20bfa/306342e/alpm/src/cb.rs:244:55
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ^^^^^--^
    |                                                            |
    |                                                            this argument influences the type of `Some`
note: tuple variant defined here
   --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:578:5

This seems to be using the latest commit (306342e).

$ rustc --version
rustc 1.76.0 (07dca489a 2024-02-04)

APIs for file checksums?

pacman -Qii can list changed config files, and paccheck can find any changed files from packages. I can find neither functionality in the alpm crate (but maybe I missed something?). I would have expected it to be found in https://docs.rs/alpm/latest/alpm/struct.File.html

Is this something that would be possible to expose (getting the expected checksums of installed files). I'm also interested in getting the expected file contents of any of those changed files (in order to generate diffs for changed config files).

API changes for v3

  • Some getters should return Option #19
  • FileList::contains has unneeded Result<>
  • Alpm should not be Send
  • Rename CommitResult::FileConflict -> CommitResult::Fileconflicts
  • Rework Commit/Prepare Result to be lazy?
  • Add error and Commit/Prepare Result should be more consistent with eachother
  • Package::files() should be an option. No it's fine as is. Actually no
  • Remove handle needed to make an alpmlistmut and remove lifetimes.
  • &mut self for string setters

Alpm does not implement Send

It doesn't seem to be possible to use Alpm in threads safely, due to the presence of *mut alpm_handle_t in the struct. Is there a good reason for this, or is it maybe possible to refactor code to make it work in concurrent contexts?

error[E0308]: mismatched types

Affected Version

alpm.rs 144ced6 on aarch64
cargo 1.74.0

Description

Building from source fails, resulting in the error provided below.

Output

error[E0308]: mismatched types
   --> alpm/src/cb.rs:244:60
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ---- ^^ expected fn pointer, found fn item
    |                                                       |
    |                                                       arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, _, _, *mut __va_list_tag)`
                  found fn item `extern "C" fn(_, _, _, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}`
help: the type constructed contains `extern "C" fn(*mut c_void, u32, *const u8, [__va_list_tag; 1]) {logcb::<LogCbImpl<T, F>>}` due to the type of the argument passed
   --> alpm/src/cb.rs:244:55
    |
244 |         unsafe { alpm_option_set_logcb(self.as_ptr(), Some(cb), &*ctx as *const _ as *mut _) };
    |                                                       ^^^^^--^
    |                                                            |
    |                                                            this argument influences the type of `Some`
note: tuple variant defined here
   --> /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/option.rs:571:5

For more information about this error, try `rustc --explain E0308`.
error: could not compile `alpm` (lib) due to previous error

API enhancement

Hi,

In order to improve the API, I suggest to apply these modifications to the crate :

  • Replace <S: Into<String>> with <P: AsRef<Path>> for path typed arguments (given that we can still use &str).
  • Change the return type of the packages optionals attributes functions from &str (and "" if missing) for Option<&str> (and None if missing).

If you want, I can do the modification in a PR.

Possible UB in AnyQuestion::question

Hello, I'm not an alpm user, but I got here from this reddit post and I couldn't help but worry that AnyQuestion::question might be unsound. I see it in the public documentation here https://docs.rs/alpm/2.0.2/alpm/struct.AnyQuestion.html#method.question

Is there anything stopping a user from calling question twice in succession, generating two Question<'a> at the same time, which contain &mut's to the same thing, which (Because of the &mut aliasing rules) is insta UB (As far as I know)?

I do not have time right now but I will try to come up with an example later. Basically something of the form

let any_question = unimplemented!(); //Somehow get an any_question
let q1 = any_question.question();
let q2 = any_question.question();
// Both q1 and q2 have live &mut's to the same thing, which I think is UB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.