GNOME Bugzilla – Bug 772629
BASH Auto-Completion does not properly escape Parentheses
Last modified: 2016-10-26 11:46:55 UTC
Hello, good people. I have my NetworkManager set up to use a few OpenVPN providers, each of which has multiple servers. So, in naming these connections, I use something like this: "Provider (Server)" so I know exactly what I'm connecting to. However, when I use BASH to type this: "nmcli con up id Privder[Tab button]", I get this: "Privider\ (". As you can see, the first parenthesis has not been properly escaped, which is really annoying. If I manually add a backslash before pressing the Tab button again, the backslash gets removed. This also happens when I use "nmcli con down blablabla". I'm using the BASH completion script that came with my distro, Ubuntu 16.04 "Xenial Xerus".
BTW, I reported that the issue affects version 1.2.x, since that's what my distro comes with. However, in case the issue was fixed somehow, I decided to download the latest completion file from "https://raw.githubusercontent.com/NetworkManager/NetworkManager/58349c3885fec0ab43bbcff025ffa04b9e9b7b4b/clients/cli/nmcli-completion" and the issue was present there, too (I made sure to use a new shell to test it). So I guess this applies to git master as well.
Created attachment 337850 [details] [review] [PATCH] cli: completion: escape shell special characters "()&!"
Applied to master, nm-1-4 and nm-1-2 branches: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=108f04e71eeeb599073eb11ebbdf9b09dabeb6a3 https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?h=nm-1-4&id=c53496fe4a8a669b7208d4036c3a7c55ced0865c https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?h=nm-1-2&id=8ecc5e37d3bfb13b23bc01d669325f59e8ac41f8