ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
8d419f
From fe4bd1d397af0fef644c401ca5a94e4c82316b4c Mon Sep 17 00:00:00 2001
8d419f
From: Frantisek Sumsal <frantisek@sumsal.cz>
8d419f
Date: Thu, 27 Jan 2022 22:50:58 +0100
8d419f
Subject: [PATCH] test: don't leak local variable to outer scopes
8d419f
8d419f
(cherry picked from commit 888d0bc074c6d11593d28c6a876787ae864604ea)
8d419f
8d419f
Related: #2017035
8d419f
---
8d419f
 test/TEST-64-UDEV-STORAGE/test.sh | 8 ++++++--
8d419f
 1 file changed, 6 insertions(+), 2 deletions(-)
8d419f
8d419f
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh
8d419f
index f784e65984..c360c8b661 100755
8d419f
--- a/test/TEST-64-UDEV-STORAGE/test.sh
8d419f
+++ b/test/TEST-64-UDEV-STORAGE/test.sh
8d419f
@@ -171,6 +171,7 @@ testcase_megasas2_basic() {
8d419f
         return 77
8d419f
     fi
8d419f
 
8d419f
+    local i
8d419f
     local qemu_opts=(
8d419f
         "-device megasas-gen2,id=scsi0"
8d419f
         "-device megasas-gen2,id=scsi1"
8d419f
@@ -197,6 +198,9 @@ testcase_nvme_basic() {
8d419f
         return 77
8d419f
     fi
8d419f
 
8d419f
+    local i
8d419f
+    local qemu_opts=()
8d419f
+
8d419f
     for i in {0..27}; do
8d419f
         qemu_opts+=(
8d419f
             "-device nvme,drive=nvme$i,serial=deadbeef$i,num_queues=8"
8d419f
@@ -220,7 +224,7 @@ testcase_virtio_scsi_identically_named_partitions() {
8d419f
     # and attach them to a virtio-scsi controller
8d419f
     local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4")
8d419f
     local diskpath="${TESTDIR:?}/namedpart0.img"
8d419f
-    local lodev qemu_timeout
8d419f
+    local i lodev qemu_timeout
8d419f
 
8d419f
     dd if=/dev/zero of="$diskpath" bs=1M count=18
8d419f
     lodev="$(losetup --show -f -P "$diskpath")"
8d419f
@@ -330,7 +334,7 @@ testcase_lvm_basic() {
8d419f
     fi
8d419f
 
8d419f
     local qemu_opts=("-device ahci,id=ahci0")
8d419f
-    local diskpath
8d419f
+    local diskpath i
8d419f
 
8d419f
     # Attach 4 SATA disks to the VM (and set their model and serial fields
8d419f
     # to something predictable, so we can refer to them later)