mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check
@ 2023-02-10 16:02 Uwe Kleine-König
  2023-02-15 20:07 ` Alexander Dahl
  2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-02-10 16:02 UTC (permalink / raw)
  To: ptxdist

The intend here is to check the return code of grep, no need to call [
(i.e. test). This fixes an error message:

	environment: line 10: [: syntax error: `-q' unexpected

Additionally add -e to force interpretation of
"${PTXDIST_CROSS_CPPFLAGS}" as pattern. For me
${PTXDIST_CROSS_CPPFLAGS} starts with -isystem; without -e this is
interpreted as option to grep instead of pattern which makes grep emit

	grep: invalid option -- 't'

.)

Also add -F to make grep use a fixed-string compare (instead of
interpreting ${PTXDIST_CROSS_CPPFLAGS} as regexp).

Fixes: ac0aac7fc727 ("impove compile_commands.json handling")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 scripts/lib/ptxd_make_world_compile_commands.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/ptxd_make_world_compile_commands.sh b/scripts/lib/ptxd_make_world_compile_commands.sh
index 56d7378fa28b..2703b5497799 100644
--- a/scripts/lib/ptxd_make_world_compile_commands.sh
+++ b/scripts/lib/ptxd_make_world_compile_commands.sh
@@ -21,7 +21,7 @@ ptxd_make_world_compile_commands_filter() {
     fi
 
     if [ "${src_cmds}" = "${dst_cmds}" ]; then
-	if [ grep -q "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}" ]; then
+	if grep -q -F -e "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}"; then
 	    ptxd_warning "compile_commands.json is already up to date!"
 	    return
 	fi
-- 
2.39.0




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

* Re: [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check
  2023-02-10 16:02 [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check Uwe Kleine-König
@ 2023-02-15 20:07 ` Alexander Dahl
  2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2023-02-15 20:07 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: ptxdist

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

Moin,

Am Fri, Feb 10, 2023 at 05:02:58PM +0100 schrieb Uwe Kleine-König:
> The intend here is to check the return code of grep, no need to call [
> (i.e. test). This fixes an error message:
> 
> 	environment: line 10: [: syntax error: `-q' unexpected
> 
> Additionally add -e to force interpretation of
> "${PTXDIST_CROSS_CPPFLAGS}" as pattern. For me
> ${PTXDIST_CROSS_CPPFLAGS} starts with -isystem; without -e this is
> interpreted as option to grep instead of pattern which makes grep emit
> 
> 	grep: invalid option -- 't'
> 
> .)
> 
> Also add -F to make grep use a fixed-string compare (instead of
> interpreting ${PTXDIST_CROSS_CPPFLAGS} as regexp).

All this makes sense. Thumbs up.

> 
> Fixes: ac0aac7fc727 ("impove compile_commands.json handling")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  scripts/lib/ptxd_make_world_compile_commands.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/ptxd_make_world_compile_commands.sh b/scripts/lib/ptxd_make_world_compile_commands.sh
> index 56d7378fa28b..2703b5497799 100644
> --- a/scripts/lib/ptxd_make_world_compile_commands.sh
> +++ b/scripts/lib/ptxd_make_world_compile_commands.sh
> @@ -21,7 +21,7 @@ ptxd_make_world_compile_commands_filter() {
>      fi
>  
>      if [ "${src_cmds}" = "${dst_cmds}" ]; then
> -	if [ grep -q "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}" ]; then
> +	if grep -q -F -e "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}"; then

Acked-by: Alexander Dahl <post@lespocky.de>

Greets
Alex

>  	    ptxd_warning "compile_commands.json is already up to date!"
>  	    return
>  	fi
> -- 
> 2.39.0

-- 
/"\ ASCII RIBBON | »With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.«
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

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

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

* Re: [ptxdist] [APPLIED] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check
  2023-02-10 16:02 [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check Uwe Kleine-König
  2023-02-15 20:07 ` Alexander Dahl
@ 2023-02-17 15:35 ` Michael Olbrich
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Olbrich @ 2023-02-17 15:35 UTC (permalink / raw)
  To: ptxdist; +Cc: Uwe Kleine-König

Thanks, applied as 609521efdc7d55d0fccca2c881f34adf23d22516.

Michael

[sent from post-receive hook]

On Fri, 17 Feb 2023 16:35:56 +0100, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> The intend here is to check the return code of grep, no need to call [
> (i.e. test). This fixes an error message:
> 
> 	environment: line 10: [: syntax error: `-q' unexpected
> 
> Additionally add -e to force interpretation of
> "${PTXDIST_CROSS_CPPFLAGS}" as pattern. For me
> ${PTXDIST_CROSS_CPPFLAGS} starts with -isystem; without -e this is
> interpreted as option to grep instead of pattern which makes grep emit
> 
> 	grep: invalid option -- 't'
> 
> .)
> 
> Also add -F to make grep use a fixed-string compare (instead of
> interpreting ${PTXDIST_CROSS_CPPFLAGS} as regexp).
> 
> Fixes: ac0aac7fc727 ("impove compile_commands.json handling")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Acked-by: Alexander Dahl <post@lespocky.de>
> Message-Id: <20230210160258.12558-1-u.kleine-koenig@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/scripts/lib/ptxd_make_world_compile_commands.sh b/scripts/lib/ptxd_make_world_compile_commands.sh
> index 56d7378fa28b..2703b5497799 100644
> --- a/scripts/lib/ptxd_make_world_compile_commands.sh
> +++ b/scripts/lib/ptxd_make_world_compile_commands.sh
> @@ -21,7 +21,7 @@ ptxd_make_world_compile_commands_filter() {
>      fi
>  
>      if [ "${src_cmds}" = "${dst_cmds}" ]; then
> -	if [ grep -q "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}" ]; then
> +	if grep -q -F -e "${PTXDIST_CROSS_CPPFLAGS}" "${src_cmds}"; then
>  	    ptxd_warning "compile_commands.json is already up to date!"
>  	    return
>  	fi



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

end of thread, other threads:[~2023-02-17 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 16:02 [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check Uwe Kleine-König
2023-02-15 20:07 ` Alexander Dahl
2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox