Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2242044rdf; Mon, 6 Nov 2023 08:27:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRN+LVQhZp7qoao1yopdSJf08pDWNe6yUQWmsEe5B3zqPlm528/50BQvcbO3GSX1sNoT4N X-Received: by 2002:a17:903:1cc:b0:1cc:4cbb:c564 with SMTP id e12-20020a17090301cc00b001cc4cbbc564mr25905583plh.69.1699288079032; Mon, 06 Nov 2023 08:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699288079; cv=none; d=google.com; s=arc-20160816; b=yVVU/NiOPOYxBHsYxtCSu49lqkW4Nx+/mRCpCldjJvZJ/i4bFTOJR76AlO2gLNaaBe jgUwYNf9hciOu1w4dUDeelbcTEexQUFJtZ+rb+Hl/RoFZ1HvUz0vwjNL7IheTNWA4ahF R5nyGeF90RpY8LiEH39i8ol3qDqootivxGL7/66KsJ6z1o3DgkalE0OFnjm1TajdRta2 Vb81KhGdDHCHiRGPlpd2f4jenbB+yb1Y368duhHdv7WulTJuwFWnGlVbI/YGkV5FFJ4h 7QpFxUngDBkd5BcpvviCizdwXZvz15ireqIMGc/SC7wehMjumBmFGLjW0RHoRUQIVNqQ vyCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=M4vlVYMPfkiJdK9hdtcKI8OfdrUsbCVruswCBH2HGfw=; fh=Osb6dp4u4aiqGro4h2Z/FSDMo2W4HZztoSCeVDkl5i4=; b=K7cAsv9MDE7hAdTS7pphP5uEXVcM6qhjrRud7AuHalEKTfndWl9vFLimtdZ4y/Ge51 uz5xjLPePSUHVmaWMHv1bBpYCKHRScsx9MEUDaXiYH4Gg4fGMndolM+PNKKxuIDzGT0U WDdKBMRsK6PQu/+ufCRhjtG5ukca4sLtH1lY7ECSZS1UnC4OYlt1u4/EDVW6289BZFm3 MlWSuqoHO2VTMlkkMJy3ojDE27XzIaMcv0q0dUKPPoRZD0zcibV7r3TpmBmM96tjHrk2 vdB9fCD1PmADCmaQojODH8BCbpo38BKLzScTrTUYPYF71MPAq0rGCPU/7td0xFn5T1F6 Hl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mtPm68o1; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id o4-20020a170902d4c400b001ccab03f008si8090632plg.185.2023.11.06.08.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 08:27:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mtPm68o1; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8098B80A90CF; Mon, 6 Nov 2023 08:27:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbjKFQ0h (ORCPT + 99 others); Mon, 6 Nov 2023 11:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232799AbjKFQ0g (ORCPT ); Mon, 6 Nov 2023 11:26:36 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B32D51 for ; Mon, 6 Nov 2023 08:26:33 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c5056059e0so67371011fa.3 for ; Mon, 06 Nov 2023 08:26:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699287992; x=1699892792; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=M4vlVYMPfkiJdK9hdtcKI8OfdrUsbCVruswCBH2HGfw=; b=mtPm68o1R9A2izwkjHr8XpSJsa3lDgJ44sLZgGYL59uhHcqe1oWNCNDHbH2Y7A4Rv8 t4h3YwcWJ4pepSN5YgY2afeF8EVzrQSsVRMnMrBGqZcoODGPU0YZGou+oOiLIMIYEv/M k9I8x85cRrwsQGejOxNgyQrL6+sA7/0Rny7Um/gUh9kM7WkviVRfVGutAFgVqJ1jdesJ xAvFz/RXySHj96sRrX+SHPwKq63kGObMjiup+yXNI3YnrxCxh31xl6VWgCQqU/XLxIFP JOZp1oW2uxsxAOuIAWY/EYHkmQTi+o9G8WKsy+lY3TgaXwIRi6GyN8KGEgRmylfEvO7h PKrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699287992; x=1699892792; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M4vlVYMPfkiJdK9hdtcKI8OfdrUsbCVruswCBH2HGfw=; b=ZNJGlirkdHWSBvi6F37BM+sEsfU+Re6egkC9uLA7kk1QfQ2BkAJtKfuf+P9b7VG/+S EclBvQ39PhwBWh5LM6af2XVQYHX0a25e7Ks3XS0moOQSRTNzXGEsVtfNJ9JRJH6Umw84 jJvZVZZHvSYEaKa+/daOrxWXRw8OBqFh14QpN0lrW0XH6LyWbcdL8EAyvs9gBl3yU2ml NvlL/AlYos8NoQmiiwsL72CxAREFW9chbYob0SpfTfpOuWP9g358kCiyXe8ne4YaSFds FjI9CbuLAODzrpU5ybdzxvCkWosif2S+axHwl5iUlUiQR/Pu+ptcj6P2SXBuMPdx/B5w vRjA== X-Gm-Message-State: AOJu0YypxuujhMqZ47sSnnb1c+iPFoOmYmz03jhk1cf9M9DXEutbeMqS Rc2IZTtIT5SVpTcootTn2f2mXf8z0/628WoNdx0= X-Received: by 2002:a2e:a4c9:0:b0:2c6:ed19:58a6 with SMTP id p9-20020a2ea4c9000000b002c6ed1958a6mr10311908ljm.33.1699287991388; Mon, 06 Nov 2023 08:26:31 -0800 (PST) MIME-Version: 1.0 References: <20231027055423.13617-1-juerg.haefliger@canonical.com> <20231030065341.8998-1-juerg.haefliger@canonical.com> In-Reply-To: <20231030065341.8998-1-juerg.haefliger@canonical.com> From: Luiz Augusto von Dentz Date: Mon, 6 Nov 2023 11:26:20 -0500 Message-ID: Subject: Re: [PATCH v2] shared/shell: Fix --init-script commandline option To: Juerg Haefliger Cc: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Mon, 06 Nov 2023 08:27:54 -0800 (PST) Hi Juerg, On Mon, Oct 30, 2023 at 2:54=E2=80=AFAM Juerg Haefliger wrote: > > 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 Perhaps we could remove this --index since btmgmt supports setting the index via select command; it doesn't seem very useful to have 2 different forms of selecting the index. > Unable to open 0: No such file or directory (2) > > Fix this by using '-s' for --init-script. > > Fixes: https://github.com/bluez/bluez/issues/639 > Signed-off-by: Juerg Haefliger > > --- > v2: > - Replace reference to broken commit with reference to github issue. > --- > 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[] =3D { > { "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 str= uct bt_shell_opt *opt) > if (opt) { > memcpy(options + offset, opt->options, > sizeof(struct option) * opt->optno); > - snprintf(optstr, sizeof(optstr), "+mhvi:t:%s", opt->optst= r); > + snprintf(optstr, sizeof(optstr), "+mhvs:t:%s", opt->optst= r); > } else > - snprintf(optstr, sizeof(optstr), "+mhvi:t:"); > + snprintf(optstr, sizeof(optstr), "+mhvs:t:"); > > data.name =3D strrchr(argv[0], '/'); > if (!data.name) > @@ -1193,7 +1193,7 @@ void bt_shell_init(int argc, char **argv, const str= uct bt_shell_opt *opt) > data.argv =3D &cmplt; > data.mode =3D 1; > goto done; > - case 'i': > + case 's': > if (optarg) > data.init_fd =3D open(optarg, O_RDONLY); > if (data.init_fd < 0) > -- > 2.39.2 > --=20 Luiz Augusto von Dentz