aports/community/amfora: wrong build procedure leads to crash
Golang produces statically linked binaries. Amfora build from their Git repository works all right. The Alpine binary replaces the original Makefile procedure with soemthing custom, resulting in a dynamically linked binary:
$ ldd /usr/bin/amfora
/lib/ld-musl-x86_64.so.1 (0x7f95402c8000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f95402c8000)
and a subsequent crash:
fatal error: sync: Unlock of unlocked RWMutex
goroutine 1 [running]:
sync.fatal({0x56528fdb0dc2?, 0x56528fb1c48b?})
runtime/panic.go:1061 +0x18
sync.(*RWMutex).Unlock(0x56529017f68c)
sync/rwmutex.go:209 +0x45
code.rocketnine.space/tslocum/cview.(*Application).Init(0x56529017f580)
code.rocketnine.space/tslocum/cview@v1.5.6-0.20210530175404-7e8817f20bdc/application.go:226 +0x8d
main.main()
github.com/makeworld-the-better-one/amfora/amfora.go:71 +0x5c5
goroutine 6 [semacquire]:
sync.runtime_Semacquire(0xc00014bec8?)
runtime/sema.go:62 +0x25
sync.(*WaitGroup).Wait(0xc000202000?)
sync/waitgroup.go:116 +0x48
github.com/makeworld-the-better-one/amfora/subscriptions.updateAll()
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:437 +0x45c
github.com/makeworld-the-better-one/amfora/subscriptions.Init.func1()
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:78 +0x13
created by github.com/makeworld-the-better-one/amfora/subscriptions.Init in goroutine 1
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:76 +0x2a5
goroutine 20 [runnable]:
reflect.(*rtype).NumField(0x56528fec8b40?)
reflect/type.go:760 +0x65
encoding/asn1.parseField({0x56528fec8b40?, 0xc00021a080?, 0xc00021e200?}, {0xc00022e000, 0x8a, 0x8a}, 0x0, {0x0, 0x0, 0x0, ...})
encoding/asn1/asn1.go:919 +0x1d1c
encoding/asn1.UnmarshalWithParams({0xc00022e000, 0x8a, 0x8a}, {0x56528fe7d460?, 0xc00021a080?}, {0x0, 0x0})
encoding/asn1/asn1.go:1120 +0x1b0
encoding/asn1.Unmarshal(...)
encoding/asn1/asn1.go:1093
crypto/x509.ParsePKCS1PrivateKey({0xc00022e000, 0x8a, 0x8a})
crypto/x509/pkcs1.go:57 +0x352
crypto/tls.parsePrivateKey({0xc00022e000, 0x8a, 0x8a})
crypto/tls/tls.go:340 +0x26
crypto/tls.X509KeyPair({0xc000222000?, 0xc00014db58?, 0x56528f9be785?}, {0xc000224000, 0xf1, 0x200})
crypto/tls/tls.go:299 +0x6bb
github.com/makeworld-the-better-one/go-gemini.(*Client).FetchWithHostAndCert(0xc000029620, {0xc000216138, 0x18}, {0xc00002f380?, 0xc00020c120?}, {0xc000222000, 0x236, 0x237}, {0xc000224000, 0xf1, ...})
github.com/makeworld-the-better-one/go-gemini@v0.12.1/client.go:201 +0x2bb
github.com/makeworld-the-better-one/go-gemini.(*Client).FetchWithCert(0xc00002f389?, {0xc00002f380, 0x26}, {0xc000222000, 0x236, 0x237}, {0xc000224000, 0xf1, 0x200})
github.com/makeworld-the-better-one/go-gemini@v0.12.1/client.go:167 +0x10f
github.com/makeworld-the-better-one/amfora/client.fetch({0xc00002f380, 0x26}, 0x0?)
github.com/makeworld-the-better-one/amfora/client/client.go:88 +0x77
github.com/makeworld-the-better-one/amfora/client.Fetch(...)
github.com/makeworld-the-better-one/amfora/client/client.go:107
github.com/makeworld-the-better-one/amfora/subscriptions.getResource({0xc00002f380, 0x26})
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:246 +0x37
github.com/makeworld-the-better-one/amfora/subscriptions.updatePage({0xc00002f380, 0x26})
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:357 +0x25
github.com/makeworld-the-better-one/amfora/subscriptions.updateAll.func1(0x0?, 0x0?)
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:381 +0xbf
github.com/makeworld-the-better-one/amfora/subscriptions.updateAll.func2()
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:406 +0x22
created by github.com/makeworld-the-better-one/amfora/subscriptions.updateAll in goroutine 6
github.com/makeworld-the-better-one/amfora/subscriptions/subscriptions.go:405 +0xd4
My system:
$ uname -a
Linux ne 6.6.7-0-lts #1-Alpine SMP PREEMPT_DYNAMIC Thu, 14 Dec 2023 08:49:17 +0000 x86_64 GNU/Linux
$ cat /etc/alpine-release
3.19.0
Please be so kind and use the Makefile provided by the author. That works all right. Go ist supposed to link statically. Please don't interfere with that with no good reason.
Thank you.
Edited by Carlo Monte