FS#79544 - [libredefender] Needs rebuild against clamav 1.2.0

Attached to Project: Arch Linux
Opened by Michal Wojdyla (micwoj92) - Saturday, 02 September 2023, 18:01 GMT
Last edited by kpcyrd (kpcyrd) - Sunday, 03 September 2023, 22:42 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To kpcyrd (kpcyrd)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: After clamav update soname version was bumped, but application was not rebuilt resulting in error:

warning: cannot resolve "libclamav.so=11-64", a dependency of "libredefender"
:: The following package cannot be upgraded due to unresolvable dependencies:
libredefender


Additional info:
* package version: 0.6.0-2
* config and/or log files N/A
* link to upstream bug report: N/A

Steps to reproduce:
1. try to install libredefender
2. get error.
This task depends upon

Closed by  kpcyrd (kpcyrd)
Sunday, 03 September 2023, 22:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  0.7.0-1
Comment by Christian Heusel (gromit) - Saturday, 02 September 2023, 18:26 GMT
The package in question fails to build against the latest clamav version:

```
Compiling clamav-rs v0.5.5
error[E0308]: mismatched types
--> /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clamav-rs-0.5.5/src/error.rs:23:47
|
23 | let ptr = clamav_sys::cl_strerror(self.code);
| ----------------------- ^^^^^^^^^ expected `cl_error_t`, found `i32`
| |
| arguments to this function are incorrect
|
note: function defined here
--> /usr/src/debug/libredefender/libredefender-0.6.0/target/release/build/clamav-sys-e936b018e2cdf245/out/bindings.rs:306:12
|
306 | pub fn cl_strerror(clerror: cl_error_t) -> *const ::std::os::raw::c_char;
| ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `clamav-rs` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
==> ERROR: A failure occurred in build().
Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/extra-x86_64/chris-1/build
```
Comment by Michal Wojdyla (micwoj92) - Saturday, 02 September 2023, 18:28 GMT
I forgot to link it, but I opened upstream issue shortly after https://github.com/kpcyrd/libredefender/issues/41
kpcyrd has a fork of clamav-rs bindings (with fix for clamav 1.0) , but issues are not enabled there.

Edit:
I just see you got different error than me, how did you try to build it?
Comment by Christian Heusel (gromit) - Saturday, 02 September 2023, 18:41 GMT
Ah yeah sorry, that was the second run where I had uncommented the patch in the PKGBUILD, here is my actual error:

```
Compiling colored v2.0.0
error[E0004]: non-exhaustive patterns: `cl_engine_field::CL_ENGINE_CACHE_SIZE` not covered
--> /build/.cargo/git/checkouts/clamav-rs-c584debbcab03daf/93b5ddc/src/engine.rs:447:11
|
447 | match field {
| ^^^^^ pattern `cl_engine_field::CL_ENGINE_CACHE_SIZE` not covered
|
note: `cl_engine_field` defined here
--> /usr/src/debug/libredefender/libredefender-0.6.0/target/release/build/clamav-sys-e936b018e2cdf245/out/bindings.rs:221:5
|
196 | pub enum cl_engine_field {
| ------------------------
...
221 | CL_ENGINE_CACHE_SIZE = 24,
| ^^^^^^^^^^^^^^^^^^^^ not covered
= note: the matched value is of type `cl_engine_field`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
483 ~ cl_engine_field::CL_ENGINE_PE_DUMPCERTS => EngineValueType::U32,
484 ~ cl_engine_field::CL_ENGINE_CACHE_SIZE => todo!(),
|

For more information about this error, try `rustc --explain E0004`.
error: could not compile `clamav-rs` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
```

I build like so:
```
$ pkgctl repo clone libredefender
$ pkgctl build --repo extra --rebuild libredefender
```

Note that this bug also triggered a bug[0] in devtools, usually one does not need to specify --repo and just `pkgctl build --rebuild libredefender` would be enough.

[0] https://gitlab.archlinux.org/archlinux/devtools/-/issues/189
Comment by loqs (loqs) - Saturday, 02 September 2023, 19:07 GMT
clamav 1.2 added the option CL_ENGINE_CACHE_SIZE [1] I think clamav-rs needs to add a line covering that at [2] then patch libredefender to use a version of clamav-rs containing that patch.

[1] https://github.com/Cisco-Talos/clamav/commit/e70493cf61b0601239e92f0496694809d005f758
[2] https://github.com/kpcyrd/clamav-rs/blob/clamav-1.0/src/engine.rs#L472
Comment by loqs (loqs) - Saturday, 02 September 2023, 22:35 GMT
The attached patch allows the package to build. It should not be applied to the repositories, it is purely for testing if there are other issues in the package it produces.
Comment by kpcyrd (kpcyrd) - Sunday, 03 September 2023, 22:42 GMT
It took me a good 4h of my weekend but I managed to port clamav-rs to 1.2 in a way that also still builds on ubuntu:22.04.