From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=199.89.1.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795996369; b=Ocalj2aLPQA5gwUcBAcVDnJaQ1rUwfr+hse51tKaoG+o09wFAi0RtaAKkMuMXpJa19yS b/OMt7i9QepHupjSVTi/givLJMZWzwiN8lCSKCTkI8RCerhymnTprvpoiuuoGN44onK40 xcIhOuMN9cj2N+Is6EM/DZT1GjbkCmSNKl6AZpe0LSRdPKqE1AfHH6t/i8aJlEAQbZwyx FNgD4JgoY1H97LU808Bev3uyfiWWWyLxOZateL0rNn5+9KZ2mRxtFki2Xsn5Fz/qQKvdS 6BSeifiOoopVmwFQwShexgmpCCxsPYBq7QbMz4qDhKUQyloK9iqiczQOZMhWlHhHHrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795996369; h=DMARC-Filter:Received:DKIM-Signature:X-Virus-Scanned:Received: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; bh=F1uXydtMvoyYKc3cxUTwFffd3egFBZPK9LIE95K7tDk=; b=VKOU4wczzNpb2qKZu8Nvz/+r2JnByeQJuN0QtifPjabXUiprvnyIxA4SO46RnHi5+Ess Oc0bIyK5ORhs3ThTwZ/X/j5oFe/MsYy9t80HTfLhV7QxZNDDsofuxpOhuAenEdciUnlyL oGlptXhfLmpnq7ejq+DF6+6bWYxKY5mur8Zc/rYiaxtlBYsGHuW4mv9SHNgkUtpvMTHT0 EYdCA1rLzPg8S2vdTxNXFtyMfSd+CtFB1+7ncFJ6hgvOgHLCurMHSmpcmmMJYUFaxHKs7 sBoE+A80tNZhHsJN1IGOVX/SRP8WAeq39W5VcdLTeRjZunih+PpF5DAWJ2+rDLCCQvA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=VKr45LD0; arc=none smtp.remote-ip=199.89.1.16 Received: from 013.lax.mailroute.net (013.lax.mailroute.net [199.89.1.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3B0F606A325 for ; Sun, 29 Nov 2026 23:52:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B3B0F606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=VKr45LD0 Received: from localhost (localhost [127.0.0.1]) by 013.lax.mailroute.net (Postfix) with ESMTP id 4jd3qh3CH1zlfvpK; Sun, 29 Nov 2026 23:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1795996366; x=1798588367; bh=F1uXy dtMvoyYKc3cxUTwFffd3egFBZPK9LIE95K7tDk=; b=VKr45LD0fkt8BtLuQIAqk 8Eif+4kA05BYX5y/CtEPc0qnqQ4wBkroT0flXL2rSBM+py4KSa4R26MAqoC4ZAcR zkZh043wiRlHgkBDDMfrdIpkcqOUJ5OXpIsMrnGdTnkPG7pGpmX0oOtnvVZWprdr by4eDEsvcfbZuMZfH6RS1en0haVW/fcchnnIqq1EhVATtgi/ezcPuzOdIV7dm9Uq DCVH53gSpr/EG7Lb9YcSINDS3dfoiObWjNIfO45ZurjtgOYtlK9ACr4exhkPzM40 HxGS6tq1+u0PvEm66/zc+TiU2LSSaOpbSo+iaD49DBRdBFQt2YW1XsJ4XoapQR97 w== X-Virus-Scanned: by MailRoute Received: from 013.lax.mailroute.net ([127.0.0.1]) by localhost (013.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id zMoQE_tuT10s; Sun, 29 Nov 2026 23:52:46 +0000 (UTC) Received: from bvanassche.c.googlers.com.com (57.237.82.34.bc.googleusercontent.com [34.82.237.57]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 013.lax.mailroute.net (Postfix) with ESMTPSA id 4jd3qf4MJRzlfvq8; Sun, 29 Nov 2026 23:52:46 +0000 (UTC) From: Bart Van Assche To: Shin'ichiro Kawasaki Cc: linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH blktests v3 1/2] nbd/rc: Declare the loop variables of the wait helpers local Date: Sun, 29 Nov 2026 15:52:37 -0800 Message-ID: <20261129235238.3445710-2-bvanassche@acm.org> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog In-Reply-To: <20261129235238.3445710-1-bvanassche@acm.org> References: <20261129235238.3445710-1-bvanassche@acm.org> X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable _wait_for_nbd_connect() and _wait_for_nbd_disconnect() use the variable "i" without declaring it local. Since bash uses dynamic scoping, these functions modify the variable "i" of their caller, or the global variable "i" if the caller did not declare one. Declare "i" and "sz" local to prevent this. Signed-off-by: Bart Van Assche --- tests/nbd/rc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/nbd/rc b/tests/nbd/rc index 6205c4938b7c..9a68c2c9abd4 100644 --- a/tests/nbd/rc +++ b/tests/nbd/rc @@ -42,6 +42,8 @@ _have_nbd_netlink() { } =20 _wait_for_nbd_connect() { + local i sz + for ((i =3D 0; i < 3; i++)); do sz=3D$(lsblk --raw --noheadings -o SIZE /dev/nbd0) if [ "$sz" !=3D "0B" ]; then @@ -53,6 +55,8 @@ _wait_for_nbd_connect() { } =20 _wait_for_nbd_disconnect() { + local i + for ((i =3D 0; i < 3; i++)); do if [[ ! -e /sys/kernel/debug/nbd/nbd0/tasks ]]; then return 0