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/0014-Shellvars-Allow-almost-any-command.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/0014-Shellvars-Allow-almost-any-command.patch')
-rw-r--r-- | main/augeas/0014-Shellvars-Allow-almost-any-command.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/main/augeas/0014-Shellvars-Allow-almost-any-command.patch b/main/augeas/0014-Shellvars-Allow-almost-any-command.patch new file mode 100644 index 0000000000..03c7b1b64d --- /dev/null +++ b/main/augeas/0014-Shellvars-Allow-almost-any-command.patch @@ -0,0 +1,70 @@ +From ba95bf402b009f0a572807b62ea2a7addd29dc17 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphink@gmail.com> +Date: Thu, 24 Apr 2014 16:10:50 +0200 +Subject: [PATCH 14/19] Shellvars: Allow (almost) any command + + Note: this may have edge effects in recursive sublenses + that augparse cannot check. +--- + lenses/shellvars.aug | 7 +++++++ + lenses/tests/test_shellvars.aug | 12 +++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug +index c47f566..f9e03ff 100644 +--- a/lenses/shellvars.aug ++++ b/lenses/shellvars.aug +@@ -116,6 +116,11 @@ module Shellvars = + . ( action "&&" "@and" | action "||" "@or" )* + in Util.indent . label "@condition" . (cond "[" "]" | cond "[[" "]]") + ++ let command = ++ let reserved_key = /exit|shift|return|ulimit|unset|export|source|\.|if|for|select|while|until|then|else|fi|done|case|eval|alias/ ++ in let word = /[A-Za-z0-9_.-\/]+/ ++ in Util.indent . label "@command" . store (word - reserved_key) ++ . [ Sep.space . label "@arg" . sto_to_semicol]? + + (************************************************************************ + * Group: CONDITIONALS AND LOOPS +@@ -185,6 +190,7 @@ module Shellvars = + | entry_eol_item condition + | entry_eol_item eval + | entry_eol_item alias ++ | entry_eol_item command + + let entry_noeol = + let entry_item (item:lens) = [ item ] in +@@ -197,6 +203,7 @@ module Shellvars = + | entry_item condition + | entry_item eval + | entry_item alias ++ | entry_item command + + let rec rec_entry = + let entry = comment | entry_eol | rec_entry in +diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug +index 0f27a73..f065ce4 100644 +--- a/lenses/tests/test_shellvars.aug ++++ b/lenses/tests/test_shellvars.aug +@@ -609,7 +609,17 @@ esac\n" = + { "@condition" = "-f $FILENAME" + { "type" = "[" } + { "@and" = "do this" } +- { "@or" = "or that" } ++ { "@or" = "or that" } } ++ ++(* Test: Shellvars.lns ++ Parse (almost) any command *) ++test Shellvars.lns get "echo foobar 'and this is baz' ++/usr/local/bin/myscript.sh with args\n" = ++ { "@command" = "echo" ++ { "@arg" = "foobar 'and this is baz'" } ++ } ++ { "@command" = "/usr/local/bin/myscript.sh" ++ { "@arg" = "with args" } + } + + (* Local Variables: *) +-- +2.5.0 + |