aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0002-Dns_Zone-allow-whitespace-at-the-end-of-the-line.patch
blob: 09be128581610ac4847e5d820973cdc78d09fc90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 796b2d796a7e05788d707f178383dc22f384563b Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Wed, 25 Mar 2015 12:23:05 +0200
Subject: [PATCH 2/2] Dns_Zone: allow whitespace at the end of the line

---
 lenses/dns_zone.aug            |  4 ++--
 lenses/tests/test_dns_zone.aug | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/lenses/dns_zone.aug b/lenses/dns_zone.aug
index 77c3485..4db194c 100644
--- a/lenses/dns_zone.aug
+++ b/lenses/dns_zone.aug
@@ -16,8 +16,8 @@ module Dns_Zone =
 
 autoload xfm
 
-let eol = del /(([ \t\n]*;[^\n]*)?\n)+/ "\n"
-let opt_eol = del /(([ \t\n]*;[^\n]*)?\n)*/ ""
+let eol = del /([ \t\n]*(;[^\n]*)?\n)+/ "\n"
+let opt_eol = del /([ \t\n]*(;[^\n]*)?\n)*/ ""
 
 let ws = del /[ \t]+|(([ \t\n]*;[^\n]*)?\n)+[ \t]*/ " "
 let opt_ws = del /(([ \t\n]*;[^\n]*)?\n)*[ \t]*/ ""
diff --git a/lenses/tests/test_dns_zone.aug b/lenses/tests/test_dns_zone.aug
index 07ff583..2537c4d 100644
--- a/lenses/tests/test_dns_zone.aug
+++ b/lenses/tests/test_dns_zone.aug
@@ -353,3 +353,32 @@ bar TXT \"ab cd\\\\ef\\\"gh\"
   { "$ORIGIN" = "example.com." }
   { "foo" { "1" { "type" = "TXT" } { "rdata" = "abc\\\\def\\\"ghi" } } }
   { "bar" { "1" { "type" = "TXT" } { "rdata" = "\"ab cd\\\\ef\\\"gh\"" } } }
+
+
+(* Whitespace at the end of the line *)
+test lns get "
+$ORIGIN example.com. \n@ IN SOA ns root.example.com. (1 2 3 4 5) \t
+foo 1D IN A 10.1.2.3\t
+" =
+  { "$ORIGIN" = "example.com." }
+  { "@"
+    { "1"
+      { "class" = "IN" }
+      { "type" = "SOA" }
+      { "mname" = "ns" }
+      { "rname" = "root.example.com." }
+      { "serial" = "1" }
+      { "refresh" = "2" }
+      { "retry" = "3" }
+      { "expiry" = "4" }
+      { "minimum" = "5" }
+    }
+  }
+  { "foo"
+    { "1"
+      { "ttl" = "1D" }
+      { "class" = "IN" }
+      { "type" = "A" }
+      { "rdata" = "10.1.2.3" }
+    }
+  }
-- 
2.1.0