From 447b5fa8697ddbeaf7b9739560d90783c89abce3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 2 Sep 2024 13:31:52 +0100 Subject: [PATCH] Fix parsing of /etc/fstab resolves: RHEL-55741 --- ...-Allow-comma-after-the-last-option-8.patch | 64 +++++++++++++++++++ augeas.spec | 10 ++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0001-lenses-fstab.aug-Allow-comma-after-the-last-option-8.patch diff --git a/0001-lenses-fstab.aug-Allow-comma-after-the-last-option-8.patch b/0001-lenses-fstab.aug-Allow-comma-after-the-last-option-8.patch new file mode 100644 index 0000000..51a1031 --- /dev/null +++ b/0001-lenses-fstab.aug-Allow-comma-after-the-last-option-8.patch @@ -0,0 +1,64 @@ +From 1cba85ead1ecf582666568e2abde06b3d7830a2f Mon Sep 17 00:00:00 2001 +From: Cosmin Tupangiu +Date: Thu, 18 Jul 2024 13:02:20 +0200 +Subject: [PATCH] lenses/fstab.aug: Allow comma after the last option (#838) + +This PR adds a new lens that allows a comma after the last option: + +/dev/mapper/foo-bar / xfs defaults, 0 0 + +Fixes: https://issues.redhat.com/browse/RHEL-35873 + +Signed-off-by: Cosmin Tupangiu +(cherry picked from commit 5246ef07381033a9b20426370156dae9f8f97a2c) +--- + lenses/fstab.aug | 3 ++- + lenses/tests/test_fstab.aug | 11 +++++++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/lenses/fstab.aug b/lenses/fstab.aug +index 2e549557..c653c489 100644 +--- a/lenses/fstab.aug ++++ b/lenses/fstab.aug +@@ -5,6 +5,7 @@ module Fstab = + + let sep_tab = Sep.tab + let sep_spc = Sep.space ++ let sep_comma_tab = del /,?[ \t]+/ "\t" + let comma = Sep.comma + let eol = Util.eol + +@@ -28,7 +29,7 @@ module Fstab = + [ label "file" . store file ] . sep_tab . + comma_sep_list "vfstype" . + (sep_tab . comma_sep_list "opt" . +- (sep_tab . [ label "dump" . store /[0-9]+/ ] . ++ (sep_comma_tab . [ label "dump" . store /[0-9]+/ ] . + ( sep_spc . [ label "passno" . store /[0-9]+/ ])? )? )? + . Util.comment_or_eol ] + +diff --git a/lenses/tests/test_fstab.aug b/lenses/tests/test_fstab.aug +index 438f619a..4a912e59 100644 +--- a/lenses/tests/test_fstab.aug ++++ b/lenses/tests/test_fstab.aug +@@ -156,6 +156,17 @@ module Test_fstab = + { "#comment" = "device at install: /dev/sda3" } + } + ++ (* Bug #832 - Allow comma after the last option *) ++ test Fstab.lns get "/dev/mapper/foo-bar / xfs defaults, 0 0\n" = ++ { "1" ++ { "spec" = "/dev/mapper/foo-bar" } ++ { "file" = "/" } ++ { "vfstype" = "xfs" } ++ { "opt" = "defaults" } ++ { "dump" = "0" } ++ { "passno" = "0" } ++ } ++ + (* Local Variables: *) + (* mode: caml *) + (* End: *) +-- +2.43.0 + diff --git a/augeas.spec b/augeas.spec index 23c6aeb..2a74b0d 100644 --- a/augeas.spec +++ b/augeas.spec @@ -1,6 +1,6 @@ Name: augeas Version: 1.14.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A library for changing configuration files License: LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND Kazlib AND GPL-2.0-or-later AND BSD-2-Clause AND LicenseRef-Fedora-Public-Domain @@ -10,6 +10,10 @@ URL: http://augeas.net/ # http://download.augeas.net/ Source0: https://github.com/hercules-team/augeas/releases/download/release-%{version}/%{name}-%{version}.tar.gz +# Fix parsing of /etc/fstab +# Upstream commit 5246ef07381033a9b20426370156dae9f8f97a2c +Patch: 0001-lenses-fstab.aug-Allow-comma-after-the-last-option-8.patch + Provides: bundled(gnulib) BuildRequires: make @@ -157,6 +161,10 @@ rm -f $RPM_BUILD_ROOT/usr/bin/dump %endif %changelog +* Mon Sep 02 2024 Richard W.M. Jones - 1.14.1-2 +- Fix parsing of /etc/fstab + resolves: RHEL-55741 + * Thu Jul 04 2024 Richard W.M. Jones - 1.14.1-1 - New upstream version 1.14.1 - Use github tarballs again.