linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] clean up echo -e usage
@ 2013-08-22 14:53 Max Filippov
  2013-08-22 14:53 ` [PATCH 1/3] xtensa: don't use echo -e needlessly Max Filippov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Max Filippov @ 2013-08-22 14:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sam Ravnborg, Guenter Roeck, Max Filippov

This series cleans up non-portable 'echo -e' usage.
I haven't replaced all instances of 'echo -e' though:
- those under Documentation don't affect build;
- those that invoke echo by full path (/bin/echo) probably know what they do;
- those that output user help don't affect build.

Max Filippov (3):
  xtensa: don't use echo -e needlessly
  x86: don't use echo -e needlessly
  raid6/test: replace echo -e with printf

 arch/x86/Makefile         |    2 +-
 arch/xtensa/Makefile      |    4 ++--
 arch/xtensa/boot/Makefile |    2 +-
 lib/raid6/test/Makefile   |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] xtensa: don't use echo -e needlessly
  2013-08-22 14:53 [PATCH 0/3] clean up echo -e usage Max Filippov
@ 2013-08-22 14:53 ` Max Filippov
  2013-08-22 14:53 ` [PATCH 2/3] x86: " Max Filippov
  2013-08-22 14:53 ` [PATCH 3/3] raid6/test: replace echo -e with printf Max Filippov
  2 siblings, 0 replies; 8+ messages in thread
From: Max Filippov @ 2013-08-22 14:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sam Ravnborg, Guenter Roeck, Max Filippov, Chris Zankel,
	linux-xtensa

-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 <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] x86: don't use echo -e needlessly
  2013-08-22 14:53 [PATCH 0/3] clean up echo -e usage Max Filippov
  2013-08-22 14:53 ` [PATCH 1/3] xtensa: don't use echo -e needlessly Max Filippov
@ 2013-08-22 14:53 ` Max Filippov
  2013-08-22 15:11   ` H. Peter Anvin
  2013-08-22 14:53 ` [PATCH 3/3] raid6/test: replace echo -e with printf Max Filippov
  2 siblings, 1 reply; 8+ messages in thread
From: Max Filippov @ 2013-08-22 14:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sam Ravnborg, Guenter Roeck, Max Filippov, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86

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

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 arch/x86/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 07639c6..7386e8a 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' | \
+			/bin/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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] raid6/test: replace echo -e with printf
  2013-08-22 14:53 [PATCH 0/3] clean up echo -e usage Max Filippov
  2013-08-22 14:53 ` [PATCH 1/3] xtensa: don't use echo -e needlessly Max Filippov
  2013-08-22 14:53 ` [PATCH 2/3] x86: " Max Filippov
@ 2013-08-22 14:53 ` Max Filippov
  2013-08-22 15:09   ` H. Peter Anvin
  2 siblings, 1 reply; 8+ messages in thread
From: Max Filippov @ 2013-08-22 14:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sam Ravnborg, Guenter Roeck, Max Filippov, NeilBrown, Jim Kukunas,
	H. Peter Anvin, Yuanhan Liu

-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 <neilb@suse.de>
Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] raid6/test: replace echo -e with printf
  2013-08-22 14:53 ` [PATCH 3/3] raid6/test: replace echo -e with printf Max Filippov
@ 2013-08-22 15:09   ` H. Peter Anvin
  2013-08-26  4:15     ` NeilBrown
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2013-08-22 15:09 UTC (permalink / raw)
  To: Max Filippov, linux-kernel
  Cc: Sam Ravnborg, Guenter Roeck, NeilBrown, Jim Kukunas, Yuanhan Liu

Acked-by: H. Peter Anvin <hpa@zytor.com>

Max Filippov <jcmvbkbc@gmail.com> 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.
>
>Cc: NeilBrown <neilb@suse.de>
>Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>
>Cc: "H. Peter Anvin" <hpa@zytor.com>
>Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>---
> 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)

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] x86: don't use echo -e needlessly
  2013-08-22 14:53 ` [PATCH 2/3] x86: " Max Filippov
@ 2013-08-22 15:11   ` H. Peter Anvin
  2013-08-22 15:17     ` Max Filippov
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2013-08-22 15:11 UTC (permalink / raw)
  To: Max Filippov, linux-kernel
  Cc: Sam Ravnborg, Guenter Roeck, Thomas Gleixner, Ingo Molnar, x86

Can we drop the /bin/?

Max Filippov <jcmvbkbc@gmail.com> wrote:
>-e is not needed to output strings without escape sequences.
>
>Cc: Thomas Gleixner <tglx@linutronix.de>
>Cc: Ingo Molnar <mingo@redhat.com>
>Cc: "H. Peter Anvin" <hpa@zytor.com>
>Cc: x86@kernel.org
>Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>---
> arch/x86/Makefile |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>index 07639c6..7386e8a 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' | \
>+			/bin/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)

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] x86: don't use echo -e needlessly
  2013-08-22 15:11   ` H. Peter Anvin
@ 2013-08-22 15:17     ` Max Filippov
  0 siblings, 0 replies; 8+ messages in thread
From: Max Filippov @ 2013-08-22 15:17 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: LKML, Sam Ravnborg, Guenter Roeck, Thomas Gleixner, Ingo Molnar,
	x86

On Thu, Aug 22, 2013 at 7:11 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Can we drop the /bin/?

Sure.

> Max Filippov <jcmvbkbc@gmail.com> wrote:
>>-e is not needed to output strings without escape sequences.
>>
>>Cc: Thomas Gleixner <tglx@linutronix.de>
>>Cc: Ingo Molnar <mingo@redhat.com>
>>Cc: "H. Peter Anvin" <hpa@zytor.com>
>>Cc: x86@kernel.org
>>Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>>---
>> arch/x86/Makefile |    2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>>index 07639c6..7386e8a 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' | \
>>+                      /bin/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)

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] raid6/test: replace echo -e with printf
  2013-08-22 15:09   ` H. Peter Anvin
@ 2013-08-26  4:15     ` NeilBrown
  0 siblings, 0 replies; 8+ messages in thread
From: NeilBrown @ 2013-08-26  4:15 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Max Filippov, linux-kernel, Sam Ravnborg, Guenter Roeck,
	Jim Kukunas, Yuanhan Liu

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

On Thu, 22 Aug 2013 17:09:11 +0200 "H. Peter Anvin" <hpa@zytor.com> wrote:

> Acked-by: H. Peter Anvin <hpa@zytor.com>

Applied with the Ack - thanks.

NeilBrown

> 
> Max Filippov <jcmvbkbc@gmail.com> 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.
> >
> >Cc: NeilBrown <neilb@suse.de>
> >Cc: Jim Kukunas <james.t.kukunas@linux.intel.com>
> >Cc: "H. Peter Anvin" <hpa@zytor.com>
> >Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> >Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> >---
> > 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)
> 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-26  4:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 14:53 [PATCH 0/3] clean up echo -e usage Max Filippov
2013-08-22 14:53 ` [PATCH 1/3] xtensa: don't use echo -e needlessly Max Filippov
2013-08-22 14:53 ` [PATCH 2/3] x86: " Max Filippov
2013-08-22 15:11   ` H. Peter Anvin
2013-08-22 15:17     ` Max Filippov
2013-08-22 14:53 ` [PATCH 3/3] raid6/test: replace echo -e with printf Max Filippov
2013-08-22 15:09   ` H. Peter Anvin
2013-08-26  4:15     ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).