2019-09-10 12:44:23

by Ivan Khoronzhuk

[permalink] [raw]
Subject: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

echo should be replaced on echo -e to handle \n correctly, but instead,
replace it on printf as some systems can't handle echo -e.

Signed-off-by: Ivan Khoronzhuk <[email protected]>
---
samples/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 1d9be26b4edd..f50ca852c2a8 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -201,7 +201,7 @@ endif

# Don't evaluate probes and warnings if we need to run make recursively
ifneq ($(src),)
-HDR_PROBE := $(shell echo "\#include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \
+HDR_PROBE := $(shell printf "\#include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \
$(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \
echo okay)

--
2.17.1


2019-09-10 12:46:12

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

Hello!

On 10.09.2019 13:38, Ivan Khoronzhuk wrote:

> echo should be replaced on echo -e to handle \n correctly, but instead,

s/on/with/?

> replace it on printf as some systems can't handle echo -e.

Likewise?

> Signed-off-by: Ivan Khoronzhuk <[email protected]>
[...]

MBR, Sergei

2019-09-10 20:17:59

by Ivan Khoronzhuk

[permalink] [raw]
Subject: Re: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

On Tue, Sep 10, 2019 at 01:46:48PM +0300, Sergei Shtylyov wrote:
>Hello!
>
>On 10.09.2019 13:38, Ivan Khoronzhuk wrote:
>
>>echo should be replaced on echo -e to handle \n correctly, but instead,
>
> s/on/with/?
s/echo/printf/ instead of s/echo/echo -e/

printf looks better.

>
>>replace it on printf as some systems can't handle echo -e.
>
> Likewise?
Like some, better avoid ambiguity, for me it works fine - is not enough.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
"A string to be written to standard output. If the first operand is
-n, or if any of the operands contain a <backslash> character, the
results are implementation-defined"

I can guess its Mac vs Linux, but it does mean nothing if it's defined as
implementation dependent, can be any.

>
>>Signed-off-by: Ivan Khoronzhuk <[email protected]>
>[...]
>
>MBR, Sergei
>

--
Regards,
Ivan Khoronzhuk

2019-09-11 11:04:52

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

On 10.09.2019 17:54, Ivan Khoronzhuk wrote:

>> Hello!
>>
>> On 10.09.2019 13:38, Ivan Khoronzhuk wrote:
>>
>>> echo should be replaced on echo -e to handle \n correctly, but instead,
>>
>>  s/on/with/?
> s/echo/printf/ instead of s/echo/echo -e/

I only pointed that 'on' is incorrect there. You replace something /with/
something other...

>
> printf looks better.
>
>>
>>> replace it on printf as some systems can't handle echo -e.
>>
>>   Likewise?

Same grammatical mistake.

> I can guess its Mac vs Linux, but it does mean nothing if it's defined as
> implementation dependent, can be any.
>
>>> Signed-off-by: Ivan Khoronzhuk <[email protected]>
>> [...]

MBR, Sergei

2019-09-14 07:11:00

by Ivan Khoronzhuk

[permalink] [raw]
Subject: Re: [PATCH bpf-next 01/11] samples: bpf: makefile: fix HDR_PROBE "echo"

On Wed, Sep 11, 2019 at 02:02:11PM +0300, Sergei Shtylyov wrote:
>On 10.09.2019 17:54, Ivan Khoronzhuk wrote:
>
>>>Hello!
>>>
>>>On 10.09.2019 13:38, Ivan Khoronzhuk wrote:
>>>
>>>>echo should be replaced on echo -e to handle \n correctly, but instead,
>>>
>>>?s/on/with/?
>>s/echo/printf/ instead of s/echo/echo -e/
>
> I only pointed that 'on' is incorrect there. You replace something
>/with/ something other...
>
>>
>>printf looks better.
>>
>>>
>>>>replace it on printf as some systems can't handle echo -e.
>>>
>>>? Likewise?
>
> Same grammatical mistake.
Oh, will correct it next v.


--
Regards,
Ivan Khoronzhuk