[Openvpn-devel] Replace 'echo -n' with 'printf' in tests/t_lpback.sh

Message ID 20200909130024.24264-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel] Replace 'echo -n' with 'printf' in tests/t_lpback.sh | expand

Commit Message

Gert Doering Sept. 9, 2020, 3 a.m. UTC
"echo -n" is inherently less portable than printf, so the tests look
ugly on (at least) OpenSolaris/Illumos on AIX.

Add a blank at the end of the tls-crypt-v2 messages, so it has the
same look as the cipher messages ("... OK").

Reported-by: mnowak on Trac
Trac: #1196

Signed-off-by: Gert Doering <gert@greenie.muc.de>
---
 tests/t_lpback.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Antonio Quartulli Sept. 11, 2020, 12:37 a.m. UTC | #1
Hi,

On 09/09/2020 15:00, Gert Doering wrote:
> "echo -n" is inherently less portable than printf, so the tests look
> ugly on (at least) OpenSolaris/Illumos on AIX.
> 
> Add a blank at the end of the tls-crypt-v2 messages, so it has the
> same look as the cipher messages ("... OK").
> 
> Reported-by: mnowak on Trac
> Trac: #1196
> 
> Signed-off-by: Gert Doering <gert@greenie.muc.de>

Change is not invasive and makes sense.

Gert is juggling way more platforms than I do, so if he believes this
helps portability, I am with him.

Acked-by: Antonio Quartulli <a@unstable.cc>
Gert Doering Sept. 11, 2020, 1:20 a.m. UTC | #2
Patch has been applied to the master and release/2.5 branch.

commit 81f9bb3a2ff9a3b0f5a1bdbac1d0daf38747ae7b (master)
commit d17eb65d144f157942a1675bdb25f89f15aff839 (release/2.5)
Author: Gert Doering
Date:   Wed Sep 9 15:00:24 2020 +0200

     Replace 'echo -n' with 'printf' in tests/t_lpback.sh

     Signed-off-by: Gert Doering <gert@greenie.muc.de>
     Acked-by: Antonio Quartulli <a@unstable.cc>
     Message-Id: <20200909130024.24264-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20930.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/t_lpback.sh b/tests/t_lpback.sh
index f2729fd4..6206899d 100755
--- a/tests/t_lpback.sh
+++ b/tests/t_lpback.sh
@@ -44,7 +44,7 @@  set +e
 e=0
 for cipher in ${CIPHERS}
 do
-    echo -n "Testing cipher ${cipher}... "
+    printf "Testing cipher ${cipher}... "
     ( "${top_builddir}/src/openvpn/openvpn" --test-crypto --secret key.$$ --cipher ${cipher} ) >log.$$ 2>&1
     if [ $? != 0 ] ; then
         echo "FAILED"
@@ -55,7 +55,7 @@  do
     fi
 done
 
-echo -n "Testing tls-crypt-v2 server key generation..."
+printf "Testing tls-crypt-v2 server key generation... "
 "${top_builddir}/src/openvpn/openvpn" \
     --genkey tls-crypt-v2-server tc-server-key.$$ >log.$$ 2>&1
 if [ $? != 0 ] ; then
@@ -66,7 +66,7 @@  else
     echo "OK"
 fi
 
-echo -n "Testing tls-crypt-v2 key generation (no metadata)..."
+printf "Testing tls-crypt-v2 key generation (no metadata)... "
 "${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \
     --genkey tls-crypt-v2-client tc-client-key.$$ >log.$$ 2>&1
 if [ $? != 0 ] ; then
@@ -84,7 +84,7 @@  while [ $i -lt 732 ]; do
     METADATA="${METADATA}A"
     i=$(expr $i + 1)
 done
-echo -n "Testing tls-crypt-v2 key generation (max length metadata)..."
+printf "Testing tls-crypt-v2 key generation (max length metadata)... "
 "${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \
     --genkey tls-crypt-v2-client tc-client-key.$$ "${METADATA}" \
     >log.$$ 2>&1