Cisco-Talos / clamav

ClamAV - Documentation is here: https://docs.clamav.net
https://www.clamav.net/
GNU General Public License v2.0
4.43k stars 706 forks source link

For RAR load, check LD_LIBRARY_PATH before checking install path #1258

Closed micahsnyder closed 6 months ago

micahsnyder commented 6 months ago

ClamAV initalization's rarload() function tries to load libclamunrar_iface from the install path before checking under LD_LIBRARY_PATH. This means the unit tests will use the wrong unrar library if testing on a system where ClamAV is already installed. In the event there is an ABI break between versions, this will cause a bunch of tests to fail.

This commit fixes the issue by checking for libclamunrar_iface under LD_LIBRARY_PATH first before checking in the install lib directory.

Note in the previous version we were also checking LD_LIBRARY_PATH on Windows, which is not a thing. I removed this.

Fixes: https://github.com/Cisco-Talos/clamav/issues/1249

Also removed check for WARN_DLOPEN_FAIL define, which was not used, and mistakenly set for the unrar library build target.

micahsnyder commented 6 months ago

@TheRaynMan could use re-review. I tidied it up further while trying to figure out why there were test failures in Jenkins on Windows. (didn't figure it out, seemed fine to me).

Will continue to investigate.

micahsnyder commented 6 months ago

Apparently GitHub actions on macOS fails today as well for a couple different reasons. I'm fixing them in this PR as well.

micahsnyder commented 6 months ago

UGH finally found the correct path for brew library installs after github's change to the macOS runners: /opt/homebrew/include and /opt/homebrew/lib.

I also fixed the windows build issues which had to do with the length of the path/commands in our Jenkins and not an actual bug in our code afaict. I solved that by relocating the build directory to be next to the source dir and to use a short directory name. Previously had been longer and in a subdirectory of the source directory.

I should be done fussing with this now.