From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202508 header.b=FHmuCbyO; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id E1E745A0271 for ; Fri, 26 Sep 2025 08:38:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1758868688; bh=ZCs6RUuMKsGw/JNywzjs9wrsVaCZTSYKbaMp/VZmdtk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FHmuCbyO7aCLWTSypB9J9C4WmW2P1mzcoBuYHffoZqCOKX9m0PCyOif/KJnGJxI6H 5CJoWfIYBbrvYk0WQo0bpZzVlFy1PFWgODb4UODe3elF7Pm2mkZsRa5ANzGVnerDzn cpa/LdEKmj9l3DDJ2EeaGmYw2IK34i5yfOWSyXtaAFDqJ7UYCiN81b5AzpoUHug73Q or3pRq5XDmsbscIUUsVmAKppvqn0BwtO3tEC0xFHRHef6eZ26ceYzcvnpl0AyqwZxI e8shkYSS61obTcrKlW+2Ungs5MgxXAUEc7Th0VdjeW2xREGeODv7mFQ/z/YDrwI6lA O05zZw2vWjO/w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cY19r4zsPz4wDJ; Fri, 26 Sep 2025 16:38:08 +1000 (AEST) Date: Fri, 26 Sep 2025 16:23:48 +1000 From: David Gibson To: Yumei Huang Subject: Re: [PATCH] test: Update lib/term for clearer output when DEBUG is enabled Message-ID: References: <20250926061553.16039-1-yuhuang@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="nD6WF70tfgwavncu" Content-Disposition: inline In-Reply-To: <20250926061553.16039-1-yuhuang@redhat.com> Message-ID-Hash: HYX3QUDU4NGBWCXD5H5TBQ7TM33RELX4 X-Message-ID-Hash: HYX3QUDU4NGBWCXD5H5TBQ7TM33RELX4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, sbrivio@redhat.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --nD6WF70tfgwavncu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 26, 2025 at 02:15:53PM +0800, Yumei Huang wrote: > When running tests with DEBUG=3D1, we used to get some > "DEBUG:DEBUG:DEBUG:" in logs, which is not very helpful for > debugging. >=20 > With this patch, the log would show the steps like below: >=20 > DEBUG: g1tools ip jq dhclient socat cat > DEBUG: htools ip jq > DEBUG: > DEBUG: set MAP_HOST4 192.0.2.1 > DEBUG: set MAP_HOST6 2001:db8:9a55::1 >=20 > Suggested-by: David Gibson > Signed-off-by: Yumei Huang Reviewed-by: David Gibson Some extra background that might be useful in the commit message: The problem here is that "${@}" is magic and expands to multiple arguments, even though it's quoted. That means instead of the whole message going into a single string, the "DEBUG:" becomes the format string and the rest goes into unused parameters. I'm pretty sure these messages worked once, I'm not sure exactly when and how they broke. > --- > test/lib/term | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/test/lib/term b/test/lib/term > index 089364c..6400746 100755 > --- a/test/lib/term > +++ b/test/lib/term > @@ -32,29 +32,29 @@ PR_DELAY_INIT=3D100 # ms > # $@: Message to print > info() { > tmux select-pane -t ${PANE_INFO} > - printf "${@}\n" >> $STATEBASE/log_pipe > - printf "${@}\n" >> "${LOGFILE}" > + printf "${*}\n" >> $STATEBASE/log_pipe > + printf "${*}\n" >> "${LOGFILE}" > } > =20 > # info_n() - Highlight, print message to pane and to log file without ne= wline > # $@: Message to print > info_n() { > tmux select-pane -t ${PANE_INFO} > - printf "${@}" >> $STATEBASE/log_pipe > - printf "${@}" >> "${LOGFILE}" > + printf "${*}" >> $STATEBASE/log_pipe > + printf "${*}" >> "${LOGFILE}" > } > =20 > # info_nolog() - Highlight test log pane, print message to it > # $@: Message to print > info_nolog() { > tmux select-pane -t ${PANE_INFO} > - printf "${@}\n" >> $STATEBASE/log_pipe > + printf "${*}\n" >> $STATEBASE/log_pipe > } > =20 > # info_nolog() - Print message to log file > # $@: Message to print > log() { > - printf "${@}\n" >> "${LOGFILE}" > + printf "${*}\n" >> "${LOGFILE}" > } > =20 > # info_nolog_n() - Send message to pane without highlighting it, without= newline > @@ -363,8 +363,8 @@ status_test_start() { > info_check() { > switch_pane ${PANE_INFO} > =20 > - printf "${PR_YELLOW}?${PR_NC} ${@}" >> $STATEBASE/log_pipe > - printf "? ${@}" >> "${LOGFILE}" > + printf "${PR_YELLOW}?${PR_NC} ${*}" >> $STATEBASE/log_pipe > + printf "? ${*}" >> "${LOGFILE}" > } > =20 > # info_check_passed() - Display and log a new line when a check passes > --=20 > 2.47.0 >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --nD6WF70tfgwavncu Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjWMXMACgkQzQJF27ox 2Gff7A/9EQp7r0wl5SrU2ZkNIY7SvdFvn/1wsojdsuxdYPY6cYvAQJpzRMgI0mUS aopofiQ3t6lFoNGzuMuIZqH33pVjgu27XiwVW/boalh6Dug5U1AKqO+6WjOnaXmM 6a/yC88bY8S7KPiRbLxcPPOOhfqFEuMOGqPjcB0iRRqdieSyswQm/GfuBjRQbMZM a0RQk9yYdoWj8xJ/nLm8Qm8Ymq5QvpICe0nYsNQySLrf3K8MjvX2HVHCPiGpclEu iFHnaj3jczU2Ufdx0XO/TM+WNQTISVKnP1Ni+pk4EDTjKlMr3ihvMMD8B0HYU4mC ZfTOADf13OXXRx3tYYn/Z4hoaBzH0XeW2iKJeV4p4VbmJfrmao6jloBJfP2ze5Rg YCLmbpqhNVqpUWNzfVyV/4pPDnCyovUPb1L8k1ThF2QC7Y1pHSzq1MvCLZXtyXCN FwRQ6WjJC6AR7hPuTXps6oxBO1aKV/voF8V7DN9WEogh/jyCgS34ZUPpD1obuzbr GJ6e9LKwZp0Pm0mgV+6Vdieg80u6wZXoEvPg9oR0pAVnKmjsA/IcPQDtmFicSrOh +R0/gmdswwZikyKURW+BCCxqawUk9llc6T4BPlVgtSw48MbDZK1EhfSfR1nCUvxn yNn8L+OMMCLae4EKwgPL54ERZwHiDJ7tgm1hn0h3bfvBh1rAVfo= =+r+t -----END PGP SIGNATURE----- --nD6WF70tfgwavncu--