[Pkg-libvirt-commits] [Git][libvirt-team/libvirt][debian/latest] 2 commits: patches: Add backport/vsh-Don-t-init-history-in-cmdComplete.patch
Andrea Bolognani (@abologna)
gitlab at salsa.debian.org
Mon May 6 23:59:34 BST 2024
Andrea Bolognani pushed to branch debian/latest at Libvirt Packaging Team / libvirt
Commits:
13f1f61a by Andrea Bolognani at 2024-05-07T00:04:17+02:00
patches: Add backport/vsh-Don-t-init-history-in-cmdComplete.patch
Fixes FTBFS.
Closes: #1070498
- - - - -
2c59f2b5 by Andrea Bolognani at 2024-05-07T00:04:49+02:00
Document changes and release 10.3.0-2
- - - - -
4 changed files:
- debian/changelog
- + debian/patches/backport/vsh-Don-t-init-history-in-cmdComplete.patch
- debian/patches/debian/Use-sensible-editor-by-default.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libvirt (10.3.0-2) unstable; urgency=medium
+
+ * [13f1f61] patches: Add backport/vsh-Don-t-init-history[...]
+ - Fixes FTBFS (Closes: #1070498)
+
+ -- Andrea Bolognani <eof at kiyuko.org> Tue, 07 May 2024 00:04:24 +0200
+
libvirt (10.3.0-1) unstable; urgency=medium
* [7845089] New upstream version 10.3.0
=====================================
debian/patches/backport/vsh-Don-t-init-history-in-cmdComplete.patch
=====================================
@@ -0,0 +1,83 @@
+From: Michal Privoznik <mprivozn at redhat.com>
+Date: Sat, 4 May 2024 05:12:54 +0200
+Subject: vsh: Don't init history in cmdComplete()
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+Recent rework of virshtest uncovered a subtle bug that was
+dormant in now vsh but before that even in monolithic virsh.
+
+In vsh.c there's this vshReadlineInit() function that's supposed
+to initialize readline library, i.e. set those global rl_*
+pointers. But it also initializes history library. Then, when
+virsh/virt-admin quits, vshReadlineDeinit() is called which
+writes history into a file (ensuring the parent directory
+exists). So far no problem.
+
+Problem arises when cmdComplete() is called (from a bash
+completer, for instance). It does not guard call to
+vshReadlineInit() with check for interactive shell (and it should
+not), but it sets ctl->historyfile which signals to
+vshReadlineDeinit() the history should be written.
+
+Now, no real history is written, because nothing was entered on
+the stdin, but the parent directory is created nevertheless. With
+recent movement in virshtest.c this means some test cases might
+create virsh history file which breaks our promise of not
+touching user's data in test suite.
+
+Resolves: https://bugs.gentoo.org/931109
+Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
+Reviewed-by: Ján Tomko <jtomko at redhat.com>
+(cherry picked from commit cab1e71f0161fd24c5d6ff4c379d3a242ea8c2d9)
+
+Forwarded: not-needed
+Origin: https://gitlab.com/libvirt/libvirt/-/commit/cab1e71f0161fd24c5d6ff4c379d3a242ea8c2d9
+---
+ tools/vsh.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/tools/vsh.c b/tools/vsh.c
+index 58855f6..e74045c 100644
+--- a/tools/vsh.c
++++ b/tools/vsh.c
+@@ -2973,7 +2973,7 @@ vshReadlineInit(vshControl *ctl)
+ const char *quote_characters = "\"'";
+
+ /* initialize readline stuff only once */
+- if (ctl->historydir)
++ if (autoCompleteOpaque)
+ return 0;
+
+ /* Opaque data for autocomplete callbacks. */
+@@ -2989,6 +2989,11 @@ vshReadlineInit(vshControl *ctl)
+ rl_completer_quote_characters = quote_characters;
+ rl_char_is_quoted_p = vshReadlineCharIsQuoted;
+
++ /* Stuff below is needed only for interactive mode. */
++ if (!ctl->imode) {
++ return 0;
++ }
++
+ histsize_env = g_strdup_printf("%s_HISTSIZE", ctl->env_prefix);
+
+ /* Limit the total size of the history buffer */
+@@ -3149,7 +3154,7 @@ vshInit(vshControl *ctl, const vshCmdGrp *groups)
+ cmdGroups = groups;
+
+ if (vshInitDebug(ctl) < 0 ||
+- (ctl->imode && vshReadlineInit(ctl) < 0))
++ vshReadlineInit(ctl) < 0)
+ return false;
+
+ return true;
+@@ -3168,7 +3173,7 @@ vshInitReload(vshControl *ctl)
+
+ if (ctl->imode)
+ vshReadlineDeinit(ctl);
+- if (ctl->imode && vshReadlineInit(ctl) < 0)
++ if (vshReadlineInit(ctl) < 0)
+ return false;
+
+ return true;
=====================================
debian/patches/debian/Use-sensible-editor-by-default.patch
=====================================
@@ -10,7 +10,7 @@ Forwarded: not-needed
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vsh.c b/tools/vsh.c
-index 58855f6..43fbf30 100644
+index e74045c..4a306d7 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2554,7 +2554,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *doc)
=====================================
debian/patches/series
=====================================
@@ -1,4 +1,5 @@
backport/rpc-ensure-temporary-GSource-is-removed-from-client-event.patch
+backport/vsh-Don-t-init-history-in-cmdComplete.patch
forward/Reduce-udevadm-settle-timeout-to-10-seconds.patch
debian/Debianize-libvirt-guests.patch
debian/apparmor_profiles_local_include.patch
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/cf576b16dc6b52fc94c54959baf72c6654a2eeda...2c59f2b539ec8be405abbb049995646bc02971d6
--
View it on GitLab: https://salsa.debian.org/libvirt-team/libvirt/-/compare/cf576b16dc6b52fc94c54959baf72c6654a2eeda...2c59f2b539ec8be405abbb049995646bc02971d6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20240506/64118087/attachment-0001.htm>
More information about the Pkg-libvirt-commits
mailing list