Skip to content

Commit

Permalink
fix non-portable echo -n usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mike Frysinger committed Aug 9, 2015
1 parent ef086ef commit 2c61c19
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2015-08-09 Mike Frysinger <vapier@gentoo.org>

* iconvdata/tst-tables.sh: Change echo -n to printf.
* nss/db-Makefile: Likewise.
* posix/tst-getconf.sh: Likewise.
* stdio-common/tst-unbputc.sh: Likewise.

2015-08-09 Mike Frysinger <vapier@gentoo.org>

* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]: Move all
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/tst-tables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions nss/db-Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 } \
Expand All @@ -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 } \
Expand All @@ -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; \
Expand All @@ -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; \
Expand All @@ -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; \
Expand All @@ -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 } \
Expand All @@ -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 } \
Expand All @@ -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 } \
Expand All @@ -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 } \
Expand Down
4 changes: 2 additions & 2 deletions posix/tst-getconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stdio-common/tst-unbputc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2c61c19

Please sign in to comment.