diff options
Diffstat (limited to 'main/augeas/0003-Shellvars-Allow-almost-any-command.patch')
-rw-r--r-- | main/augeas/0003-Shellvars-Allow-almost-any-command.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/main/augeas/0003-Shellvars-Allow-almost-any-command.patch b/main/augeas/0003-Shellvars-Allow-almost-any-command.patch new file mode 100644 index 0000000000..34bb5982ee --- /dev/null +++ b/main/augeas/0003-Shellvars-Allow-almost-any-command.patch @@ -0,0 +1,82 @@ +From 23498cfa489397a60cc0667352fd144d3cdd905d 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 3/5] Shellvars: Allow (almost) any command + + Note: this may have edge effects in recursive sublenses + that augparse cannot check. +--- + NEWS | 1 + + lenses/shellvars.aug | 7 +++++++ + lenses/tests/test_shellvars.aug | 11 +++++++++++ + 3 files changed, 19 insertions(+) + +diff --git a/NEWS b/NEWS +index 73b5332..4501226 100644 +--- a/NEWS ++++ b/NEWS +@@ -57,6 +57,7 @@ + conditions (GH issue #118) + Support $(( .. )) arithmetic expansion in variable + assignment, RHBZ#1100550 ++ Allow (almost) any command + * Simplevars: Support flags and empty values + * Sshd: Allow all types of entries in Match groups (GH issue #75) + * Sssd: Allow ; for comments +diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug +index 645d6ed..a50c0f6 100644 +--- a/lenses/shellvars.aug ++++ b/lenses/shellvars.aug +@@ -102,6 +102,11 @@ module Shellvars = + . Util.del_str "return" + . ( Util.del_ws_spc . store Rx.integer )? + ++ let command = ++ let reserved_key = /exit|shift|return|ulimit|unset|export|source|\.|if|for|select|while|until|then|else|fi|done|case/ ++ 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 +@@ -166,6 +171,7 @@ module Shellvars = + | entry_eol_item bare_export + | entry_eol_item builtin + | entry_eol_item return ++ | entry_eol_item command + + let entry_noeol = + let entry_item (item:lens) = [ item ] in +@@ -175,6 +181,7 @@ module Shellvars = + | entry_item bare_export + | entry_item builtin + | entry_item return ++ | 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 65c2927..fd9e299 100644 +--- a/lenses/tests/test_shellvars.aug ++++ b/lenses/tests/test_shellvars.aug +@@ -497,6 +497,17 @@ fi\n" = + { "MALLOC_PERTURB_" = "$(($RANDOM % 255 + 1))" + { "export" } } + ++(* 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: *) + (* mode: caml *) + (* End: *) +-- +1.8.3.1 + |