From nobody Sun Jul 13 09:37:39 2025 X-Original-To: dev-commits-src-main@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 4bg0jc1ZqSz61wXK; Sun, 13 Jul 2025 09:37:40 +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 4bg0jc0zWZz3HsW; Sun, 13 Jul 2025 09:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752399460; 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=lBNvpJrCewcV0+ugQkNb/PbT6r/89Wxc/zBo+jfw8bg=; b=x7mxK0h/EOw8J7yeJ3Pi6JmH/oa0mDU4KWZcfSzNdB7h64a9EkcpxQp5WSmAveEu6e+t0W MXNFoSnDur0BEtaM1RNUvy3QdTuv3NFL9Me6Okx/2RFksfJ3xwHjnJ7L7S1Subg1UTUrjJ VX0sAwxN81RZAAIIUaJTotmmWuY3xbiP1EeB8QQ74zZ+7G2TkVNSEK18a+/ODt5Ueu53YV p+qnz1omURU91e8kCE0CSPxK1z+CJLOy4tAR4aTPuwnfrYa2Vl45kzKrlQmt8bo5GFQEYY 1AG2+/xQMwGI6IEBPLf2S3TgessYuLe3bxkGPxP8gC37TUNvOcl6xhJb74FSnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752399460; 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=lBNvpJrCewcV0+ugQkNb/PbT6r/89Wxc/zBo+jfw8bg=; b=EzAM3USEVtHkSMN5ohpSZjVwD7VoYz8LfHo5HYEDXXs4gWgSE4Qzr0maagmiJSTEIXhCjn eo1TzVw0CEg12xeilKtT6plwAjpQ/V/7D2GdnM8iC5nlPVn/WZHjlNcXel9XbQ0aYbnode PWUZTIw/YY5WRSgzc7zs86/aLpBvemobx9ZFBXSsBwWBavW2mVSV+EwLB6YBd1zdiIrgvh fWHTgX54bJkDHBMuLOomOCoky0dQwBynQkRxduIpZ6+Ggz0pCRtZVB+JDLUGjv0z2IBWaB oWLe4N+OTkPxcj5xu5h+34PkKG1OfZR+dNC0sWvRZMpmZKkBcbzyvEYVmH7NjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752399460; a=rsa-sha256; cv=none; b=j/kHulKlGW/UGZovh2W4CDARM0gS8lKgVnjcPHFME603ZwoAlaHGtvLidI6b3zBKmMHEn0 8LaUMNzkC+l9VYk2pmArEXk6d771rczPa3FQStUDKswPChs5heHsuab+mDb/0JVunqp02O r9sP7pyosBNdtF9EBMgJw22JbaMAyzv8veAoqIMb4jZ/NNQzekIe4atS7jQZ5K9t5S3ZCf mX1E+gk2qJqx8E2Ql8xLiteQ+JJVTF1/p3wtOZ6rfSKJH/nf/3qxQhapg4G5fCtmbYpXXt 2FN2zCBjCMWhoSnesj8vS7ELHIYZU1YPiNjpdSM/lzgvMXuq4Bu08jvuuHvPNw== 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 4bg0jc0Rq9z13DV; Sun, 13 Jul 2025 09:37:40 +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 56D9bewp040115; Sun, 13 Jul 2025 09:37:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56D9bdsv040112; Sun, 13 Jul 2025 09:37:39 GMT (envelope-from git) Date: Sun, 13 Jul 2025 09:37:39 GMT Message-Id: <202507130937.56D9bdsv040112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lars Engels Subject: git: 5031da20599b - main - bluetooth-config: Fix command line parsing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 5031da20599bb1163f0e8d1c4b415ab3bbebce00 Auto-Submitted: auto-generated The branch main has been updated by lme: URL: https://cgit.FreeBSD.org/src/commit/?id=5031da20599bb1163f0e8d1c4b415ab3bbebce00 commit 5031da20599bb1163f0e8d1c4b415ab3bbebce00 Author: Dirk Engling AuthorDate: 2025-07-13 09:25:24 +0000 Commit: Lars Engels CommitDate: 2025-07-13 09:25:24 +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: --- 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