[PATCH] lxc: Format --handshakefd for controller cmd fully

The command line argument is called --hanshakefd (check out lxc_controller.c:main()). But the command line builder puts only --handshake. This works, because there is no other argument sharing the prefix. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/lxc/lxc_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index b2a7f105a9..ac635efe7a 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1002,7 +1002,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver, virCommandAddArgPair(cmd, "--security", virSecurityManagerGetModel(driver->securityManager)); - virCommandAddArg(cmd, "--handshake"); + virCommandAddArg(cmd, "--handshakefd"); virCommandAddArgFormat(cmd, "%d", handshakefd); for (i = 0; veths && veths[i]; i++) -- 2.26.3

On Mon, Apr 19, 2021 at 09:34:16AM +0200, Michal Privoznik wrote:
The command line argument is called --hanshakefd (check out lxc_controller.c:main()). But the command line builder puts only --handshake. This works, because there is no other argument sharing the prefix.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/lxc/lxc_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>

On Mon, Apr 19, 2021 at 09:34:16 +0200, Michal Privoznik wrote:
The command line argument is called --hanshakefd (check out lxc_controller.c:main()). But the command line builder puts only --handshake. This works, because there is no other argument sharing the prefix.
That is an extremely questionable "feature" of the commanline parser.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/lxc/lxc_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>

On 4/19/21 11:01 AM, Peter Krempa wrote:
On Mon, Apr 19, 2021 at 09:34:16 +0200, Michal Privoznik wrote:
The command line argument is called --hanshakefd (check out lxc_controller.c:main()). But the command line builder puts only --handshake. This works, because there is no other argument sharing the prefix.
That is an extremely questionable "feature" of the commanline parser.
Indeed. but that's how getopt_long() works. From its man page: Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option. I'm not sure how to turn this behaviour off. Also, it's not just us who suffers from it, e.g. 'git rebase --int'.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/lxc/lxc_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Thanks. Michal
participants (3)
-
Michal Privoznik
-
Pavel Hrdina
-
Peter Krempa