From 2765da41b09cdfcf2f28653a484462ee7109116a Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Fri, 12 Jun 2015 09:32:56 +0100 Subject: [PATCH] Revert "Use Quote module in dovecot" This reverts commit 735caf587959019d214a51a7c0cce57da9bb88f6 for compatibility with Augeas 1.1.0. Values will have quotes in them as they did in 1.1.0, not stripped out. Conflicts: lenses/dovecot.aug --- lenses/dovecot.aug | 28 +++++----------------------- lenses/tests/test_dovecot.aug | 2 +- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lenses/dovecot.aug b/lenses/dovecot.aug index f7afc8f9..c6376e4b 100644 --- a/lenses/dovecot.aug +++ b/lenses/dovecot.aug @@ -56,6 +56,9 @@ let value = any . (Rx.space . any)* (* View: command_start *) let command_start = Util.del_str "!" +(* View: block_args +Map block arguments after block name and before "{" *) +let block_args = Sep.space . store /([A-Za-z0-9\/\\_-]+|\"[A-Za-z0-9 ]*\")/ (****************************************************************** * Group: ENTRIES @@ -79,28 +82,7 @@ let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ] Map commands started with "!". *) let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ] -(* -View: dquote_spaces - Make double quotes mandatory if value contains spaces, - and optional if value doesn't contain spaces. - -Based off Quote.dquote_spaces - -Parameters: - lns1:lens - the lens before - lns2:lens - the lens after -*) -let dquote_spaces (lns1:lens) (lns2:lens) = - (* bare has no spaces, and is optionally quoted *) - let bare = Quote.do_dquote_opt (store /[^" \t\n]+/) - (* quoted has at least one space, and must be quoted *) - in let quoted = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) - in [ lns1 . bare . lns2 ] | [ lns1 . quoted . lns2 ] - -let mailbox = indent - . dquote_spaces - (key /mailbox/ . Sep.space) - (Build.block_newlines_spc entry comment . eol) +let mailbox = [ indent . key /mailbox/ . block_args? . Build.block_newlines_spc (entry) comment . eol ] let block_ldelim_newlines_re = /[ \t]+\{([ \t\n]*\n)?/ @@ -114,7 +96,7 @@ let block_newlines (entry:lens) (comment:lens) = Map block enclosed in brackets recursively. Block may be indented and have optional argument. Block body may have entries, comments, empty lines, and nested blocks recursively. *) -let rec block = [ indent . key block_names . (Sep.space . Quote.do_dquote_opt (store /[\/A-Za-z0-9_-]+/))? . block_newlines (entry|block|mailbox) comment . eol ] +let rec block = [ indent . key block_names . block_args? . block_newlines (entry|block|mailbox) comment . eol ] (****************************************************************** diff --git a/lenses/tests/test_dovecot.aug b/lenses/tests/test_dovecot.aug index 33ea16f1..8e8c083b 100644 --- a/lenses/tests/test_dovecot.aug +++ b/lenses/tests/test_dovecot.aug @@ -536,7 +536,7 @@ test Dovecot.lns get mail_conf = { "hidden" = "no" } { "list" = "yes" } { "subscriptions" = "yes" } - { "mailbox" = "Sent Messages" + { "mailbox" = "\"Sent Messages\"" { "special_use" = "\Sent" } } } -- 2.14.3