From patchwork Sun Aug 9 03:50:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 8093 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 13707 invoked by alias); 9 Aug 2015 03:50:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 13687 invoked by uid 89); 9 Aug 2015 03:50:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_20, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org From: Mike Frysinger To: libc-alpha@sourceware.org Subject: [PATCH] fix non-portable `echo -n` usage Date: Sat, 8 Aug 2015 23:50:11 -0400 Message-Id: <1439092211-25031-1-git-send-email-vapier@gentoo.org> These scripts use #!/bin/sh explicitly, so make sure they avoid echo -n as different shells treat it differently. Use the portable printf func instead. 2015-08-09 Mike Frysinger * iconvdata/tst-tables.sh: Change echo -n to printf. * nss/db-Makefile: Likewise. * posix/tst-getconf.sh: Likewise. * stdio-common/tst-unbputc.sh: Likewise. --- iconvdata/tst-tables.sh | 2 +- nss/db-Makefile | 18 +++++++++--------- posix/tst-getconf.sh | 4 ++-- stdio-common/tst-unbputc.sh | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iconvdata/tst-tables.sh b/iconvdata/tst-tables.sh index 73d9400..cd81a7f 100755 --- a/iconvdata/tst-tables.sh +++ b/iconvdata/tst-tables.sh @@ -261,7 +261,7 @@ EOF while read charset charmap; do if test "$charset" = GB18030; then echo "This might take a while" 1>&2; fi case ${charset} in \#*) continue;; esac - echo -n "Testing ${charset}" 1>&2 + printf %s "Testing ${charset}" 1>&2 if ./tst-table.sh ${common_objpfx} ${objpfx} "${test_program_prefix}" \ ${charset} ${charmap} < /dev/null; then echo 1>&2 diff --git a/nss/db-Makefile b/nss/db-Makefile index fc62344..f35bfb0 100644 --- a/nss/db-Makefile +++ b/nss/db-Makefile @@ -31,7 +31,7 @@ all: $(patsubst %,$(VAR_DB)/%.db,$(notdir $(DATABASES))) $(VAR_DB)/passwd.db: /etc/passwd - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { FS=":"; OFS=":" } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ @@ -41,7 +41,7 @@ $(VAR_DB)/passwd.db: /etc/passwd @echo "done." $(VAR_DB)/group.db: /etc/group - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { FS=":"; OFS=":" } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ @@ -63,7 +63,7 @@ $(VAR_DB)/group.db: /etc/group @echo "done." $(VAR_DB)/ethers.db: /etc/ethers - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) '/^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ /^[^#]/ { printf ".%s ", $$1; print; \ @@ -72,7 +72,7 @@ $(VAR_DB)/ethers.db: /etc/ethers @echo "done." $(VAR_DB)/protocols.db: /etc/protocols - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) '/^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ /^[^#]/ { printf ".%s ", $$1; print; \ @@ -83,7 +83,7 @@ $(VAR_DB)/protocols.db: /etc/protocols @echo "done." $(VAR_DB)/rpc.db: /etc/rpc - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) '/^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ /^[^#]/ { printf ".%s ", $$1; print; \ @@ -94,7 +94,7 @@ $(VAR_DB)/rpc.db: /etc/rpc @echo "done." $(VAR_DB)/services.db: /etc/services - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { FS="[ \t/]+" } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ @@ -110,7 +110,7 @@ $(VAR_DB)/services.db: /etc/services @echo "done." $(VAR_DB)/shadow.db: /etc/shadow - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { FS=":"; OFS=":" } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ @@ -130,7 +130,7 @@ $(VAR_DB)/shadow.db: /etc/shadow fi $(VAR_DB)/gshadow.db: /etc/gshadow - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { FS=":"; OFS=":" } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ @@ -150,7 +150,7 @@ $(VAR_DB)/gshadow.db: /etc/gshadow fi $(VAR_DB)/netgroup.db: /etc/netgroup - @echo -n "$(patsubst %.db,%,$(@F))... " + @printf %s "$(patsubst %.db,%,$(@F))... " @$(AWK) 'BEGIN { ini=1 } \ /^[ \t]*$$/ { next } \ /^[ \t]*#/ { next } \ diff --git a/posix/tst-getconf.sh b/posix/tst-getconf.sh index f804457..e0582a7 100644 --- a/posix/tst-getconf.sh +++ b/posix/tst-getconf.sh @@ -27,7 +27,7 @@ logfile=$common_objpfx/posix/tst-getconf.out rm -f $logfile result=0 while read name; do - echo -n "getconf $name: " >> $logfile + printf %s "getconf $name: " >> $logfile ${run_getconf} "$name" < /dev/null 2>> $logfile >> $logfile if test $? -ne 0; then echo "*** $name FAILED" >> $logfile @@ -205,7 +205,7 @@ XBS5_LPBIG_OFFBIG_LINTFLAGS EOF while read name; do - echo -n "getconf $name /: " >> $logfile + printf %s "getconf $name /: " >> $logfile ${run_getconf} "$name" / < /dev/null 2>> $logfile >> $logfile if test $? -ne 0; then echo "*** $name FAILED" >> $logfile diff --git a/stdio-common/tst-unbputc.sh b/stdio-common/tst-unbputc.sh index 3e991f2..706c9ea 100755 --- a/stdio-common/tst-unbputc.sh +++ b/stdio-common/tst-unbputc.sh @@ -28,6 +28,6 @@ ${test_program_prefix} \ ${common_objpfx}stdio-common/tst-unbputc \ 2> ${common_objpfx}stdio-common/tst-unbputc.out || status=1 -(echo -n 12 | cmp ${common_objpfx}stdio-common/tst-unbputc.out -) || status=1 +(printf 12 | cmp ${common_objpfx}stdio-common/tst-unbputc.out -) || status=1 exit $status