sgrif/pq-sys

Segfault when running tests on alpine

l-austenfeld opened this issue · 2 comments

There seems to be an issue on running this crate on alpine linux.
Minimal steps to reproduce (using docker)

docker pull rust:alpine
docker run --rm -it rust:alpine

and in the container

git clone https://github.com/sgrif/pq-sys.git
cd pq-sys/
cargo test

This will crash with a message like this

running 1 test
error: test failed, to rerun pass `--test smoke`

Caused by:
  process didn't exit successfully: `/pq-sys/target/debug/deps/smoke-52fb52bee77047a8` (signal: 11, SIGSEGV: invalid memory reference)

I tried to debug this and stepped through the disassembled binary. It seems to call a null pointer where it tries to call PQinitSSL. I confirmed that the generated assembly is the same on a glibc based system (where the test passes).
Sadly this is as far as I got. I have no idea what is going on here, but maybe someone else knows.

I think the generate test is platform specific for the platform used to generate the bindings. I'm happy to accept a PR to update the test there.
Generally speaking: We are also look for contributions to have a basic CI setup for this repo, which could test things like that.

I've tried to reproduce this and it does not happen anymore with a bundled build. Also there was "recently" a fix for a openssl related crash from the postgres project, that might have fixed that.

I'm closing this issue now. Feel free to add more details if that happens again. It would be good to know all the installed relevant packages (libpq, openssl) and their version in that case.