naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From fe4bd1d397af0fef644c401ca5a94e4c82316b4c Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Thu, 27 Jan 2022 22:50:58 +0100
Subject: [PATCH] test: don't leak local variable to outer scopes

(cherry picked from commit 888d0bc074c6d11593d28c6a876787ae864604ea)

Related: #2017035
---
 test/TEST-64-UDEV-STORAGE/test.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh
index f784e65984..c360c8b661 100755
--- a/test/TEST-64-UDEV-STORAGE/test.sh
+++ b/test/TEST-64-UDEV-STORAGE/test.sh
@@ -171,6 +171,7 @@ testcase_megasas2_basic() {
         return 77
     fi
 
+    local i
     local qemu_opts=(
         "-device megasas-gen2,id=scsi0"
         "-device megasas-gen2,id=scsi1"
@@ -197,6 +198,9 @@ testcase_nvme_basic() {
         return 77
     fi
 
+    local i
+    local qemu_opts=()
+
     for i in {0..27}; do
         qemu_opts+=(
             "-device nvme,drive=nvme$i,serial=deadbeef$i,num_queues=8"
@@ -220,7 +224,7 @@ testcase_virtio_scsi_identically_named_partitions() {
     # and attach them to a virtio-scsi controller
     local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4")
     local diskpath="${TESTDIR:?}/namedpart0.img"
-    local lodev qemu_timeout
+    local i lodev qemu_timeout
 
     dd if=/dev/zero of="$diskpath" bs=1M count=18
     lodev="$(losetup --show -f -P "$diskpath")"
@@ -330,7 +334,7 @@ testcase_lvm_basic() {
     fi
 
     local qemu_opts=("-device ahci,id=ahci0")
-    local diskpath
+    local diskpath i
 
     # Attach 4 SATA disks to the VM (and set their model and serial fields
     # to something predictable, so we can refer to them later)