From nobody Sun Jul 20 09:12:01 2025 X-Original-To: dev-commits-src-all@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 4blHpn6FyCz61qFW; Sun, 20 Jul 2025 09:12:01 +0000 (UTC) (envelope-from git@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blHpn4l4nz3gkN; Sun, 20 Jul 2025 09:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753002721; 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; bh=ymXnf/bHmNKzPVBPaiKXCNtz0oJXBjxAQVQ3qYJk7oU=; b=N0AaHN+ZCAnqLTjQiWq9HSnqQRz5LqGeEAYPQznVeGODvg1L91hkh4/VZToBx1hrdRhUaZ r6TkOt9JpyA5PgVy0raNbOr+qxXnD0klrCbBrTnLAcyCWytlrkCbT7UoWrYFBdpYvqv/GD 9tFOO3YHxORPtr8zUeVQCojzCl34ojlL3R1h2/eU27kP9Z+ZXSOEfSjOFmkYWNf0ai7kMU tSqYQekPf263MWwVyhQpZnW9UXSN/WNwIjS2Z6VrMNx1Mpyi2wDYMkNWeIXtEoRTC4ob7J 50BY0ysHRg3PXb5gpb/kcfjc21H1K1Yizf+cVU9eAWgwR5fBVshxDqiP9EkIHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753002721; 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; bh=ymXnf/bHmNKzPVBPaiKXCNtz0oJXBjxAQVQ3qYJk7oU=; b=o3OdpLilD+twOJ8kFqvecwmvaOSGrbVkORhUTY+Iw6eRSAp2N/NK16lbJiBEP0QU9tgk91 /xoUSr8rH6xz5y0VIar1NRs4DWxhwZW/xywXL2imA9xEA9DyBYyF0kpZmuZPOwkHEg/MaE 5JRKxMNZ5LS+b1oqLEN4zsy08U8nJ06LwQJDezf56D+X1ozvZ2RRXDCP7uyOpVAKAW8KI+ A8eY3aKyRCQ4oNScAm2RWJGkBozx0VP+dpWMwbfiB8qNJg2tD1S0mWPaRJnq16F3W/nJrm gL2RWonYYHPZQxVADFGAZyZy8FtaCbqvxO/MdUNMQFXCFyF7bHkP2eelnJ7S5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753002721; a=rsa-sha256; cv=none; b=xUVo3CbeD3hvvDIlEYsK18HAc2BXnRiN8hrzAvjQ6BIhnQXgah9XzO8LOTcvnDfrxK+YsO WKEiVH4QRFyrZwaU5Q/adsmUXco30a1uk3UUp2WvspEonAxOC3C0FU9J3KdZ1Rivb712BA 41SBy/2LWo6I2PHMqSu4WI7ehrcK4CK2ABynkMtyfRLcE4or1c97d0RSS/EZlQrJ3YkfTe Uvhh0N//l4wXaIyfrvIYArf5sxRZ/2xdGXtV7sxM97MQtJFBfyu+5vqf6h6ZzCXctXVrCK caSY9fPeSQe9BbnpgoSmDiuMRbOZ1io4P7YMAn0tIGkqJF6V8f8TZGNr8VUpOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4blHpn46c3z15lt; Sun, 20 Jul 2025 09:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56K9C1k4091655; Sun, 20 Jul 2025 09:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56K9C1kw091652; Sun, 20 Jul 2025 09:12:01 GMT (envelope-from git) Date: Sun, 20 Jul 2025 09:12:01 GMT Message-Id: <202507200912.56K9C1kw091652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lars Engels Subject: git: 000755e790df - stable/14 - bluetooth-config: Fix command line parsing List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lme X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 000755e790dfd6c78a87c10133c46b55b634ffab Auto-Submitted: auto-generated The branch stable/14 has been updated by lme: URL: https://cgit.FreeBSD.org/src/commit/?id=000755e790dfd6c78a87c10133c46b55b634ffab commit 000755e790dfd6c78a87c10133c46b55b634ffab Author: Dirk Engling AuthorDate: 2025-07-13 09:25:24 +0000 Commit: Lars Engels CommitDate: 2025-07-20 09:10:45 +0000 bluetooth-config: Fix command line parsing This addresses the problems encountered when parsing options in bluetooth-config. - the optional parameters were not properly shifted after consumption - the command line parameter count was checked before getopts and not after Reported by: sjg Approved by: kp MFC after: 7 days Event: Berlin Hackathon 202507 Differential Revision: (cherry picked from commit 5031da20599bb1163f0e8d1c4b415ab3bbebce00) --- usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh b/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh index 48a399a82fc7..148325fcecbc 100755 --- a/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh +++ b/usr.sbin/bluetooth/bluetooth-config/bluetooth-config.sh @@ -17,7 +17,7 @@ main() { unset node device started bdaddresses retry # Only one command at the moment is scan (+ add) -[ "$#" -eq 1 -a "$1" = "scan" ] || print_syntax +[ "$1" = "scan" ] || print_syntax shift # Get command line options @@ -28,6 +28,12 @@ while getopts :d:n: arg; do ?) print_syntax;; esac done +shift "$((OPTIND-1))" + +# If there's leftover parameters, print usage +[ "$#" -eq 0 ] || print_syntax +shift + # No use running without super user rights if [ $( id -u ) -ne 0 ]; then