7f40b47bc6
- Synchronize with libvirt-10.5.0-4.el9 (RHEL-30177) - qemu: virtiofs: cache: use 'never' instead of 'none' - qemu_domain: Strip <acpi/> from s390(x) definitions - qemuxmlconftest: Add tests for the ACPI stripping hack on s390 - vsh: Allow vshReadlineInit() to be called multiple times Related: RHEL-30177
44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From b7ffa3df0ad680739fce603ba0e6d83d743f193b Mon Sep 17 00:00:00 2001
|
|
Message-ID: <b7ffa3df0ad680739fce603ba0e6d83d743f193b.1723213495.git.jdenemar@redhat.com>
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Thu, 8 Aug 2024 14:21:20 +0200
|
|
Subject: [PATCH] vsh: Allow vshReadlineInit() to be called multiple times
|
|
|
|
Thing about vshReadlineInit() is - it's called multiple times.
|
|
The first time from vshInit(), when @ctl was filled only
|
|
partially (most notably, before any argv parsing is done, hence
|
|
ctl->imode is set to false). The second time after argv parsing,
|
|
from virshInit() -> vshInitReload(). In here, ctl->imode might
|
|
have changed and thus vshReadlineInit() can't exit early - it
|
|
needs to set up stuff for interactive mode (history basically).
|
|
|
|
To allow vshReadlineInit() to be called again,
|
|
vshReadlineDeinit() must set @autoCompleteOpaque to NULL.
|
|
|
|
Fixes: cab1e71f0161fd24c5d6ff4c379d3a242ea8c2d9
|
|
Resolves: https://issues.redhat.com/browse/RHEL-53560
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
(cherry picked from commit 18fd4899f3ddd8873842ab24cf39bf51b1bf3a02)
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
---
|
|
tools/vsh.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/tools/vsh.c b/tools/vsh.c
|
|
index 9fbb1f9349..5f5e2f281d 100644
|
|
--- a/tools/vsh.c
|
|
+++ b/tools/vsh.c
|
|
@@ -3040,6 +3040,9 @@ vshReadlineDeinit(vshControl *ctl)
|
|
|
|
g_clear_pointer(&ctl->historydir, g_free);
|
|
g_clear_pointer(&ctl->historyfile, g_free);
|
|
+
|
|
+ /* Allow vshReadlineInit() to be called again. */
|
|
+ autoCompleteOpaque = NULL;
|
|
}
|
|
|
|
char *
|
|
--
|
|
2.46.0
|