From 130b58bbb09d31999e002eb6c37f5457219eef3a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Apr 2020 05:41:10 -0400 Subject: [PATCH] import augeas-1.12.0-5.el8 --- ...kernel-command-line-option-names-647.patch | 58 ++++++++++++ ...multiple-actions-in-filters-and-sele.patch | 94 +++++++++++++++++++ ...nexttoken-add-more-escape-characters.patch | 37 ++++++++ ...opefully-fix-readline-quoting-issues.patch | 42 +++++++++ ...-improve-dbmodules-and-includes-630.patch} | 2 +- ...x-parsing-of-envvars-with-spaces-659.patch | 59 ++++++++++++ SPECS/augeas.spec | 21 ++++- 7 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch create mode 100644 SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch create mode 100644 SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch create mode 100644 SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch rename SOURCES/{0001-Krb5-improve-dbmodules-and-includes-630.patch => 0005-Krb5-improve-dbmodules-and-includes-630.patch} (98%) create mode 100644 SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch diff --git a/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch b/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch new file mode 100644 index 0000000..9fa5246 --- /dev/null +++ b/SOURCES/0001-Grub-support-in-kernel-command-line-option-names-647.patch @@ -0,0 +1,58 @@ +From 800b8bb56b983e00f2c95183d0ff226172545d35 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 23 Oct 2019 11:35:57 +0200 +Subject: [PATCH] Grub: support '+' in kernel command line option names (#647) + +This way it is possible to parse files that pass options with '+' in the +name to the kernel. + +(cherry picked from commit 2ba77589baee1bf2d43d3a49f8e6f3eb522e5bba) +--- + lenses/grub.aug | 2 +- + lenses/tests/test_grub.aug | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/lenses/grub.aug b/lenses/grub.aug +index 24ad39bc..82c1c37a 100644 +--- a/lenses/grub.aug ++++ b/lenses/grub.aug +@@ -196,7 +196,7 @@ module Grub = + (* View: kernel_args + Parse the file name and args on a kernel or module line. *) + let kernel_args = +- let arg = /[A-Za-z0-9_.$-]+/ - /type|no-mem-option/ in ++ let arg = /[A-Za-z0-9_.$\+-]+/ - /type|no-mem-option/ in + store /(\([a-z0-9,]+\))?\/[^ \t\n]*/ . + (spc . multiboot_arg)? . + (spc . [ key arg . (eq. store /([^ \t\n])*/)?])* . eol +diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug +index 75657203..e50bdc4f 100644 +--- a/lenses/tests/test_grub.aug ++++ b/lenses/tests/test_grub.aug +@@ -258,6 +258,23 @@ password --encrypted ^9^32kwzzX./3WISQ0C /boot/grub/custom.lst + { "md5" } + } } + ++ (* Test kernel options with different special characters. *) ++ test Grub.lns get "title Fedora (2.6.24.4-64.fc8) ++ root (hd0,0) ++ kernel /vmlinuz-2.6.24.4-64.fc8 ro root=/dev/vg00/lv00 with.dot=1 with-dash=1 with_underscore=1 with+plus=1 ++ initrd /initrd-2.6.24.4-64.fc8.img\n" = ++ { "title" = "Fedora (2.6.24.4-64.fc8)" ++ { "root" = "(hd0,0)" } ++ { "kernel" = "/vmlinuz-2.6.24.4-64.fc8" ++ { "ro" } ++ { "root" = "/dev/vg00/lv00" } ++ { "with.dot" = "1" } ++ { "with-dash" = "1" } ++ { "with_underscore" = "1" } ++ { "with+plus" = "1" } ++ } ++ { "initrd" = "/initrd-2.6.24.4-64.fc8.img" } } ++ + (* Test parsing of invalid entries via menu_error *) + test Grub.lns get "default=0\ncrud=no\n" = + { "default" = "0" } +-- +2.24.1 + diff --git a/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch b/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch new file mode 100644 index 0000000..26045d1 --- /dev/null +++ b/SOURCES/0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch @@ -0,0 +1,94 @@ +From 612010470f4217b447b5ed5fe964fce1d895566a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= +Date: Tue, 12 Nov 2019 13:33:26 +0100 +Subject: [PATCH] Rsyslog: support multiple actions in filters and selectors + (#653) + +(cherry picked from commit 5181105bae84dc7819a00886f068ad0bb4e6d05a) +--- + lenses/rsyslog.aug | 11 ++++++++--- + lenses/tests/test_rsyslog.aug | 37 +++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+), 3 deletions(-) + +diff --git a/lenses/rsyslog.aug b/lenses/rsyslog.aug +index 7b9f7dc9..29ff9b10 100644 +--- a/lenses/rsyslog.aug ++++ b/lenses/rsyslog.aug +@@ -65,11 +65,17 @@ let hostname = [ label "hostname" . + ( Syslog.plus | [ Build.xchgs "-" "reverse" ] ) . + Syslog.hostnames . Util.eol . Syslog.entries ] + ++(* View: actions *) ++let actions = ++ let prop_act = [ label "action" . action ] ++ in let act_sep = del /[ \t]*\n&[ \t]*/ "\n& " ++ in Build.opt_list prop_act act_sep ++ + (* View: entry + An entry contains selectors and an action + *) + let entry = [ label "entry" . Syslog.selectors . Syslog.sep_tab . +- [ label "action" . action ] . Util.eol ] ++ actions . Util.eol ] + + (* View: prop_filter + Parses property-based filters, which start with ":" and the property name *) +@@ -78,9 +84,8 @@ let prop_filter = + in let prop_name = [ Util.del_str ":" . label "property" . store Rx.word ] + in let prop_oper = [ label "operation" . store /[A-Za-z!-]+/ ] + in let prop_val = [ label "value" . Quote.do_dquote (store /[^\n"]*/) ] +- in let prop_act = [ label "action" . action ] + in [ label "filter" . prop_name . sep . prop_oper . sep . prop_val . +- Sep.space . prop_act . Util.eol ] ++ Sep.space . actions . Util.eol ] + + let entries = ( Syslog.empty | Util.comment | entry | macro | config_object | prop_filter )* + +diff --git a/lenses/tests/test_rsyslog.aug b/lenses/tests/test_rsyslog.aug +index 9011a2b3..e83613a2 100644 +--- a/lenses/tests/test_rsyslog.aug ++++ b/lenses/tests/test_rsyslog.aug +@@ -222,3 +222,40 @@ test Rsyslog.lns get "*.* ?DynamicFile\n" = + { "dynamic" = "DynamicFile" } + } + } ++ ++(* Multiple actions in filters and selectors *) ++test Rsyslog.lns get ":msg, startswith, \"iptables:\" -/var/log/iptables.log ++& ~ ++# Save boot messages also to boot.log ++local7.* /var/log/boot.log ++local3.err /var/log/nfsen/nfsenlog ++& /var/log/also.log ++\n" = ++ { "filter" ++ { "property" = "msg" } ++ { "operation" = "startswith" } ++ { "value" = "iptables:" } ++ { "action" ++ { "no_sync" } ++ { "file" = "/var/log/iptables.log" } } ++ { "action" ++ { "discard" } } ++ } ++ { "#comment" = "Save boot messages also to boot.log" } ++ { "entry" ++ { "selector" ++ { "facility" = "local7" } ++ { "level" = "*" } } ++ { "action" ++ { "file" = "/var/log/boot.log" } } ++ } ++ { "entry" ++ { "selector" ++ { "facility" = "local3" } ++ { "level" = "err" } } ++ { "action" ++ { "file" = "/var/log/nfsen/nfsenlog" } } ++ { "action" ++ { "file" = "/var/log/also.log" } } } ++ { } ++ +-- +2.24.1 + diff --git a/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch b/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch new file mode 100644 index 0000000..3f34bda --- /dev/null +++ b/SOURCES/0003-src-augrun.c-nexttoken-add-more-escape-characters.patch @@ -0,0 +1,37 @@ +From d37c8aabc29c3989d5f961d8b742b246a5f64cdf Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 17 May 2019 13:47:20 +0200 +Subject: [PATCH] * src/augrun.c (nexttoken): add more escape characters + +Synchonize the list of "pass-through" characters with the set in the +'name_follow' variable in pathx.c: as pathx_escape_name() escapes them, +make sure that aug_srun() accepts them as arguments. +--- + src/augrun.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/augrun.c b/src/augrun.c +index 07f865a9..fd710c5f 100644 +--- a/src/augrun.c ++++ b/src/augrun.c +@@ -133,8 +133,16 @@ static char *nexttoken(struct command *cmd, char **line, bool path) { + copy = true; + if (*s == '\\') { + switch (*(s+1)) { ++ case ']': + case '[': +- case ']': /* pass both literally */ ++ case '|': ++ case '/': ++ case '=': ++ case '(': ++ case ')': ++ case '!': ++ case ',': /* pass them literally; ++ * see 'name_follow' in pathx.c */ + nescaped = 2; + break; + case 't': /* insert tab */ +-- +2.24.1 + diff --git a/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch b/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch new file mode 100644 index 0000000..c76fdb4 --- /dev/null +++ b/SOURCES/0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch @@ -0,0 +1,42 @@ +From f224dd99c7dc4d2ce4340b2d16cae6b1e0ed7c8d Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Fri, 17 May 2019 15:18:50 +0200 +Subject: [PATCH] * src/augtool.c: hopefully fix readline quoting issues + +Configure the quoting (also using a detector) and word break characters, +so it is possible to autocomplete paths with special characters (like +spaces, which are already quoted by augeas). +--- + src/augtool.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/augtool.c b/src/augtool.c +index b42ef630..31a991eb 100644 +--- a/src/augtool.c ++++ b/src/augtool.c +@@ -267,10 +267,22 @@ static char *get_home_dir(uid_t uid) { + return result; + } + ++/* Inspired from: ++ * https://thoughtbot.com/blog/tab-completion-in-gnu-readline ++ */ ++static int quote_detector(char *str, int index) { ++ return index > 0 ++ && str[index - 1] == '\\' ++ && quote_detector(str, index - 1) == 0; ++} ++ + static void readline_init(void) { + rl_readline_name = "augtool"; + rl_attempted_completion_function = readline_completion; + rl_completion_entry_function = readline_path_generator; ++ rl_completer_quote_characters = "\"'"; ++ rl_completer_word_break_characters = (char *) " "; ++ rl_char_is_quoted_p = "e_detector; + + /* Set up persistent history */ + char *home_dir = get_home_dir(getuid()); +-- +2.24.1 + diff --git a/SOURCES/0001-Krb5-improve-dbmodules-and-includes-630.patch b/SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch similarity index 98% rename from SOURCES/0001-Krb5-improve-dbmodules-and-includes-630.patch rename to SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch index 71755fa..283490d 100644 --- a/SOURCES/0001-Krb5-improve-dbmodules-and-includes-630.patch +++ b/SOURCES/0005-Krb5-improve-dbmodules-and-includes-630.patch @@ -1,4 +1,4 @@ -From 5a7471c72f0a5a5de43c81e8a058130aaf5b4545 Mon Sep 17 00:00:00 2001 +From 63786a83b2e4b14772ee8742fa95d70063ba7b6c Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 4 Feb 2020 17:54:22 +0100 Subject: [PATCH] Krb5: improve [dbmodules] and includes (#630) diff --git a/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch b/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch new file mode 100644 index 0000000..65be7da --- /dev/null +++ b/SOURCES/0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch @@ -0,0 +1,59 @@ +From 472a143b427afc89ab2fd843cea1f1f97193ceef Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Tue, 4 Feb 2020 18:05:05 +0100 +Subject: [PATCH] Systemd: fix parsing of envvars with spaces (#659) + +Allow spaces inside of values quoted with single or double quotes. + +This amends commit f64d8bc7a7670f3af2549fdcefb64c2b5f22cd0d that added +support for quoted values. +--- + lenses/systemd.aug | 4 ++-- + lenses/tests/test_systemd.aug | 9 +++++++++ + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lenses/systemd.aug b/lenses/systemd.aug +index b868e86f..77434367 100644 +--- a/lenses/systemd.aug ++++ b/lenses/systemd.aug +@@ -132,8 +132,8 @@ let entry_env = + let envkv (env_val:lens) = key env_key . Util.del_str "=" . env_val + (* bare has no spaces, and is optionally quoted *) + in let bare = Quote.do_quote_opt (envkv (store /[^#'" \t\n]*[^#'" \t\n\\]/)?) +- in let bare_dqval = envkv (store /"[^#" \t\n]*[^#" \t\n\\]"/) +- in let bare_sqval = envkv (store /'[^#' \t\n]*[^#' \t\n\\]'/) ++ in let bare_dqval = envkv (store /"[^#"\t\n]*[^#"\t\n\\]"/) ++ in let bare_sqval = envkv (store /'[^#'\t\n]*[^#'\t\n\\]'/) + (* quoted has at least one space, and must be quoted *) + in let quoted = Quote.do_quote (envkv (store /[^#"'\n]*[ \t]+[^#"'\n]*/)) + in let envkv_quoted = [ bare ] | [ bare_dqval ] | [ bare_sqval ] | [ quoted ] +diff --git a/lenses/tests/test_systemd.aug b/lenses/tests/test_systemd.aug +index 3397456e..19c57075 100644 +--- a/lenses/tests/test_systemd.aug ++++ b/lenses/tests/test_systemd.aug +@@ -206,6 +206,8 @@ FOO=BAR + Environment=\"LANG=foo bar\" FOO=BAR + Environment=OPTIONS=\"-LS0-6d\" + Environment=OPTIONS='-LS0-6d' ++Environment=VAR=\"with some spaces\" VAR2='more spaces' ++Environment=VAR='with some spaces' + " + (* Test: Systemd.lns *) + test Systemd.lns get env = +@@ -247,6 +249,13 @@ test Systemd.lns get env = + { "Environment" + { "OPTIONS" = "'-LS0-6d'" } + } ++ { "Environment" ++ { "VAR" = "\"with some spaces\"" } ++ { "VAR2" = "'more spaces'" } ++ } ++ { "Environment" ++ { "VAR" = "'with some spaces'" } ++ } + } + + (* Variable: unit *) +-- +2.24.1 + diff --git a/SPECS/augeas.spec b/SPECS/augeas.spec index 51d3523..a4bf7fb 100644 --- a/SPECS/augeas.spec +++ b/SPECS/augeas.spec @@ -1,13 +1,18 @@ Name: augeas Version: 1.12.0 -Release: 2%{?dist}.1 +Release: 5%{?dist} Summary: A library for changing configuration files Group: System Environment/Libraries License: LGPLv2+ URL: http://augeas.net/ Source0: http://download.augeas.net/%{name}-%{version}.tar.gz -Patch1: 0001-Krb5-improve-dbmodules-and-includes-630.patch +Patch1: 0001-Grub-support-in-kernel-command-line-option-names-647.patch +Patch2: 0002-Rsyslog-support-multiple-actions-in-filters-and-sele.patch +Patch3: 0003-src-augrun.c-nexttoken-add-more-escape-characters.patch +Patch4: 0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch +Patch5: 0005-Krb5-improve-dbmodules-and-includes-630.patch +Patch6: 0006-Systemd-fix-parsing-of-envvars-with-spaces-659.patch BuildRequires: readline-devel libselinux-devel libxml2-devel BuildRequires: autoconf, automake @@ -114,9 +119,17 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/augeas.pc %changelog -* Mon Feb 10 2020 Pino Toscano - 1.12.0-2.el8_1.1 +* Mon Feb 10 2020 Pino Toscano - 1.12.0-5 +- Fix completion with special characters in augtool. (RHBZ#1232224) - Krb5: improve handling of [dbmodules]; allow include/includedir directives - everywhere (RHBZ#1800552) + everywhere (RHBZ#1798486) +- Systemd: improve parsing of quoted variables of Environment (RHBZ#1798922) + +* Thu Nov 14 2019 Pino Toscano - 1.12.0-4 +- Rsyslog: support multiple actions in filters and selectors (RHBZ#1660884) + +* Thu Nov 07 2019 Pino Toscano - 1.12.0-3 +- Grub: handle '+' in kernel command line options (RHBZ#1769314) * Mon Jun 03 2019 Pino Toscano - 1.12.0-2 - Disable static libraries, not needed in RHEL.