summaryrefslogtreecommitdiff
path: root/Shell/Tests
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-11-01 13:29:25 +0330
committerAndreas Kling <kling@serenityos.org>2020-11-01 18:45:05 +0100
commit1aed61964a2b0f7447b1370c97be27774ebcddea (patch)
tree68e3b396c06d87eb69677ad945f730f0312539c9 /Shell/Tests
parente87e580eb3b52042d31746a1d3e0a003b21659d5 (diff)
downloadserenity-1aed61964a2b0f7447b1370c97be27774ebcddea.zip
Shell: Do not leak the value of ARGV in nested function calls
Diffstat (limited to 'Shell/Tests')
-rw-r--r--Shell/Tests/function.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/Shell/Tests/function.sh b/Shell/Tests/function.sh
index 0dbfad5122..f3ef5aaeed 100644
--- a/Shell/Tests/function.sh
+++ b/Shell/Tests/function.sh
@@ -24,3 +24,13 @@ if fn 2>/dev/null {
fn() { echo $0 }
test "$(fn)" = fn || echo '$0' in function not equal to its name && exit 1
+
+# Ensure ARGV does not leak from inner frames.
+fn() {
+ fn2 1 2 3
+ echo $*
+}
+
+fn2() { }
+
+test "$(fn foobar)" = "foobar" || echo 'Frames are somehow messed up in nested functions' && exit 1