Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp935016rdh; Thu, 26 Oct 2023 22:55:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmWJ3FNohSAfcK054mjy6aeBoMy1vP5mkC/qr0bILpV1aw40l8LRGihHs/M8MrdDO3w69Y X-Received: by 2002:a25:d654:0:b0:da0:5859:8465 with SMTP id n81-20020a25d654000000b00da058598465mr1657911ybg.20.1698386158484; Thu, 26 Oct 2023 22:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698386158; cv=none; d=google.com; s=arc-20160816; b=QTVhRZkDK5Ff5J2/2nhCjHdH+Q3E93uiaHdXKmIkkVUBkQ6sLehIYardFmkJ4+fm5d mH3ptKx8DzpW4IRKkeaG8cwiAxFVTBTXqIlq3uttZXuOgA/fJKzMSN9pcaPD9psdfqjG UaEjozREZlhx2LHL+VDYUXcCFxd3QLLdrdz8Bdq1ae923dvs71XMOedZ/6SsnVqD4uSo ig3T9GLFzuYdpPjrmopbFG/f/LbYIVbJx6seCxupZj+QVCfnvH0iqoObIvgbxxEbUAeM ewiqlMqmtLOaZJZTplOep0F4Axd+FeQOqY5TYMrRstM77nag53IDDKsTMzMByaol6gJ+ fR0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7qt60tzR0dp2LNxB7cAs92LC2Rjy+ydVBOnQqrAetiE=; fh=3b40+tFBVwEB6MkK4qNtRJvF714hjK0P2+f+teINmZ8=; b=ComtTTJ1oV7ll47ZgNgANISP7LDXodoLsOMTI++oTqz5KLEUBEIMM34te5z6PQxlaZ 3meA10eoQJIdEhDimxz5u4quriZuu+LqA89qhBOQ+kl0a6Fq58N43SqnbOFKksme+t9V XPl0o4nduGrY+qsBmmDz7gz2+FuyKqSbbCzmynWIVJvjAUyuQAMNeGQJ7/pBJCU8ajkv OGGC2XqLE1ei/0KnnD9AOWdGZOqQmA/sPlluZKviDncCEJzOmFMtYGI5rQBxh/+Pp0Xr jAsolvrucMmponNGwn1T9zxUOsf0dgej8+gy+iZ7up0UXzx6f23hpCyHWK4sds/y5G9K POGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=hzKx72ae; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a68-20020a25ca47000000b00d9accbb84bbsi1644716ybg.469.2023.10.26.22.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 22:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=hzKx72ae; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A506F829B8A0; Thu, 26 Oct 2023 22:55:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjJ0Fyd (ORCPT + 99 others); Fri, 27 Oct 2023 01:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjJ0Fyc (ORCPT ); Fri, 27 Oct 2023 01:54:32 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2701A7 for ; Thu, 26 Oct 2023 22:54:29 -0700 (PDT) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 36E2F3F67E for ; Fri, 27 Oct 2023 05:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698386067; bh=7qt60tzR0dp2LNxB7cAs92LC2Rjy+ydVBOnQqrAetiE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hzKx72aedfEh+TteDdC9CG2i8hxtMNkYQ0YT6NdD0/8Qj1GZnuWrgdV6V4EfYtAZ8 baxRFSDK6Kanugwsc3tZlCK1bfU8up3cMGfZxas0jQtZAyox07Ir6Wt3TKKFMCsqcd 4Hrq6xGn0Dev2WMTpY5qJwQOslWoHAbodgCpZAlbEznqOCk03JkbgOOjM2AExgSbbx 32I36l/ysFd7sXqtuZ7R5+Cu3kZtBKC5JhD61sWQg9qK/4uR1m9E03TUAOMJ3mLGKj MQsJeoJ/l55v5ZmH7PLCvTCeGM4dCOwjT7Sfi92GKH8NXqM9FQg6krnCUQFi9wDlc7 h4impu98XPAxw== Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-53db0df5b7cso1286900a12.1 for ; Thu, 26 Oct 2023 22:54:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698386067; x=1698990867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7qt60tzR0dp2LNxB7cAs92LC2Rjy+ydVBOnQqrAetiE=; b=oSZmfrvk/ZnMdPGiEzccPGPGn3TckYJ+ZrJ3Y+tjx0Vxob6WMWDXginYt84HmnvmcW N1OyZXq+RI8l2lryRu7tdeCImUNH5ARoEZLCKw1ZSERyVo0nCXmxb+g36BDqqaQv8AlM L3ZW+Lu+kghlan/3ofsNzTnON6+uxAHOJHXwxm0lWY/20eVFQs9OgBy4JoYVQopNOYWu hsyTZZij+ucSi2cOa5oZw4ZDnnN4JHVCM0vbFrw6uS8hlCrrQSvUupkf3Bzg5fTA/Z3f CGiDeRdKP705ONaG0IB9oNhtS6jSY5CL3ngq5rxXbs3iMSMhxtxdV+EsuXvnoupnBW0/ BtLw== X-Gm-Message-State: AOJu0YyLoxnveYvs1LyyhcvtF7vr321BDKILqbYesMuIF2oFtoVE2OgA dLllpnB5+xuqhj+px25jyXFkMoV8+zQXiMX3D7A2cyFXKQ5uoxQD3z7CCP/hGpwD6GB67Cx/Zqq 753SObufIblxaFzK8z3DQ8ypKTEFMW8PATDgx83rNTHq37w== X-Received: by 2002:a17:907:78b:b0:9b2:ccd8:2d42 with SMTP id xd11-20020a170907078b00b009b2ccd82d42mr1267452ejb.32.1698386066912; Thu, 26 Oct 2023 22:54:26 -0700 (PDT) X-Received: by 2002:a17:907:78b:b0:9b2:ccd8:2d42 with SMTP id xd11-20020a170907078b00b009b2ccd82d42mr1267436ejb.32.1698386066493; Thu, 26 Oct 2023 22:54:26 -0700 (PDT) Received: from localhost ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id kt12-20020a170906aacc00b009ad8acac02asm636089ejb.172.2023.10.26.22.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 22:54:26 -0700 (PDT) From: Juerg Haefliger To: juerg.haefliger@canonical.com Cc: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH] shared/shell: Fix --init-script commandline option Date: Fri, 27 Oct 2023 07:54:23 +0200 Message-Id: <20231027055423.13617-1-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026182426.032a776d@gollum> References: <20231026182426.032a776d@gollum> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 26 Oct 2023 22:55:55 -0700 (PDT) The newly added option -i/--init-script introduced a short option namespace collision with btmgmt's --index, both of which use '-i'. As a result, a provided --index is treated as a file name: $ sudo btmgmt --index 0 info Unable to open 0: No such file or directory (2) Fix this by using '-s' for --init-script. Fixes: f2f7c742ad0b ("shared/shell: Add support for -i/--init-script") Signed-off-by: Juerg Haefliger --- src/shared/shell.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index db79c882ca3a..fbccff5b54d9 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1128,7 +1128,7 @@ static void rl_init(void) static const struct option main_options[] = { { "version", no_argument, 0, 'v' }, { "help", no_argument, 0, 'h' }, - { "init-script", required_argument, 0, 'i' }, + { "init-script", required_argument, 0, 's' }, { "timeout", required_argument, 0, 't' }, { "monitor", no_argument, 0, 'm' }, { "zsh-complete", no_argument, 0, 'z' }, @@ -1169,9 +1169,9 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) if (opt) { memcpy(options + offset, opt->options, sizeof(struct option) * opt->optno); - snprintf(optstr, sizeof(optstr), "+mhvi:t:%s", opt->optstr); + snprintf(optstr, sizeof(optstr), "+mhvs:t:%s", opt->optstr); } else - snprintf(optstr, sizeof(optstr), "+mhvi:t:"); + snprintf(optstr, sizeof(optstr), "+mhvs:t:"); data.name = strrchr(argv[0], '/'); if (!data.name) @@ -1193,7 +1193,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) data.argv = &cmplt; data.mode = 1; goto done; - case 'i': + case 's': if (optarg) data.init_fd = open(optarg, O_RDONLY); if (data.init_fd < 0) -- 2.39.2