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

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