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

Proposed by Mitchell Dzurick
Status: Merged
Merged at revision: 34d45acb46aa81d8589b6331e4aa6d41d6715bf8
Proposed branch: ~mitchdz/ubuntu/+source/ec2-hibinit-agent:mitch/fix-locale-quotes-focal
Merge into: ubuntu/+source/ec2-hibinit-agent:ubuntu/focal-devel
Diff against target: 109 lines (+70/-0)
5 files modified
debian/changelog (+10/-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 (+21/-0)
Reviewer Review Type Date Requested Status
Dan Bungert (community) Approve
Michael Hudson-Doyle (community) Approve
git-ubuntu import Pending
Review via email: mp+445093@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
Mitchell Dzurick (mitchdz) wrote :

for some reason `rmdir --ignore-fail-on-non-empty -p` fails with an exit code of 1, but properly removes all the directories I want. Therefore this d/postinst is a little different than the others by ignoring STDOUT/STDERR and passing the rmdir command unconditionally.

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

Subscribers

People subscribed via source and target branches