noborus / trdsql

CLI tool that can execute SQL queries on CSV, LTSV, JSON, YAML and TBLN. Can output to various formats.
https://noborus.github.io/trdsql/
MIT License
1.96k stars 75 forks source link

Unit tests are fails with SIGSEGV on OpenBSD #282

Open catap opened 3 months ago

catap commented 3 months ago

Good day,

An attempt to run unit tests on OpenBSD is failed as:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb89edc]

goroutine 1 [running]:
modernc.org/libc.(*TLS).setErrno(0xf62a60?, {0x230380?, 0x3b2988?})
        /usr/ports/pobj/trdsql-1.0.0/go/pkg/mod/modernc.org/libc@v1.41.0/etc.go:190 +0xdc
modernc.org/libc.Xmalloc(0x0, 0x25b4e0?)
        /usr/ports/pobj/trdsql-1.0.0/go/pkg/mod/modernc.org/libc@v1.41.0/mem.go:37 +0xc5
modernc.org/libc.init()
        /usr/ports/pobj/trdsql-1.0.0/go/pkg/mod/modernc.org/libc@v1.41.0/libc_openbsd.go:49 +0x3bc
FAIL    github.com/noborus/trdsql       0.043s
FAIL
noborus commented 3 months ago

Thank you for the issue.

From the error, it was built with CGO_ENABLED=0. Please consider building with CGO_ENABLED=1.

And from the error, it looks like a similar issue to https://gitlab.com/cznic/libc/-/issues/34.

When I try to upgrade modernc.org/sqlite, it requires go1.21, so trdsql is hesitant to upgrade. If you need to, I recommend upgrading modernc.org/sqlite.

catap commented 3 months ago

When I try to upgrade modernc.org/sqlite, it requires go1.21, so trdsql is hesitant to upgrade. If you need to, I recommend upgrading modernc.org/sqlite.

Any reason to not upgrade go?

noborus commented 3 months ago

Any reason to not upgrade go?

I would like to keep old versions of go as much as possible, because there is a demand to run trdsql on older OS.

It is easy to compile with newer go versions, but if you increase the target version, it becomes difficult to compile with older go versions.