diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-12-12 01:11:06 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-12-12 18:11:33 +0200 |
commit | 01cf06a63787747446ea4b86c62289702c98e694 (patch) | |
tree | 97ef8ae1ccd33b9d9c2fbb91930acccff14616e8 /main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch | |
parent | 6ef1728084d139a7ad7e47b2543211e1ebe4d74d (diff) | |
download | aports-01cf06a63787747446ea4b86c62289702c98e694.tar.bz2 aports-01cf06a63787747446ea4b86c62289702c98e694.tar.xz |
main/augeas: align patch set with upstream
Diffstat (limited to 'main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch')
-rw-r--r-- | main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch b/main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch new file mode 100644 index 0000000000..5571f1ba0d --- /dev/null +++ b/main/augeas/0019-Shellvars-allow-wrapping-command-sequences.patch @@ -0,0 +1,94 @@ +From f17fabf6aff94b632f733896effdb7856a46d948 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> +Date: Sat, 12 Dec 2015 17:49:51 +0200 +Subject: [PATCH 19/19] Shellvars: allow wrapping command sequences + +--- + lenses/shellvars.aug | 10 +++++----- + lenses/tests/test_shellvars.aug | 14 +++++++++++++- + 2 files changed, 18 insertions(+), 6 deletions(-) + +diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug +index 3d05da5..d62bca0 100644 +--- a/lenses/shellvars.aug ++++ b/lenses/shellvars.aug +@@ -34,7 +34,7 @@ module Shellvars = + let xchgs = Build.xchgs + let semicol = del /;?/ "" + +- let char = /[^`;()'"&|\n\\# \t]#*|\\\\(.|\n)/ ++ let char = /[^`;()'"&|\n\\# \t]#*|\\\\./ + let dquot = + let char = /[^"\\]|\\\\./ | Rx.cl + in "\"" . char* . "\"" (* " Emacs, relax *) +@@ -46,7 +46,7 @@ module Shellvars = + let dollar_arithm = /\$\(\([^\)#\n]*\)\)/ + + let anyquot = (char|dquot|squot|dollar_assign|dollar_arithm)+ | bquot | dbquot +- let sto_to_semicol = store (anyquot . (Rx.space . anyquot)*) ++ let sto_to_semicol = store (anyquot . (Rx.cl_or_space . anyquot)*) + + (* Array values of the form '(val1 val2 val3)'. We do not handle empty *) + (* arrays here because of typechecking headaches. Instead, they are *) +@@ -95,7 +95,7 @@ module Shellvars = + let builtin = + Util.indent . label "@builtin" + . store shell_builtin_cmds +- . (Util.del_ws_spc ++ . (Sep.cl_or_space + . [ label "args" . sto_to_semicol ])? + + let keyword (kw:string) = Util.indent . Util.del_str kw +@@ -107,7 +107,7 @@ module Shellvars = + . ( Util.del_ws_spc . store Rx.integer )? + + let action (operator:string) (lbl:string) (sto:lens) = +- [ del (Rx.opt_space . operator . Rx.opt_space) (" " . operator . " ") ++ [ del (Rx.cl_or_opt_space . operator . Rx.cl_or_opt_space) (" " . operator . " ") + . label ("@".lbl) . sto ] + + let action_pipe = action "|" "pipe" +@@ -160,7 +160,7 @@ module Shellvars = + in Util.indent . label "@command" + . [ key key_re . eq . store anyquot . Sep.space . del /(\\\\\n[ \t]*)?/ "" ]* + . store (word - reserved_key) +- . [ Sep.space . label "@arg" . sto_to_semicol]? ++ . [ Sep.cl_or_space . label "@arg" . sto_to_semicol]? + . ( pipe | and | or )? + + let entry_eol = entry_eol_nocommand +diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug +index 29f9e75..673fc0d 100644 +--- a/lenses/tests/test_shellvars.aug ++++ b/lenses/tests/test_shellvars.aug +@@ -168,7 +168,7 @@ unset ONBOOT # We do not want this var + (* Allow wrapping builtin arguments to multiple lines *) + test Shellvars.lns get "ulimit -c \\\nunlimited\nulimit \\\n -x 123\n" = + { "@builtin" = "ulimit" { "args" = "-c \\\nunlimited" } } +- { "@builtin" = "ulimit" { "args" = "\\\n -x 123" } } ++ { "@builtin" = "ulimit" { "args" = "-x 123" } } + + (* Test semicolons *) + test lns get "VAR1=\"this;is;a;test\"\nVAR2=this;\n" = +@@ -680,6 +680,18 @@ test Shellvars.lns get "abc=def \\\n ghi=\"jkl mno\" command arg1 arg2\n" = + { "@arg" = "arg1 arg2" } + } + ++(* Wrapped command sequences *) ++ ++test Shellvars.lns get "foo && \\\nbar baz \\\n|| qux \\\n quux\\\ncorge grault\n" = ++ { "@command" = "foo" ++ { "@and" ++ { "@command" = "bar" ++ { "@arg" = "baz" } ++ { "@or" { "@command" = "qux" { "@arg" = "quux\\\ncorge grault" } } } ++ } ++ } ++ } ++ + (* Local Variables: *) + (* mode: caml *) + (* End: *) +-- +2.5.0 + |