Opened 5 years ago

Closed 4 years ago

#1196 closed Patch submission (fixed)

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

Reported by: mnowak Owned by: Gert Döring
Priority: minor Milestone:
Component: Generic / unclassified Version: OpenVPN 2.4.7 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords:
Cc:

Description

illumos echo does not support the '-n' option. It's more portable to replace it with printf.

--- openvpn-2.4.7/tests/t_lpback.sh	2019-02-20 13:28:23.000000000 +0000
+++ openvpn-2.4.7/tests/t_lpback.sh	2019-06-09 14:24:33.120063745 +0000
@@ -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"

Before:

-n Testing cipher AES-128-CBC... 
OK
-n Testing cipher AES-128-CFB... 
OK
-n Testing cipher AES-128-CFB1... 
OK

After:

Testing cipher AES-128-CBC... OK
Testing cipher AES-128-CFB... OK
Testing cipher AES-128-CFB1... OK

Change History (3)

comment:1 Changed 4 years ago by Gert Döring

Owner: set to Gert Döring
Status: newaccepted

I used to assume that "printf" is not portable, but it seems it is (quickly checked, available on NetBSD, OpenBSD, FreeBSD, AIX). This is good :-)

To merge this, can you provide your real name + e-mail address so I can put that into the "author:" line of the commit, so due credits are given? Or you could send it to the openvpn-devel@… list :-)

If you do not want this, I'll just take this

comment:3 Changed 4 years ago by Gert Döring

Resolution: fixed
Status: acceptedclosed

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

Note: See TracTickets for help on using tickets.