2013-08-22 20:25:40

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 0/5] clean up echo -e usage

This series cleans up non-portable 'echo -e' usage.
I haven't replaced instances of 'echo -e' under Documentation/ though.
Changes since v1:
- drop /bin/ from remaining echo calls.

Max Filippov (5):
xtensa: don't use echo -e needlessly
x86: don't use echo -e needlessly
raid6/test: replace echo -e with printf
scripts/checkkconfigsymbols.sh: replace echo -e with printf
tools/perf/perf-archive.sh: replace echo -e with printf

arch/x86/Makefile | 2 +-
arch/xtensa/Makefile | 4 ++--
arch/xtensa/boot/Makefile | 2 +-
lib/raid6/test/Makefile | 2 +-
scripts/checkkconfigsymbols.sh | 4 ++--
tools/perf/perf-archive.sh | 4 ++--
6 files changed, 9 insertions(+), 9 deletions(-)

--
1.7.7.6


2013-08-22 20:25:45

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 2/5] x86: don't use echo -e needlessly

-e is not needed to output strings without escape sequences.

Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Signed-off-by: Max Filippov <[email protected]>
---
arch/x86/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 07639c6..0954686 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -95,7 +95,7 @@ endif

ifdef CONFIG_X86_X32
x32_ld_ok := $(call try-run,\
- /bin/echo -e '1: .quad 1b' | \
+ echo '1: .quad 1b' | \
$(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \
$(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n)
--
1.7.7.6

2013-08-22 20:25:46

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 1/5] xtensa: don't use echo -e needlessly

-e is not needed to output strings without escape sequences. This breaks
big endian FSF build when the shell is dash, because its builtin echo
doesn't understand '-e' switch and outputs it in the echoed string.

Cc: Chris Zankel <[email protected]>
Cc: [email protected]
Reported-by: Guenter Roeck <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
---
arch/xtensa/Makefile | 4 ++--
arch/xtensa/boot/Makefile | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 136224b..81250ec 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -55,10 +55,10 @@ ifneq ($(CONFIG_LD_NO_RELAX),)
LDFLAGS := --no-relax
endif

-ifeq ($(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
+ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EB__
endif
-ifeq ($(shell echo -e __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
+ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EL__
endif

diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile
index 64ffc4b..ca20a89 100644
--- a/arch/xtensa/boot/Makefile
+++ b/arch/xtensa/boot/Makefile
@@ -12,7 +12,7 @@
KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS += -Iarch/$(ARCH)/boot/include

-BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
+BIG_ENDIAN := $(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#")

export ccflags-y
export BIG_ENDIAN
--
1.7.7.6

2013-08-22 20:25:50

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 5/5] tools/perf/perf-archive.sh: replace echo -e with printf

-e is a non-standard echo option, echo output is
implementation-dependent when it is used. Replace echo -e
with printf as suggested by POSIX echo manual.

Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
---
tools/perf/perf-archive.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
index e919306..8db9a24 100644
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -41,7 +41,7 @@ done

tar cjf $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
rm $MANIFEST $BUILDIDS || true
-echo -e "Now please run:\n"
-echo -e "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n"
+printf "Now please run:\n\n"
+printf "$ tar xvf $PERF_DATA.tar.bz2 -C ~/.debug\n\n"
echo "wherever you need to run 'perf report' on."
exit 0
--
1.7.7.6

2013-08-22 20:26:08

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 4/5] scripts/checkkconfigsymbols.sh: replace echo -e with printf

-e is a non-standard echo option, echo output is
implementation-dependent when it is used. Replace echo -e
with printf as suggested by POSIX echo manual.

Signed-off-by: Max Filippov <[email protected]>
---
scripts/checkkconfigsymbols.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 2ca49bb..ccb3391 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -9,7 +9,7 @@ paths="$@"
# Doing this once at the beginning saves a lot of time, on a cache-hot tree.
Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"

-/bin/echo -e "File list \tundefined symbol used"
+printf "File list \tundefined symbol used\n"
find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
do
# Output the bare Kconfig variable and the filename; the _MODULE part at
@@ -54,6 +54,6 @@ while read symb files; do
# beyond the purpose of this script.
symb_bare=`echo $symb | sed -e 's/_MODULE//'`
if ! grep -q "\<$symb_bare\>" $Kconfigs; then
- /bin/echo -e "$files: \t$symb"
+ printf "$files: \t$symb\n"
fi
done|sort
--
1.7.7.6

2013-08-22 20:26:33

by Max Filippov

[permalink] [raw]
Subject: [PATCH v2 3/5] raid6/test: replace echo -e with printf

-e is a non-standard echo option, echo output is
implementation-dependent when it is used. Replace echo -e with printf as
suggested by POSIX echo manual.

Cc: NeilBrown <[email protected]>
Cc: Jim Kukunas <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Yuanhan Liu <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
Acked-by: H. Peter Anvin <[email protected]>
---
lib/raid6/test/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
index 087332d..73b0151 100644
--- a/lib/raid6/test/Makefile
+++ b/lib/raid6/test/Makefile
@@ -28,7 +28,7 @@ ifeq ($(IS_X86),yes)
gcc -c -x assembler - >&/dev/null && \
rm ./-.o && echo -DCONFIG_AS_AVX2=1)
else
- HAS_ALTIVEC := $(shell echo -e '\#include <altivec.h>\nvector int a;' |\
+ HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
gcc -c -x c - >&/dev/null && \
rm ./-.o && echo yes)
ifeq ($(HAS_ALTIVEC),yes)
--
1.7.7.6

2013-08-28 15:01:41

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH v2 4/5] scripts/checkkconfigsymbols.sh: replace echo -e with printf

On Fri, Aug 23, 2013 at 12:25:24AM +0400, Max Filippov wrote:
> -e is a non-standard echo option, echo output is
> implementation-dependent when it is used. Replace echo -e
> with printf as suggested by POSIX echo manual.
>
> Signed-off-by: Max Filippov <[email protected]>
> ---
> scripts/checkkconfigsymbols.sh | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)

Applied to kbuild.git#misc.

Thanks,
Michal