wolfi-dev/os

exim - external DB lookups support not working

willdeane opened this issue · 1 comments

The Exim Makefile includes support for a number of external lookups but they aren't making into the final binary or being added as dynamic libs. I'm specifically looking for postgresql support.
https://github.com/wolfi-dev/os/blob/main/exim/exim.Makefile

The Makefile includes config to build the lookup modules/support:

LOOKUP_CDB=2
LOOKUP_DBM=2
LOOKUP_DNSDB=2
LOOKUP_DSEARCH=yes
LOOKUP_LSEARCH=yes
LOOKUP_MODULE_DIR=/usr/lib/exim/
LOOKUP_MYSQL=2
LOOKUP_MYSQL_INCLUDE=-I/usr/include/mysql
LOOKUP_MYSQL_LIBS=-Wl,--no-as-needed -lmysqlclient
LOOKUP_PASSWD=yes
LOOKUP_PGSQL=2
LOOKUP_PGSQL_INCLUDE=-I/usr/include/postgresql
LOOKUP_PGSQL_LIBS=-Wl,--no-as-needed -lpq
LOOKUP_SQLITE=2
LOOKUP_SQLITE_LIBS=-Wl,--no-as-needed -lsqlite3

The yes indicates the support should be statically compiled into exim and the 2 indicates that they should be complied as dynamic libs. The LOOKUP_MODULE_DIR=/usr/lib/exim/ value specifies where the dynamic libs should be deployed

Building exim from within the wolfi-os dev container (make dev-container) with make package/exim produces a package which which doesn't include any of the dynamic modules:

~ # apk info -L exim
exim-4.98-r1 contains:
etc/exim/exim.conf
etc/mail/aliases
usr/sbin/exim
usr/sbin/mailq
usr/sbin/newaliases
usr/sbin/rmail
usr/sbin/rsmtp
usr/sbin/runq
usr/sbin/sendmail
usr/share/man/man8/exim.8
var/lib/db/sbom/exim-4.98-r1.spdx.json
~ # 

Logs from the build suggest the shared libs are being built:

2024/10/04 17:06:21 INFO cc -shared cdb.c
2024/10/04 17:06:21 INFO cc -shared dbmdb.c
2024/10/04 17:06:22 INFO cc -shared dnsdb.c
2024/10/04 17:06:22 INFO cc -shared mysql.c
2024/10/04 17:06:22 INFO cc -shared pgsql.c
2024/10/04 17:06:22 WARN pgsql.c: In function 'perform_pgsql_search':
2024/10/04 17:06:22 WARN pgsql.c:295:41: warning: unknown conversion type character 'Y' in format [-Wformat=]
2024/10/04 17:06:22 WARN   295 |     DEBUG(D_lookup) debug_printf_indent("PGSQL: command does not return any data "
2024/10/04 17:06:22 WARN       |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024/10/04 17:06:22 WARN pgsql.c:296:44: note: format string is defined here
2024/10/04 17:06:22 WARN   296 |       "but was successful. Rows affected: %Y\n", result);
2024/10/04 17:06:22 WARN       |                                            ^
2024/10/04 17:06:22 WARN pgsql.c:295:41: warning: too many arguments for format [-Wformat-extra-args]
2024/10/04 17:06:22 WARN   295 |     DEBUG(D_lookup) debug_printf_indent("PGSQL: command does not return any data "
2024/10/04 17:06:22 WARN       |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024/10/04 17:06:22 INFO cc -shared sqlite.c
2024/10/04 17:06:23 INFO make[2]: Leaving directory '/home/build/build-Linux-x86_64/lookups'

I think the libs are being built but not packaged by melange

Alpine is using an almost identical make file but provides additional packages for each dynamically built lib - https://github.com/alpinelinux/aports/blob/master/community/exim/exim.Makefile

/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.20.3
PRETTY_NAME="Alpine Linux v3.20"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

/ # apk search exim
exim-4.98-r0
exim-cdb-4.98-r0
exim-dbmdb-4.98-r0
exim-dnsdb-4.98-r0
exim-doc-4.98-r0
exim-mysql-4.98-r0
exim-openrc-4.98-r0
exim-postgresql-4.98-r0
exim-scripts-4.98-r0
exim-sqlite-4.98-r0
exim-utils-4.98-r0

/ # apk info -L exim-postgresql
exim-postgresql-4.98-r0 contains:
usr/lib/exim/pgsql.so
/ #

This has been fixed by #32155