diff --git a/SOURCES/0015-app-Always-add-guest-name-comment.patch b/SOURCES/0015-app-Always-add-guest-name-comment.patch new file mode 100644 index 0000000..64e5aff --- /dev/null +++ b/SOURCES/0015-app-Always-add-guest-name-comment.patch @@ -0,0 +1,38 @@ +From 1397ef78ac43e971cef317893f9fe597bf7074ed Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Thu, 30 Aug 2018 13:51:17 +0200 +Subject: [PATCH] app: Always add guest name comment + +Even when the user adds comments, we should place the guest's name +unless it is present already. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1623756 + +Signed-off-by: Victor Toso +Acked-by: Christophe Fergeau +(cherry picked from commit 7ffb7f9cf485f6eefacccf6b20167b0d67521ebb) +--- + src/virt-viewer-app.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c +index e90afe8..6f17842 100644 +--- a/src/virt-viewer-app.c ++++ b/src/virt-viewer-app.c +@@ -258,9 +258,13 @@ virt_viewer_app_save_config(VirtViewerApp *self) + if (error) { + g_debug("Unable to get comment from key file: %s", error->message); + g_clear_error(&error); +- } else { +- if (!comment || *comment == '\0') +- g_key_file_set_comment(priv->config, priv->uuid, NULL, priv->guest_name, NULL); ++ } ++ ++ if (comment == NULL || ++ (comment != NULL && g_strstr_len(comment, -1, priv->guest_name) == NULL)) { ++ /* Note that this function appends the guest's name string as last ++ * comment in case there were comments there already */ ++ g_key_file_set_comment(priv->config, priv->uuid, NULL, priv->guest_name, NULL); + } + g_free(comment); + } diff --git a/SPECS/virt-viewer.spec b/SPECS/virt-viewer.spec index b446213..afd2d86 100644 --- a/SPECS/virt-viewer.spec +++ b/SPECS/virt-viewer.spec @@ -19,7 +19,7 @@ Name: virt-viewer Version: 7.0 -Release: 8%{?dist}%{?extra_release} +Release: 9%{?dist}%{?extra_release} Summary: Virtual Machine Viewer Group: Applications/System License: GPLv2+ @@ -40,6 +40,7 @@ Patch011: 0011-virt-viewer-file-transfer-dialog-improve-error-messa.patch Patch012: 0012-ovirt-foreign-menu-Factor-out-code-to-set-file-colle.patch Patch013: 0013-Workaround-inconsistency-with-REST-API.patch Patch014: 0014-remote-viewer-Set-admin-privileges-when-connecting-t.patch +Patch015: 0015-app-Always-add-guest-name-comment.patch Requires: openssh-clients @@ -99,6 +100,7 @@ the display, and libvirt for looking up VNC/SPICE server details. %patch012 -p1 %patch013 -p1 %patch014 -p1 +%patch015 -p1 %build @@ -138,6 +140,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/remote-viewer.1* %changelog +* Tue Dec 17 2019 Victor Toso - 7.0-9 +- Always add vm's name to settings file + Related: rhbz#1750706 + * Tue Aug 27 2019 Eduardo Lima (Etrunko) - 7.0-8 - Request tolplevel storage domain API object Related: rhbz#1717900