mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] ptxd_make_world_compile_commands_filter: Fix grep for uptodate check
Date: Fri, 10 Feb 2023 17:02:58 +0100	[thread overview]
Message-ID: <20230210160258.12558-1-u.kleine-koenig@pengutronix.de> (raw)

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




             reply	other threads:[~2023-02-10 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 16:02 Uwe Kleine-König [this message]
2023-02-15 20:07 ` Alexander Dahl
2023-02-17 15:35 ` [ptxdist] [APPLIED] " Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210160258.12558-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox