Blame 0001-augeas-trim-spaces-on-eol-around-value-separator.patch

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