diff -Nru nvme-cli-1.16/debian/changelog nvme-cli-1.16/debian/changelog --- nvme-cli-1.16/debian/changelog 2022-07-16 15:04:24.000000000 +0000 +++ nvme-cli-1.16/debian/changelog 2022-11-08 11:24:04.000000000 +0000 @@ -1,3 +1,10 @@ +nvme-cli (1.16-4ubuntu0.1) kinetic; urgency=medium + + * Fix broken tab completions: Collapse declaration and attribute assignment + and fix malformed _cmd (LP: #1980820) + + -- Benjamin Drung Tue, 08 Nov 2022 12:24:04 +0100 + nvme-cli (1.16-4) sid; urgency=medium * Uploading to sid. diff -Nru nvme-cli-1.16/debian/patches/completions-Collapse-declaration-and-attribute-assignment.patch nvme-cli-1.16/debian/patches/completions-Collapse-declaration-and-attribute-assignment.patch --- nvme-cli-1.16/debian/patches/completions-Collapse-declaration-and-attribute-assignment.patch 1970-01-01 00:00:00.000000000 +0000 +++ nvme-cli-1.16/debian/patches/completions-Collapse-declaration-and-attribute-assignment.patch 2022-11-08 11:23:54.000000000 +0000 @@ -0,0 +1,67 @@ +From: Brad Mouring +Date: Mon, 2 May 2022 22:38:24 -0500 +Subject: completions: Collapse declaration and attribute assignment + +Previously, the associative arrays for the vendor/subcommands and +vendor/functions listings were split into a declaration of type +(using "typeset") and attribute definition (using "readonly"). On +bash 5.1.16 (at least), this lead to the following error (reported +after enabling -xv to expand and print shell inputs) + + ... + + . /usr/share/bash-completion/completions/nvme + # bash tab completion for the nvme command line utility + # (unfortunately, bash won't let me add descriptions to cmds) + # Kelly Kaoudis kelly.n.kaoudis at intel.com, Aug. 2015 + + # Constant to indicate command has no options + readonly NO_OPTS="" + ++ readonly NO_OPTS= + ++ NO_OPTS= + + # Associative array of plugins and associated subcommands + # Order here is same as PLUGIN_OBJS in Makefile + typeset -A _plugin_subcmds + ++ typeset -A _plugin_subcmds + readonly _plugin_subcmds=( + [intel]="id-ctrl internal-log lat-stats \ + ... + ++ _plugin_subcmds=(['intel']='id-ctrl internal-log lat-stats... + bash: 'intel': syntax error: operand expected (error token is "'intel'") + ... + +Using the available flags for "typeset" to declare the variables as +readonly arrays resolved the issue (and allows for bash completion +to work as-expected) + +Signed-off-by: Brad Mouring +Bug-Ubuntu: https://launchpad.net/bugs/1980820 +Origin: https://github.com/linux-nvme/nvme-cli/commit/25fd8c707b106ca0763402566ad657ef710bf09e +--- + completions/bash-nvme-completion.sh | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh +index ce5520b..6853211 100644 +--- a/completions/bash-nvme-completion.sh ++++ b/completions/bash-nvme-completion.sh +@@ -7,8 +7,7 @@ readonly NO_OPTS="" + + # Associative array of plugins and associated subcommands + # Order here is same as PLUGIN_OBJS in Makefile +-typeset -A _plugin_subcmds +-readonly _plugin_subcmds=( ++typeset -Ar _plugin_subcmds=( + [intel]="id-ctrl internal-log lat-stats \ + set-bucket-thresholds lat-stats-tracking \ + market-name smart-log-add temp-stats" +@@ -57,8 +56,7 @@ readonly _plugin_subcmds=( + ) + + # Associative array mapping plugins to coresponding option completions +-typeset -A _plugin_funcs +-readonly _plugin_funcs=( ++typeset -Ar _plugin_funcs=( + [intel]="plugin_intel_opts" + [amzn]="plugin_amzn_opts" + [lnvm]="plugin_lnvm_opts" diff -Nru nvme-cli-1.16/debian/patches/completions-Fix-malformed-_cmds.patch nvme-cli-1.16/debian/patches/completions-Fix-malformed-_cmds.patch --- nvme-cli-1.16/debian/patches/completions-Fix-malformed-_cmds.patch 1970-01-01 00:00:00.000000000 +0000 +++ nvme-cli-1.16/debian/patches/completions-Fix-malformed-_cmds.patch 2022-11-08 11:23:54.000000000 +0000 @@ -0,0 +1,30 @@ +From: Benjamin Drung +Date: Tue, 8 Nov 2022 12:15:30 +0100 +Subject: completions: Fix malformed _cmds + +The merge commit 6a7986002040 did not resolve the merge conflict correct +and causes a malformed `_cmds`. This merge commit is only part of +release 1.16 and the 2.x releases are not affected. + +Bug-Ubuntu: https://launchpad.net/bugs/1980820 +Forwarded: not-needed +Fixes: 6a7986002040 ("Merge branch 'nvme-cli-monolithic' into lockdown") +Signed-off-by: Benjamin Drung +--- + completions/bash-nvme-completion.sh | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh +index 41938d7..ce5520b 100644 +--- a/completions/bash-nvme-completion.sh ++++ b/completions/bash-nvme-completion.sh +@@ -101,8 +101,7 @@ _cmds="list list-subsys id-ctrl id-ns \ + connect disconnect disconnect-all gen-hostnqn \ + show-hostnqn dir-receive dir-send virt-mgmt \ + rpmb boot-part-log fid-support-effects-log \ +- supported-log-pages lockdown" +- supported-log-pages list-endgrp" ++ supported-log-pages list-endgrp lockdown" + + # Add plugins: + for plugin in "${!_plugin_subcmds[@]}"; do diff -Nru nvme-cli-1.16/debian/patches/Fix-typo-hsot-to-host.patch nvme-cli-1.16/debian/patches/Fix-typo-hsot-to-host.patch --- nvme-cli-1.16/debian/patches/Fix-typo-hsot-to-host.patch 1970-01-01 00:00:00.000000000 +0000 +++ nvme-cli-1.16/debian/patches/Fix-typo-hsot-to-host.patch 2022-11-08 11:23:54.000000000 +0000 @@ -0,0 +1,32 @@ +From: Martin Belanger +Date: Tue, 15 Mar 2022 07:35:16 -0400 +Subject: Fix typo - hsot to host + +Signed-off-by: Martin Belanger +Origin: https://github.com/linux-nvme/nvme-cli/commit/3eb45fc914ad9fbb02a6ad66be0692c9a9de4c2e +--- + completions/bash-nvme-completion.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh +index 6853211..89fc3e5 100644 +--- a/completions/bash-nvme-completion.sh ++++ b/completions/bash-nvme-completion.sh +@@ -439,7 +439,7 @@ nvme_list_opts () { + ;; + "discover") + opts+=" --transport= -t -traddr= -a -trsvcid= -s \ +- --host-traddr= -w --hsot-iface= -f \ ++ --host-traddr= -w --host-iface= -f \ + --hostnqn= -q --hostid -I --raw= -r \ + --raw= -r --device= -d --keep-alive-tmo= -k \ + --ctrl-loss-tmo= -l --fast-io-fail-tmo= -f \ +@@ -451,7 +451,7 @@ nvme_list_opts () { + ;; + "connect-all") + opts+=" --transport= -t -traddr= -a -trsvcid= -s \ +- --host-traddr= -w --hsot-iface= -f \ ++ --host-traddr= -w --host-iface= -f \ + --hostnqn= -q --hostid -I --raw= -r \ + --raw= -r --device= -d --keep-alive-tmo= -k \ + --ctrl-loss-tmo= -l --fast-io-fail-tmo= -f \ diff -Nru nvme-cli-1.16/debian/patches/series nvme-cli-1.16/debian/patches/series --- nvme-cli-1.16/debian/patches/series 2022-07-14 18:28:02.000000000 +0000 +++ nvme-cli-1.16/debian/patches/series 2022-11-08 11:23:54.000000000 +0000 @@ -1 +1,4 @@ debian/0001-systemd.patch +completions-Fix-malformed-_cmds.patch +completions-Collapse-declaration-and-attribute-assignment.patch +Fix-typo-hsot-to-host.patch