|
|
ab36df |
From 909c71ba2ce1fd294acc0c456e22514fd6262e39 Mon Sep 17 00:00:00 2001
|
|
|
ab36df |
From: Dominic Cleal <dcleal@redhat.com>
|
|
|
ab36df |
Date: Wed, 9 Jul 2014 09:22:57 +0100
|
|
|
ab36df |
Subject: [PATCH] Shellvars: support $(( .. )) arithmetic expansion in variable
|
|
|
ab36df |
assignment
|
|
|
ab36df |
|
|
|
ab36df |
Fixes RHBZ#1100550
|
|
|
ab36df |
|
|
|
ab36df |
(cherry picked from commit 5ef5e32c7e9e3c220325542ee9b0174f151c615d)
|
|
|
ab36df |
|
|
|
ab36df |
Conflicts:
|
|
|
ab36df |
NEWS
|
|
|
ab36df |
lenses/shellvars.aug
|
|
|
ab36df |
lenses/tests/test_shellvars.aug
|
|
|
ab36df |
---
|
|
|
ab36df |
lenses/shellvars.aug | 5 +++--
|
|
|
ab36df |
lenses/tests/test_shellvars.aug | 5 +++++
|
|
|
ab36df |
2 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
ab36df |
|
|
|
ab36df |
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
|
|
|
ab36df |
index 815e4f1..511b045 100644
|
|
|
ab36df |
--- a/lenses/shellvars.aug
|
|
|
ab36df |
+++ b/lenses/shellvars.aug
|
|
|
ab36df |
@@ -37,7 +37,8 @@ module Shellvars =
|
|
|
ab36df |
let bquot = /`[^`\n]*`/
|
|
|
ab36df |
(* dbquot don't take spaces or semi-colons *)
|
|
|
ab36df |
let dbquot = /``[^` \t\n;]+``/
|
|
|
ab36df |
- let dollar_assign = /\$\([^\)#\n]*\)/
|
|
|
ab36df |
+ let dollar_assign = /\$\([^\(\)#\n]*\)/
|
|
|
ab36df |
+ let dollar_arithm = /\$\(\([^\)#\n]*\)\)/
|
|
|
ab36df |
|
|
|
ab36df |
let sto_to_semicol = store /[^#; \t\n][^#;\n]+[^#; \t\n]|[^#; \t\n]+/
|
|
|
ab36df |
|
|
|
ab36df |
@@ -56,7 +57,7 @@ module Shellvars =
|
|
|
ab36df |
let simple_value =
|
|
|
ab36df |
let empty_array = /\([ \t]*\)/ in
|
|
|
ab36df |
store (char* | (dquot | squot)+
|
|
|
ab36df |
- | bquot | dbquot | dollar_assign | empty_array)
|
|
|
ab36df |
+ | bquot | dbquot | dollar_assign | dollar_arithm | empty_array)
|
|
|
ab36df |
|
|
|
ab36df |
let export = [ key "export" . Util.del_ws_spc ]
|
|
|
ab36df |
let kv = Util.indent . export? . key key_re
|
|
|
ab36df |
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
|
|
|
ab36df |
index 18fd361..be852ae 100644
|
|
|
ab36df |
--- a/lenses/tests/test_shellvars.aug
|
|
|
ab36df |
+++ b/lenses/tests/test_shellvars.aug
|
|
|
ab36df |
@@ -457,6 +457,11 @@ esac\n" =
|
|
|
ab36df |
{ "@case_entry" = "1"
|
|
|
ab36df |
{ "TestVar" = "\"test1\"" } } }
|
|
|
ab36df |
|
|
|
ab36df |
+ (* Support $(( .. )) arithmetic expansion in variable assignment, RHBZ#1100550 *)
|
|
|
ab36df |
+ test lns get "export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))\n" =
|
|
|
ab36df |
+ { "MALLOC_PERTURB_" = "$(($RANDOM % 255 + 1))"
|
|
|
ab36df |
+ { "export" } }
|
|
|
ab36df |
+
|
|
|
ab36df |
(* Local Variables: *)
|
|
|
ab36df |
(* mode: caml *)
|
|
|
ab36df |
(* End: *)
|