Bug 272517

Summary: net-mgmt/collectd5: crashes with Segmentation fault (core dumped) after update of devel/gettext-runtime from 0.21.1 to 0.22
Product: Ports & Packages Reporter: Fabian Wenk <fabian>
Component: Individual Port(s)Assignee: Tijl Coosemans <tijl>
Status: Closed FIXED    
Severity: Affects Some People CC: dfr, marklmi26-fbsd, ports, tijl
Priority: --- Keywords: crash
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272210
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272472
Attachments:
Description Flags
patch
none
gettext-runtime patch none

Description Fabian Wenk 2023-07-15 14:53:45 UTC
After the update from devel/gettext-runtime 0.21.1 -> 0.22 and then (re)starting collectd it fails with this:

riddler:~/ # /usr/local/etc/rc.d/collectd restart
collectd not running?
Starting collectd.
Segmentation fault (core dumped)
/usr/local/etc/rc.d/collectd: WARNING: failed to start collectd

Tried to rebuild all dependencies between devel/gettext-runtime and net-mgmt/collectd5, e.g. security/libgpg-error, security/libgcrypt and net-mgmt/collectd5 itself, but this did not help.
What finally helped was to downgrade to devel/gettext-runtime 0.21.1.
For a probably a similar case see #272472

Below outputs from truss and lldb when devel/gettext-runtime 0.22 was installed.

riddler:~/ # truss /usr/local/sbin/collectd
mmap(0x0,131072,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34362228736 (0x800260000)
mprotect(0x80025d000,4096,PROT_READ)		 = 0 (0x0)
issetugid()					 = 0 (0x0)
__sysctl("kern.ostype",2,0x80025f5f1,0x7fffffffdf50,0x0,0) = 0 (0x0)
__sysctl("kern.hostname",2,0x80025f6f1,0x7fffffffdf50,0x0,0) = 0 (0x0)
__sysctl("kern.osrelease",2,0x80025f7f1,0x7fffffffdf50,0x0,0) = 0 (0x0)
__sysctl("kern.version",2,0x80025f8f1,0x7fffffffdf50,0x0,0) = 0 (0x0)
__sysctl("hw.machine",2,0x80025f9f1,0x7fffffffdf50,0x0,0) = 0 (0x0)
openat(AT_FDCWD,"/etc/libmap.conf",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=2250221,size=122,blksize=32768 }) = 0 (0x0)
read(3,"# $FreeBSD: releng/12.4/libexec/"...,122) = 122 (0x7a)
close(3)					 = 0 (0x0)
open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/usr/local/lib/libm.so.5",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-[\0\0"...,128) = 128 (0x80)
fstat(3,{ mode=-r--r--r-- ,inode=162020,size=347,blksize=32768 }) = 0 (0x0)
pread(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,219,0x80) = 219 (0xdb)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/lib/libm.so.5",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=1605245,size=231528,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,225280,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34362363904 (0x800281000)
mmap(0x800281000,69632,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34362363904 (0x800281000)
mmap(0x800292000,147456,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x10000) = 34362433536 (0x800292000)
mmap(0x8002b6000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x33000) = 34362580992 (0x8002b6000)
mmap(0x8002b7000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x33000) = 34362585088 (0x8002b7000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/usr/local/lib/libthr.so.3",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/lib/libthr.so.3",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=1605332,size=134224,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,188416,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34362589184 (0x8002b8000)
mmap(0x8002b8000,53248,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34362589184 (0x8002b8000)
mmap(0x8002c5000,77824,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0xc000) = 34362642432 (0x8002c5000)
mmap(0x8002d8000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1e000) = 34362720256 (0x8002d8000)
mmap(0x8002d9000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1e000) = 34362724352 (0x8002d9000)
mmap(0x8002da000,49152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34362728448 (0x8002da000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/usr/local/lib/libgcrypt.so.20",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-rwxr-xr-x ,inode=2087834,size=1399152,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,1413120,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34362777600 (0x8002e6000)
mmap(0x8002e6000,331776,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34362777600 (0x8002e6000)
mmap(0x800337000,1040384,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x50000) = 34363109376 (0x800337000)
mmap(0x800435000,16384,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x14d000) = 34364149760 (0x800435000)
mmap(0x800439000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x150000) = 34364166144 (0x800439000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/usr/local/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-r--r--r-- ,inode=1605239,size=1943120,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,4145152,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34364190720 (0x80043f000)
mmap(0x80043f000,524288,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34364190720 (0x80043f000)
mmap(0x8004bf000,1298432,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x7f000) = 34364715008 (0x8004bf000)
mmap(0x8005fc000,40960,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1bb000) = 34366013440 (0x8005fc000)
mmap(0x800606000,28672,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1c4000) = 34366054400 (0x800606000)
mmap(0x80060d000,2252800,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34366083072 (0x80060d000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/lib/libgpg-error.so.0",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/usr/lib/libgpg-error.so.0",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/usr/lib/compat/libgpg-error.so.0",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory'
openat(AT_FDCWD,"/usr/local/lib/libgpg-error.so.0",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-rwxr-xr-x ,inode=2087697,size=151336,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,163840,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34368335872 (0x800833000)
mmap(0x800833000,61440,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34368335872 (0x800833000)
mmap(0x800842000,90112,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0xe000) = 34368397312 (0x800842000)
mmap(0x800858000,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x23000) = 34368487424 (0x800858000)
mmap(0x80085a000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x24000) = 34368495616 (0x80085a000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
openat(AT_FDCWD,"/usr/local/lib/libintl.so.8",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=2087788,size=144688,blksize=32768 }) = 0 (0x0)
mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34362359808 (0x800280000)
mmap(0x0,147456,PROT_NONE,MAP_GUARD,-1,0x0)	 = 34368499712 (0x80085b000)
mmap(0x80085b000,20480,PROT_READ,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34368499712 (0x80085b000)
mmap(0x800860000,114688,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x4000) = 34368520192 (0x800860000)
mmap(0x80087c000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1f000) = 34368634880 (0x80087c000)
mmap(0x80087d000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x1f000) = 34368638976 (0x80087d000)
mmap(0x80087e000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34368643072 (0x80087e000)
munmap(0x800280000,4096)			 = 0 (0x0)
close(3)					 = 0 (0x0)
mprotect(0x8002b6000,4096,PROT_READ)		 = 0 (0x0)
mprotect(0x8002d8000,4096,PROT_READ)		 = 0 (0x0)
mprotect(0x800435000,16384,PROT_READ)		 = 0 (0x0)
mprotect(0x8005fc000,36864,PROT_READ)		 = 0 (0x0)
mprotect(0x800858000,4096,PROT_READ)		 = 0 (0x0)
mprotect(0x80087c000,4096,PROT_READ)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
mprotect(0x8005fc000,36864,PROT_READ|PROT_WRITE) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
mprotect(0x8005fc000,36864,PROT_READ)		 = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)		 = 0 (0x0)
readlink("/etc/malloc.conf",0x7fffffffd6f0,1024) ERR#2 'No such file or directory'
issetugid()					 = 0 (0x0)
__sysctl("vm.overcommit",2,0x7fffffffd644,0x7fffffffd650,0x0,0) = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34362359808 (0x800280000)
madvise(0x800280000,4096,MADV_FREE)		 = 0 (0x0)
munmap(0x800280000,4096)			 = 0 (0x0)
mmap(0x0,2097152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368647168 (0x80087f000)
munmap(0x80087f000,2097152)			 = 0 (0x0)
mmap(0x0,4190208,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368647168 (0x80087f000)
munmap(0x80087f000,1576960)			 = 0 (0x0)
munmap(0x800c00000,516096)			 = 0 (0x0)
cap_getmode({ 0 })				 = 0 (0x0)
open("/dev/hpet0",O_RDONLY,00)			 = 3 (0x3)
mmap(0x0,4096,PROT_READ,MAP_SHARED,3,0x0)	 = 34362359808 (0x800280000)
close(3)					 = 0 (0x0)
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368647168 (0x80087f000)
mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34372321280 (0x800c00000)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368679936 (0x800887000)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368684032 (0x800888000)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368696320 (0x80088b000)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34368708608 (0x80088e000)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)		 = 0 (0x0)
sigprocmask(SIG_BLOCK,{ SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ }) = 0 (0x0)
sigprocmask(SIG_SETMASK,{ },0x0)		 = 0 (0x0)
SIGNAL 11 (SIGSEGV) code=SEGV_MAPERR trapno=12 addr=0x2c
process killed, signal = 11 (core dumped)
riddler:~/ # 

riddler:~/ # lldb /usr/local/sbin/collectd
(lldb) target create "/usr/local/sbin/collectd"
Current executable set to '/usr/local/sbin/collectd' (x86_64).
(lldb) r
Process 65061 launched: '/usr/local/sbin/collectd' (x86_64)
Process 65061 stopped
* thread #1, name = 'collectd', stop reason = signal SIGSEGV: invalid address (fault address: 0x2c)
    frame #0: 0x00000008002cd36c libthr.so.3`init_rwlock [inlined] init_static(thread=0x0000000000000000, rwlock=0x000000080087d5b0) at thr_rwlock.c:147:2
   144 	{
   145 		int ret;
   146 	
-> 147 		THR_LOCK_ACQUIRE(thread, &_rwlock_static_lock);
   148 	
   149 		if (*rwlock == THR_RWLOCK_INITIALIZER)
   150 			ret = rwlock_init(rwlock, NULL);
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
riddler:~/ # 

riddler:~/ # lldb --core ./collectd.core /usr/local/sbin/collectd
(lldb) target create "/usr/local/sbin/collectd" --core "./collectd.core"
Core file '/root/collectd.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'collectd', stop reason = signal SIGSEGV
  * frame #0: 0x00000008002cd36c libthr.so.3`init_rwlock [inlined] init_static(thread=0x0000000000000000, rwlock=0x000000080087d5b0) at thr_rwlock.c:147:2
    frame #1: 0x00000008002cd36c libthr.so.3`init_rwlock(rwlock=0x000000080087d5b0, rwlock_out=0x00007fffffffdaa0) at thr_rwlock.c:86:10
    frame #2: 0x00000008002cd177 libthr.so.3`rwlock_wrlock_common [inlined] check_and_init_rwlock(rwlock=<unavailable>, rwlock_out=0x00007fffffffdaa0) at thr_rwlock.c:69:11
    frame #3: 0x00000008002cd156 libthr.so.3`rwlock_wrlock_common(rwlock=<unavailable>, abstime=0x0000000000000000) at thr_rwlock.c:301:8
    frame #4: 0x0000000800860dbc libintl.so.8`set_binding_values + 76
    frame #5: 0x0000000800860d56 libintl.so.8`libintl_bindtextdomain + 38
    frame #6: 0x0000000800843af7 libgpg-error.so.0`___lldb_unnamed_symbol387 + 23
    frame #7: 0x000000080024541d ld-elf.so.1`objlist_call_init(list=<unavailable>, lockstate=<unavailable>) at rtld.c:2827:7
    frame #8: 0x000000080024408d ld-elf.so.1`_rtld(sp=<unavailable>, exit_proc=0x00007fffffffeaf0, objp=0x00007fffffffeaf8) at rtld.c:811:5
    frame #9: 0x00000008002418a9 ld-elf.so.1`.rtld_start at rtld_start.S:39
(lldb)
Comment 1 Fabian Wenk 2023-07-15 14:56:56 UTC
(In reply to Fabian Wenk from comment #0)
Addition to make the mention similar case bug #272472 clickable.
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2023-07-16 14:06:06 UTC
Created attachment 243420 [details]
patch

Please try the attached patch.
Comment 3 Fabian Wenk 2023-07-16 15:33:38 UTC
(In reply to Tijl Coosemans from comment #2)

Thank you Tijl, this patch solved it and collectd5-5.12.0_9 runs with gettext-runtime-0.22.
Comment 4 dfr 2023-07-17 10:59:12 UTC
I'm seeing something similar with podman and buildah - upgrading to gettext-runtime-0.22 makes both start crashing:

lab2# podman version
zsh: segmentation fault  podman version
lab2# sudo pkg add -f /var/cache/pkg/gettext-runtime-0.21.1.pkg
Installing gettext-runtime-0.21.1...
package gettext-runtime is already installed, forced install
Extracting gettext-runtime-0.21.1: 100%
lab2# podman version
Client:       Podman Engine
Version:      4.6.0-rc2
API Version:  4.6.0-rc2
Go Version:   go1.20.3
Built:        Mon Jul 17 10:44:05 2023
OS/Arch:      freebsd/amd64

With gettext-0.21.1, when /usr/local/lib/libintl.so.8 constructors are called, _libpthread_init is called which initialises current pthread and later init_rwlock is called which needs current pthread. WIth gettext-0.22, init_rwlock is called befpre _libpthread_init and current pthread is null and things go pear shaped
Comment 5 dfr 2023-07-17 11:59:46 UTC
For buildah, podman and skopeo, the dependency on gettext is coming via security/gpgme
Comment 6 Mark Millard 2023-07-17 14:12:38 UTC
https://lists.freebsd.org/archives/dev-commits-src-main/2023-July/017009.html

from Sunday is for "git: ad056b5d35d9 - main - libthr: trigger library initialization on rwlock calls" in FreeBSD main (so: 14)
Comment 7 Tijl Coosemans freebsd_committer freebsd_triage 2023-07-17 14:21:27 UTC
Created attachment 243431 [details]
gettext-runtime patch

Please try this patch for devel/gettext-runtime.  It should fix all crashes.
Comment 8 dfr 2023-07-17 16:16:54 UTC
The gettext-runtime patch works for podman, buildah and skopeo. Thanks for the quick response!
Comment 9 Fabian Wenk 2023-07-17 17:12:51 UTC
(In reply to Tijl Coosemans from comment #7)

I can also confirm, that with the patched version gettext-runtime-0.22_1 the non-patched build of collectd5-5.12.0_8 does not crash any more.
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-07-17 18:56:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f0fc81e147d6851546b712b4403b4584ac4e02b7

commit f0fc81e147d6851546b712b4403b4584ac4e02b7
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2023-07-16 13:48:11 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2023-07-17 18:55:15 +0000

    net-mgmt/collectd5: Eliminate -lgcrypt from LIBS

    ...so it isn't linked into every executable and library.

    This came up when trying to fix a crash involving libgcrypt,
    libgpg-error and libintl from gettext 0.22.  This crash has been
    fixed in fb889ca82944.

    PR:             272517

 net-mgmt/collectd5/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2023-07-17 18:56:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fb889ca82944e04d4b3dfa2a13c51456bbde0094

commit fb889ca82944e04d4b3dfa2a13c51456bbde0094
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2023-07-17 13:06:02 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2023-07-17 18:53:17 +0000

    devel/gettext-runtime: Fix crash triggered by libgpg-error

    Libgpg-error has an initialisation function with
    __attribute__((constructor)) that calls a libintl function that
    calls pthread_rwlock_wrlock that segfaults if libpthread wasn't
    initialised yet.  This can happen because libintl doesn't link to
    libpthread to avoid the overhead for non-threaded programs.  To
    fix this, add an initialisation function to libintl that triggers
    initialisation of libpthread.

    RTLD_NOLOAD suggested by kib.

    dlopen was fixed to work during initialisation in
    https://cgit.FreeBSD.org/src/commit/?id=1005d3d05362

    PR:             272472, 272517

 Mk/Uses/gettext-runtime.mk                         |  5 ++--
 devel/gettext-runtime/Makefile                     |  2 +-
 .../gettext-runtime/files/patch-intl_osdep.c (new) | 28 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 3 deletions(-)