diff mbox series

bluez: btmgmt --index broken

Message ID 20231026182426.032a776d@gollum
State New
Headers show
Series bluez: btmgmt --index broken | expand

Commit Message

Juerg Haefliger Oct. 26, 2023, 4:24 p.m. UTC
Hi,

Commit 648b4362521b ("shared/shell: Add support for -i/--init-script")
introduced a short option namespace collision with btmgmt's --index option,
both of which use '-i'.

As a result, a provided --index is treated as an init-script...

$ sudo btmgmt --index 0 info
Unable to open 0: No such file or directory (2)


On a separate note, should btmgmt actually support --init-script since it
doesn't seem to do anything and just enters interactive mode?

$ cat test
help
info
quit

$ btmgmt --init-script test
[mgmt]#


Simple fix for the first issue, use -s/--init-script instead:

Comments

bluez.test.bot@gmail.com Oct. 26, 2023, 4:37 p.m. UTC | #1
This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: src/shared/shell.c:1128
error: src/shared/shell.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index db79c882c..fbccff5b5 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)