Merge ~ubuntu-virt/ubuntu/+source/qemu:cosmic-fix-1820291-freeze-hook-and-CVE into ~ubuntu-virt/ubuntu/+source/qemu:ubuntu-cosmic-2.12

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 48510340d1092927fe50cd7825abc612f73ae354
Merge reported by: Christian Ehrhardt 
Merged at revision: 48510340d1092927fe50cd7825abc612f73ae354
Proposed branch: ~ubuntu-virt/ubuntu/+source/qemu:cosmic-fix-1820291-freeze-hook-and-CVE
Merge into: ~ubuntu-virt/ubuntu/+source/qemu:ubuntu-cosmic-2.12
Diff against target: 223 lines (+188/-1)
5 files modified
debian/changelog (+10/-0)
debian/qemu-guest-agent.install (+1/-1)
debian/qemu-guest-agent.postinst (+59/-0)
debian/qemu-guest-agent.postrm (+56/-0)
debian/qemu-guest-agent.preinst (+62/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  Approve
Canonical Server Pending
Review via email: mp+365022@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Karl Stenerud (kstenerud) wrote :

lgtm

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks Karl for the second look, Rbasak already reviewed the Disco version and mdeslaur took a look as well since we will bundle it with a security release that otherwise would kill all that I ahve in the pipe.

Setting approved due to the above.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index c55e02e..c156117 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,13 @@
6+qemu (1:2.12+dfsg-3ubuntu8.5) cosmic; urgency=medium
7+
8+ * qemu-guest-agent: fix path of fsfreeze-hook (LP: #1820291)
9+ - d/qemu-guest-agent.install: use correct path for fsfreeze-hook
10+ - d/qemu-guest-agent.pre{rm|inst}/.postrm: special handling for
11+ mv_conffile since the new path is a directory in the old package
12+ version which can not be handled by mv_conffile
13+
14+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 25 Mar 2019 10:36:24 +0100
15+
16 qemu (1:2.12+dfsg-3ubuntu8.4) cosmic; urgency=medium
17
18 * fix crash when performing block pull on partial cluster (LP: #1818264)
19diff --git a/debian/qemu-guest-agent.install b/debian/qemu-guest-agent.install
20index 8bf0389..7049413 100644
21--- a/debian/qemu-guest-agent.install
22+++ b/debian/qemu-guest-agent.install
23@@ -3,4 +3,4 @@ debian/tmp/usr/share/man/man8/qemu-ga.8 /usr/share/man/man8
24 debian/tmp/usr/share/man/man7/qemu-ga-ref.7 /usr/share/man/man7
25 debian/tmp/usr/share/doc/qemu/qemu-ga-ref.* /usr/share/doc/qemu-guest-agent
26 qga/qapi-schema.json /usr/share/doc/qemu-guest-agent
27-scripts/qemu-guest-agent/fsfreeze-hook /etc/qemu/fsfreeze-hook
28+scripts/qemu-guest-agent/fsfreeze-hook /etc/qemu/
29diff --git a/debian/qemu-guest-agent.postinst b/debian/qemu-guest-agent.postinst
30new file mode 100644
31index 0000000..ad9f7c8
32--- /dev/null
33+++ b/debian/qemu-guest-agent.postinst
34@@ -0,0 +1,59 @@
35+#!/bin/sh
36+# postinst script for qemu-guest-agent
37+#
38+# see: dh_installdeb(1)
39+
40+set -e
41+
42+# summary of how this script can be called:
43+# * <postinst> `configure' <most-recently-configured-version>
44+# * <old-postinst> `abort-upgrade' <new version>
45+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
46+# <new-version>
47+# * <postinst> `abort-remove'
48+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
49+# <failed-install-package> <version> `removing'
50+# <conflicting-package> <version>
51+# for details, see https://www.debian.org/doc/debian-policy/ or
52+# the debian-policy package
53+
54+
55+case "$1" in
56+ configure)
57+ ;;
58+
59+ abort-upgrade|abort-remove|abort-deconfigure)
60+ ;;
61+
62+ *)
63+ echo "postinst called with unknown argument \`$1'" >&2
64+ exit 1
65+ ;;
66+esac
67+
68+# dh_installdeb will replace this with shell code automatically
69+# generated by other debhelper scripts.
70+
71+#DEBHELPER#
72+
73+# Normal mv_conffile alone would fail due to the new path being a DIR in the old package version (LP: 1820291)
74+case "$1" in
75+ configure)
76+ # From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
77+ if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:2.12+dfsg-3ubuntu8.5~"; then
78+ TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
79+ NEWCONFFILE="/etc/qemu/fsfreeze-hook"
80+ ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
81+ rm -f "$TMPCONFFILE.dpkg-remove"
82+ if [ -e "$TMPCONFFILE" ]; then
83+ echo "Preserving user changes to $NEWCONFFILE (renamed from $ORIGCONFFILE)..."
84+ if [ -e "$NEWCONFFILE" ]; then
85+ mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
86+ fi
87+ mv -f "$TMPCONFFILE" "$NEWCONFFILE"
88+ fi
89+ fi
90+ ;;
91+esac
92+
93+exit 0
94diff --git a/debian/qemu-guest-agent.postrm b/debian/qemu-guest-agent.postrm
95new file mode 100644
96index 0000000..a391edd
97--- /dev/null
98+++ b/debian/qemu-guest-agent.postrm
99@@ -0,0 +1,56 @@
100+#!/bin/sh
101+# postrm script for qemu-guest-agent
102+#
103+# see: dh_installdeb(1)
104+
105+set -e
106+
107+# summary of how this script can be called:
108+# * <postrm> `remove'
109+# * <postrm> `purge'
110+# * <old-postrm> `upgrade' <new-version>
111+# * <new-postrm> `failed-upgrade' <old-version>
112+# * <new-postrm> `abort-install'
113+# * <new-postrm> `abort-install' <old-version>
114+# * <new-postrm> `abort-upgrade' <old-version>
115+# * <disappearer's-postrm> `disappear' <overwriter>
116+# <overwriter-version>
117+# for details, see https://www.debian.org/doc/debian-policy/ or
118+# the debian-policy package
119+
120+
121+case "$1" in
122+ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
123+ ;;
124+
125+ *)
126+ echo "postrm called with unknown argument \`$1'" >&2
127+ exit 1
128+ ;;
129+esac
130+
131+# dh_installdeb will replace this with shell code automatically
132+# generated by other debhelper scripts.
133+
134+#DEBHELPER#
135+
136+# If needed revert the move we have made in preinst to compensate the new path being a DIR in the old package version (LP: 1820291)
137+case "$1" in
138+ abort-install|abort-upgrade)
139+ # From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
140+ if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:2.12+dfsg-3ubuntu8.5~"; then
141+ TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
142+ NEWCONFFILE="/etc/qemu/fsfreeze-hook"
143+ ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
144+ if [ -e "$TMPCONFFILE.dpkg-remove" ]; then
145+ echo "Reinstalling $ORIGCONFFILE that was moved away"
146+ if [ -f "$NEWCONFFILE" ]; then
147+ rm -f "$NEWCONFFILE"
148+ fi
149+ mkdir -p "$NEWCONFFILE"
150+ mv "$TMPCONFFILE.dpkg-remove" "$ORIGCONFFILE"
151+ fi
152+ fi
153+esac
154+
155+exit 0
156diff --git a/debian/qemu-guest-agent.preinst b/debian/qemu-guest-agent.preinst
157new file mode 100644
158index 0000000..8b82650
159--- /dev/null
160+++ b/debian/qemu-guest-agent.preinst
161@@ -0,0 +1,62 @@
162+#!/bin/sh
163+# preinst script for qemu-guest-agent
164+#
165+# see: dh_installdeb(1)
166+
167+set -e
168+
169+# summary of how this script can be called:
170+# * <new-preinst> `install'
171+# * <new-preinst> `install' <old-version>
172+# * <new-preinst> `upgrade' <old-version>
173+# * <old-preinst> `abort-upgrade' <new-version>
174+# for details, see https://www.debian.org/doc/debian-policy/ or
175+# the debian-policy package
176+
177+
178+case "$1" in
179+ install|upgrade)
180+ ;;
181+
182+ abort-upgrade)
183+ ;;
184+
185+ *)
186+ echo "preinst called with unknown argument \`$1'" >&2
187+ exit 1
188+ ;;
189+esac
190+
191+# dh_installdeb will replace this with shell code automatically
192+# generated by other debhelper scripts.
193+
194+# Normal mv_conffile alone would fail due to the new path being a DIR in the old package version (LP: 1820291)
195+case "$1" in
196+ install|upgrade)
197+ # From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
198+ if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:2.12+dfsg-3ubuntu8.5~"; then
199+ TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
200+ NEWCONFFILE="/etc/qemu/fsfreeze-hook"
201+ ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
202+ if [ -f "$ORIGCONFFILE" ]; then
203+ disk_md5sum="$(md5sum "$ORIGCONFFILE" | sed -e 's/ .*//')"
204+ pkg_md5sum="$(dpkg-query -W -f='${Conffiles}' "qemu-guest-agent" | \
205+ sed -n -e "\'^ $ORIGCONFFILE ' { s/ obsolete$//; s/.* //; p }")"
206+ if [ "$disk_md5sum" = "$pkg_md5sum" ]; then
207+ # mark as having no custom content
208+ mv -f "$ORIGCONFFILE" "${TMPCONFFILE}.dpkg-remove"
209+ else
210+ # keep the "old" name to reflect there is content to be preserved
211+ mv -f "$ORIGCONFFILE" "$TMPCONFFILE"
212+ fi
213+ # In any case the old directory blocking the new conffile
214+ # has to be removed before unpack happens
215+ rmdir "$NEWCONFFILE" || echo "failed to remove $NEWCONFFILE"
216+ fi
217+ fi
218+ ;;
219+esac
220+
221+#DEBHELPER#
222+
223+exit 0

Subscribers

People subscribed via source and target branches

to all changes: