Blame SOURCES/0219-augeas-trim-spaces-on-eol-around-value-separator.patch

562801
From 3fc1e286151e12b3229750da7a550b8f799a35bc Mon Sep 17 00:00:00 2001
562801
From: Julius Milan <jmilan@redhat.com>
562801
Date: Wed, 22 Mar 2017 14:10:04 +0100
562801
Subject: [PATCH] augeas: trim spaces on eol, around value separator
562801
562801
Resolves abrt/libreport#474
562801
Related to rhbz#1435256
562801
---
562801
 augeas/libreport.aug      | 19 ++++++++++++-------
562801
 augeas/test_libreport.aug | 20 ++++++++++++++++++++
562801
 2 files changed, 32 insertions(+), 7 deletions(-)
562801
562801
diff --git a/augeas/libreport.aug b/augeas/libreport.aug
562801
index 7125be2..76b3bcc 100644
562801
--- a/augeas/libreport.aug
562801
+++ b/augeas/libreport.aug
562801
@@ -2,19 +2,24 @@ module Libreport =
562801
     autoload xfm
562801
 
562801
     (* Define useful primitives *)
562801
-    let value_sep    = del / ?= ?/ " = "
562801
-    let value_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n]?)/
562801
-    let eol          = del /\n/ "\n"
562801
-    let ident        = /[a-zA-Z][a-zA-Z_]+/
562801
+    let val_sep        = del /[ \t]*=[ \t]*/ " = "
562801
+    let val            = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
562801
+    let eol            = del /\n/ "\n"
562801
+    let whitespace_eol = del /[ \t]*\n/ "\n"
562801
+    let ident          = /[a-zA-Z][a-zA-Z_]+/
562801
 
562801
     (* Define comment *)
562801
-    let comment = [ label "#comment" . del /#[ \t]*/ "# " . value_to_eol . eol ]
562801
+    let commented_line = [ label "#comment" . del /#[ \t]*/ "# " . val . eol ]
562801
+    let empty_comment  = [ label "#comment" . value "" . del /#[ \t]*/ "# " . eol ]
562801
+    let comment        = commented_line | empty_comment
562801
 
562801
     (* Define empty *)
562801
-    let empty = [ del /[ \t]*\n/ "\n" ]
562801
+    let empty          = [ del /[ \t]*\n/ "\n" ]
562801
 
562801
     (* Define option *)
562801
-    let option = [ del /[ \t]*/ "" . key ident . value_sep . value_to_eol . eol ]
562801
+    let option_val     = [ del /[ \t]*/ "" . key ident . val_sep . val . whitespace_eol ]
562801
+    let option_no_val  = [ value "" . del /[ \t]*/ "" . key ident . val_sep . eol ]
562801
+    let option         = option_val | option_no_val
562801
 
562801
     (* Define lens *)
562801
     let lns = ( comment | empty | option )*
562801
diff --git a/augeas/test_libreport.aug b/augeas/test_libreport.aug
562801
index 116e97c..3dfbfa6 100644
562801
--- a/augeas/test_libreport.aug
562801
+++ b/augeas/test_libreport.aug
562801
@@ -16,6 +16,8 @@ Password =
562801
 # bugs in selinux-policy component.
562801
 # (If you need to add more, the syntax is: \"component[,component...]\")
562801
 #
562801
+#       
562801
+#		
562801
 DontMatchComponents = selinux-policy
562801
 
562801
 # for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets
562801
@@ -25,6 +27,14 @@ PrivateGroups=private
562801
   Whitespace_two=start
562801
 	Whitespace_three =start
562801
 	 Whitespace_four= start
562801
+
562801
+AssignmentWhitespace_a   =what
562801
+     AssignmentWhitespace_b   =    an
562801
+AssignmentWhitespace_c=   		 original
562801
+  AssignmentWhitespace_d =      idea
562801
+
562801
+EOLWhitespace_a = nice      
562801
+EOLWhitespace_b = nice 		 
562801
 "
562801
 
562801
     test Libreport.lns get conf =
562801
@@ -44,6 +54,8 @@ PrivateGroups=private
562801
         { "#comment" = "bugs in selinux-policy component." }
562801
         { "#comment" = "(If you need to add more, the syntax is: \"component[,component...]\")" }
562801
         { "#comment" = "" }
562801
+        { "#comment" = "" }
562801
+        { "#comment" = "" }
562801
         { "DontMatchComponents" = "selinux-policy" }
562801
         {}
562801
         { "#comment" = "for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets" }
562801
@@ -53,3 +65,11 @@ PrivateGroups=private
562801
         { "Whitespace_two" = "start" }
562801
         { "Whitespace_three" = "start" }
562801
         { "Whitespace_four" = "start" }
562801
+        {}
562801
+        { "AssignmentWhitespace_a" = "what" }
562801
+        { "AssignmentWhitespace_b" = "an" }
562801
+        { "AssignmentWhitespace_c" = "original" }
562801
+        { "AssignmentWhitespace_d" = "idea" }
562801
+        {}
562801
+        { "EOLWhitespace_a" = "nice" }
562801
+        { "EOLWhitespace_b" = "nice" }
562801
-- 
562801
1.8.3.1
562801