On Sun, Dec 24 2017, David CARLIER <devne...@gmail.com> wrote: > On 24 December 2017 at 00:25, Jeremie Courreges-Anglas <j...@wxcvbn.org> > wrote: > >> On Sat, Dec 23 2017, David CARLIER <devne...@gmail.com> wrote: >> > Hi, >> > >> > Due to lot of gaming porting efforts these days :-), >> > here a little diff for openal just a fix to avoid probing non existent >> > capture handling (in the sndio backend). >> >> Could you please describe in more details the problem and why you chose >> to fix it this way? I don't know much about OpenAL, but it's not >> obvious to me why you're modifying what looks like backend-agnostic code >> to fix a problem in sndio support.
> Sure. In fact our sndio backend does not have capture handling thus > trying to probe it in this case would cause a segfault in case a software > would require it. > Noted by thrfw while porting fs2open recently. OK so it turns out this is easily reachable from openal-info. egdb backtrace with DEBUG='-g -O0': --8<-- Reading symbols from openal-info...done. (gdb) r Starting program: /usr/local/bin/openal-info Available playback devices: SndIO Default Available capture devices: Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x000001f9f8f51096 in ProbeDevices (list=0x1f9f91b02a0 <alcCaptureDeviceList>, backendinfo=0x1f9f91b0338 <CaptureBackend>, type=CAPTURE_DEVICE_PROBE) at /usr/ports/pobj/openal-1.17.2/openal-soft-1.17.2/Alc/ALc.c:1234 #2 0x000001f9f8f4948c in ProbeCaptureDeviceList () at /usr/ports/pobj/openal-1.17.2/openal-soft-1.17.2/Alc/ALc.c:1246 #3 0x000001f9f8f491e5 in alcGetString (Device=0x0, param=784) at /usr/ports/pobj/openal-1.17.2/openal-soft-1.17.2/Alc/ALc.c:2617 #4 0x000001f6fae0078b in main (argc=1, argv=0x7f7ffffe1a08) at /usr/ports/pobj/openal-1.17.2/openal-soft-1.17.2/utils/openal-info.c:299 (gdb) frame 1 #1 0x000001f9f8f51096 in ProbeDevices (list=0x1f9f91b02a0 <alcCaptureDeviceList>, backendinfo=0x1f9f91b0338 <CaptureBackend>, type=CAPTURE_DEVICE_PROBE) at /usr/ports/pobj/openal-1.17.2/openal-soft-1.17.2/Alc/ALc.c:1234 1234 backendinfo->Probe(type); (gdb) p backendinfo $2 = (struct BackendInfo *) 0x1f9f91b0338 <CaptureBackend> (gdb) p *backendinfo $3 = {name = 0x0, getFactory = 0x0, Init = 0x0, Deinit = 0x0, Probe = 0x0, Funcs = {OpenPlayback = 0x0, ClosePlayback = 0x0, ResetPlayback = 0x0, StartPlayback = 0x0, StopPlayback = 0x0, OpenCapture = 0x0, CloseCapture = 0x0, StartCapture = 0x0, StopCapture = 0x0, CaptureSamples = 0x0, AvailableSamples = 0x0}} (gdb) -->8-- Indeed the CaptureBackend is not initialized and obviously shouldn't be used, but your diff disables all probing: ritchie /usr/ports/audio/openal$ openal-info Available playback devices: !!! none !!! Available capture devices: !!! none !!! Default playback device: Default capture device: ALC version: 1.1 [...] Upstream has already fixed this issue: https://github.com/kcat/openal-soft/commit/d1e98c36d375433cb11a7a74ce20c968491773aa ritchie /usr/ports/audio/openal$ openal-info Available playback devices: SndIO Default Available capture devices: !!! none !!! Default playback device: SndIO Default Default capture device: ALC version: 1.1 [...] I have only tested openal-info. Does the diff below work for you? Index: Makefile =================================================================== RCS file: /cvs/ports/audio/openal/Makefile,v retrieving revision 1.49 diff -u -p -r1.49 Makefile --- Makefile 15 Nov 2017 13:02:42 -0000 1.49 +++ Makefile 28 Dec 2017 03:43:49 -0000 @@ -10,6 +10,7 @@ DISTNAME = openal-soft-$V PKGNAME = openal-$V CATEGORIES = audio SHARED_LIBS = openal 3.0 +REVISION = 0 HOMEPAGE = http://kcat.strangesoft.net/openal.html Index: patches/patch-Alc_ALc_c =================================================================== RCS file: patches/patch-Alc_ALc_c diff -N patches/patch-Alc_ALc_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Alc_ALc_c 28 Dec 2017 03:43:49 -0000 @@ -0,0 +1,35 @@ +$OpenBSD$ + +commit d1e98c36d375433cb11a7a74ce20c968491773aa +Author: Chris Robinson <chris.k...@gmail.com> +Date: Sat Apr 30 17:14:55 2016 -0700 + + Don't crash when there's no backend to probe + +Index: Alc/ALc.c +--- Alc/ALc.c.orig ++++ Alc/ALc.c +@@ -1117,6 +1117,11 @@ static void alc_initconfig(void) + V0(factory,init)(); + } + ++ if(!PlaybackBackend.name) ++ WARN("No playback backend available!\n"); ++ if(!CaptureBackend.name) ++ WARN("No capture backend available!\n"); ++ + if(ConfigValueStr(NULL, NULL, "excludefx", &str)) + { + size_t len; +@@ -1230,9 +1235,9 @@ static void ProbeDevices(al_string *list, struct Backe + LockLists(); + al_string_clear(list); + +- if(!backendinfo->getFactory) ++ if(backendinfo->Probe) + backendinfo->Probe(type); +- else ++ else if(backendinfo->getFactory) + { + ALCbackendFactory *factory = backendinfo->getFactory(); + V(factory,probe)(type); -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE