Merge ~mitchdz/ubuntu/+source/ec2-hibinit-agent:mitch/fix-locale-quotes-lunar into ubuntu/+source/ec2-hibinit-agent:ubuntu/lunar-devel

Proposed by Mitchell Dzurick
Status: Merged
Merged at revision: 4605476a144d7747b972177bae901236efab0f61
Proposed branch: ~mitchdz/ubuntu/+source/ec2-hibinit-agent:mitch/fix-locale-quotes-lunar
Merge into: ubuntu/+source/ec2-hibinit-agent:ubuntu/lunar-devel
Diff against target: 108 lines (+69/-0)
5 files modified
debian/changelog (+11/-0)
debian/patches/lp2023924-remove-quotes-from-state-dir.patch (+19/-0)
debian/patches/lp2024505-fix-locale-issue.patch (+18/-0)
debian/patches/series (+2/-0)
debian/postinst (+19/-0)
Reviewer Review Type Date Requested Status
Dan Bungert (community) Approve
Steve Langasek (community) Approve
Michael Hudson-Doyle (community) Approve
git-ubuntu import Pending
Review via email: mp+445090@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Thanks uploaded

review: Approve
Revision history for this message
Steve Langasek (vorlon) wrote :

LGTM

review: Approve
Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

This MP + Jammy/Kinetic/Focal need to be re-uploaded because a small change was made.

Revision history for this message
Dan Bungert (dbungert) wrote :

Uploaded, thanks!

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 c1277de..471c96f 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,14 @@
6+ec2-hibinit-agent (1.0.0-0ubuntu13.2) lunar; urgency=medium
7+
8+ * d/p/lp2023924-remove-quotes-from-state-dir.patch: fixes an issue where a
9+ weird directory would be created in root (LP: #2023924)
10+ * d/preinst: remove the directory /" if it exists
11+ * d/p/lp2024505-fix-locale-issue.patch: fixes an issue where certain locales
12+ can cause an error when trying to decode the output of `df -P`
13+ (LP: #2024505)
14+
15+ -- Mitchell Dzurick <mitchell.dzurick@canonical.com> Tue, 20 Jun 2023 17:01:17 -0700
16+
17 ec2-hibinit-agent (1.0.0-0ubuntu13.1) lunar; urgency=medium
18
19 * d/p/lp1941785-Add-support-for-IMDSv2.patch: allow hibernation of
20diff --git a/debian/patches/lp2023924-remove-quotes-from-state-dir.patch b/debian/patches/lp2023924-remove-quotes-from-state-dir.patch
21new file mode 100644
22index 0000000..d178d21
23--- /dev/null
24+++ b/debian/patches/lp2023924-remove-quotes-from-state-dir.patch
25@@ -0,0 +1,19 @@
26+Description: Remove quotes in config file for state_dir value
27+It creates strange directory /"
28+Author: Anchal Agarwal <anchalag@amazon.com>
29+Origin: backport, https://github.com/aws/amazon-ec2-hibinit-agent/commit/d87d6365009f1663247fd8595b487c59d9b121f1
30+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2023924
31+Last-Update: 2023-06-20
32+---
33+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
34+--- a/etc/hibinit-config.cfg
35++++ b/etc/hibinit-config.cfg
36+@@ -12,7 +12,7 @@
37+ touch-swap = False
38+
39+ # Location where to create any state files
40+-state-dir = "/var/lib/hibinit-agent"
41++state-dir = /var/lib/hibinit-agent
42+
43+ [swap]
44+ # If there's no swap then we create it to be equal to the specified
45diff --git a/debian/patches/lp2024505-fix-locale-issue.patch b/debian/patches/lp2024505-fix-locale-issue.patch
46new file mode 100644
47index 0000000..15a0a0d
48--- /dev/null
49+++ b/debian/patches/lp2024505-fix-locale-issue.patch
50@@ -0,0 +1,18 @@
51+Description: Change encoding to use the system locale instead of ascii.
52+Author: einynot <111812541+einynot@users.noreply.github.com>
53+Origin: backport, https://github.com/aws/amazon-ec2-hibinit-agent/commit/2392e860c7a75c2b61baef749bb90e79a2a3e81e
54+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2024505
55+Last-Update: 2023-06-20
56+---
57+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
58+--- a/agent/hibinit-agent
59++++ b/agent/hibinit-agent
60+@@ -145,7 +145,7 @@
61+
62+ def find_device_for_file(filename):
63+ # Find the mount point for the swap file ('df -P /swap')
64+- df_out = check_output(['df', '-P', filename]).decode('ascii')
65++ df_out = check_output(['df', '-P', filename]).decode(sys.getfilesystemencoding())
66+ dev_str = df_out.split("\n")[1].split()[0]
67+ return dev_str
68+
69diff --git a/debian/patches/series b/debian/patches/series
70index 043841d..0dce030 100644
71--- a/debian/patches/series
72+++ b/debian/patches/series
73@@ -10,3 +10,5 @@ detect-hibernate-cmd-by-default.patch
74 lp1968805-Swapon-with-maximum-priority-before-hibernation.patch
75 fix-setuptools-package-discovery.patch
76 lp1941785-Add-support-for-IMDSv2.patch
77+lp2023924-remove-quotes-from-state-dir.patch
78+lp2024505-fix-locale-issue.patch
79diff --git a/debian/postinst b/debian/postinst
80index 382bb41..bef2969 100755
81--- a/debian/postinst
82+++ b/debian/postinst
83@@ -2,6 +2,25 @@
84
85 set -e
86
87+PREVIOUS_VERSION="$2"
88+
89+# https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2023924
90+if [ "$PREVIOUS_VERSION" = "1.0.0-0ubuntu13.1" ]; then
91+ dirpath="/\"/var/lib/hibinit-agent\""
92+ filenamepath="${dirpath}/hibernation-enabled"
93+
94+ # If system has this package, but hibernation is not enabled, then
95+ # $filenamepath will not exist, but $dirpath will
96+ if [ -f "$filenamepath" ]; then
97+ echo "Removing file $filenamepath"
98+ rm -f $filenamepath
99+ fi
100+ if [ -d "$dirpath" ]; then
101+ echo "Recursively removing directories $dirpath"
102+ rmdir -p $dirpath --ignore-fail-on-non-empty
103+ fi
104+fi
105+
106 #DEBHELPER#
107
108 case "$1" in

Subscribers

People subscribed via source and target branches