From nobody Sat May 25 19:32:32 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VmsW46jBMz5LT0Y for ; Sat, 25 May 2024 19:32:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VmsW45KQVz4lhV for ; Sat, 25 May 2024 19:32:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716665552; a=rsa-sha256; cv=none; b=Uh5ZWxvoGYtXwA1jnBh774uBHWSgMjQnO2vHvVE3BcUwRUrTNoD6rwop2V2XDJlXRkqIMh HWAwRRRmBx1AFLAmP/RKEgHq7Q+Hc7Yt7Fdmf8zG6ZSZaKaPAyrf3f5G3lhom0DVZTPiPN k1OCZ0PFvtacF7gE5IyYD//6D6Ux4xedIkDdAjP0OkjWIhePQmREB5PJ3HQasVr42a1iOB odJ8EXGL8v6R9yrU9oOQwkUJ9lfKdlovLW9+YZ5u3TmeMx5b9Ik7N/KKhEDOIYby8KOIVY Z8XekuqhYRqHgwIoBvH9KKzx3VYkPvudfxw58e9+ETpsZ4j/qk0uBSHovYGGVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716665552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fh1ZV8ZJG75nESSPXbUOkZoAU1QtZxGEgP0T7KPkJlo=; b=gB7RVYe0h3zP+g49hLfEttxkpslMVkyVcC44PnHOuNEN18inKDwh56FirI8i9/8rctBBxK RKD7NobcYezS5TFZ0I521W+tK946iPo8TXwEYzYVOa7SxqGMJbR5OcWQmH1jEN4oTfaguU RxyPk9umRe//qH7Qo62y602L9phlF653FvBYp8o6vMEO+thPMns7d/iRHnqiVbi6K6idfY fY8E6kJZmgCROMxe3Z8lVNd1lacgMfQ0fdkDFcZT9dqmJGdwejQThm9/AQFe96vLilzjqv mKZQVk++X+55wMwNBDLckJTglr806ML8EPvp/qLjtrwr+e6kG37nle7hQQcviA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VmsW44wwQzVBG for ; Sat, 25 May 2024 19:32:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 44PJWWQd003127 for ; Sat, 25 May 2024 19:32:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 44PJWWrx003126 for bugs@FreeBSD.org; Sat, 25 May 2024 19:32:32 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist. Date: Sat, 25 May 2024 19:32:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Closed X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277615 --- Comment #3 from commit-hook@FreeBSD.org --- A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3Dab7c89415462567665c36628137375847= fbff590 commit ab7c89415462567665c36628137375847fbff590 Author: Christos Margiolis AuthorDate: 2024-05-23 00:57:17 +0000 Commit: Christos Margiolis CommitDate: 2024-05-25 19:30:40 +0000 sound: Handle unavailable devices in various OSS IOCTLs mixer(8)'s -a option is used to print information about all mixer devices in the system. To do this, it loops from 0 to mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this approach doesn't work when there are disabled/unregistered mixers in the system, or when an audio device simply doesn't have a mixer. mixer_get_nmixers() calls SNDCTL_SYSINFO and returns oss_sysinfo->nummixers, whose value is the number of currently _enabled_ mixers only. Taking the bug report mentioned below (277615) as an example, suppose a system with 8 mixer devices total, but 3 of them are either disabled or non-existent, which means they will not show up under /dev, meaning we have 5 enabled mixer devices, which is also what the value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop from 0 to 5 (instead of 8), and start calling mixer_open() on /dev/mixer0, up to /dev/mixer4, and as is expected, the first call will fail right away, hence the error shown in the bug report. To fix this, modify oss_sysinfo->nummixers to hold the value of the maximum unit in the system, which, although not necessarily "correct", is more intuitive for applications that will want to use this value to loop through all mixer devices. Additionally, notify applications that a device is unavailable/unregistered instead of skipping it. The current implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and SNDCTL_CARDINFO break applications that expect to get information about a device that is skipped. Related discussion can be found here: https://reviews.freebsd.org/D45135#1029526 It has to be noted, that other applications, apart from mixer(8), suffer from this. PR: 277615 Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45256 (cherry picked from commit 5d980fadf73df64a1e0eda40a93170ed76ce6f14) lib/libmixer/mixer.3 | 7 +- sys/dev/sound/pcm/dsp.c | 23 +++++- sys/dev/sound/pcm/mixer.c | 201 ++++++++++++++++++++++++------------------= ---- sys/dev/sound/pcm/mixer.h | 2 - sys/dev/sound/pcm/sound.c | 41 ++++++---- 5 files changed, 155 insertions(+), 119 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=