From d675a298a11b0e2fc7f2772d3a2a7c8ca91699fe Mon Sep 17 00:00:00 2001 From: shixuantong Date: Thu, 14 Nov 2024 09:08:14 +0800 Subject: [PATCH] fix: properly handle blank lines in fstab --- ...rly-handle-blank-lines-in-fstab-5643.patch | 32 +++++++++++++++++++ cloud-init.spec | 9 +++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 backport-fix-properly-handle-blank-lines-in-fstab-5643.patch diff --git a/backport-fix-properly-handle-blank-lines-in-fstab-5643.patch b/backport-fix-properly-handle-blank-lines-in-fstab-5643.patch new file mode 100644 index 0000000..d18726a --- /dev/null +++ b/backport-fix-properly-handle-blank-lines-in-fstab-5643.patch @@ -0,0 +1,32 @@ +From 93f30bbfcb073fd8213c18c2e7eb7f857234fc8a Mon Sep 17 00:00:00 2001 +From: James Falcon +Date: Thu, 29 Aug 2024 18:22:23 -0400 +Subject: [PATCH] fix: properly handle blank lines in fstab (#5643) + +Reference:https://github.com/canonical/cloud-init/commit/93f30bbfcb073fd8213c18c2e7eb7f857234fc8a +Conflict:(1)not change test, the corresponding test case does not exist. +(2)change handle() not parse_fstab(), diff commit is d15a770. +--- + cloudinit/config/cc_mounts.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py +index 2d645b3..f97b870 100644 +--- a/cloudinit/config/cc_mounts.py ++++ b/cloudinit/config/cc_mounts.py +@@ -384,8 +384,9 @@ def handle(_name, cfg, cloud, log, _args): + toks = WS.split(line) + except Exception: + pass +- fstab_devs[toks[0]] = line +- fstab_lines.append(line) ++ if toks: ++ fstab_devs[toks[0]] = line ++ fstab_lines.append(line) + + device_aliases = cfg.get("device_aliases", {}) + +-- +2.33.0 + + diff --git a/cloud-init.spec b/cloud-init.spec index a66653e..5aa8fbf 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 21.4 -Release: 30 +Release: 31 Summary: the defacto multi-distribution package that handles early initialization of a cloud instance. License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -83,6 +83,7 @@ Patch6048: backport-fix-openstack-Fix-bond-mac_address-5369.patch Patch6049: backport-fix-net-klibc-ipconfig-PROTO-compatibility-5437.patch Patch6050: backport-feat-Ensure-random-passwords-contain-multiple-charac.patch Patch6051: backport-test-Fix-duplicate-judgment-conditions-in-password-g.patch +Patch6052: backport-fix-properly-handle-blank-lines-in-fstab-5643.patch BuildRequires: pkgconfig(systemd) python3-devel python3-setuptools systemd BuildRequires: iproute python3-configobj python3-httpretty >= 0.8.14-2 @@ -193,6 +194,12 @@ fi %exclude /usr/share/doc/* %changelog +* Thu Nov 14 2024 shixuantong - 21.4-31 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix: properly handle blank lines in fstab + * Mon Nov 04 2024 shixuantong - 21.4-30 - Type:bugfix - CVE:NA -- Gitee