All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Makefile: ignore long options
       [not found] <20210722040535.3683543-1-stilor.ref@att.net>
@ 2021-07-22  4:05 ` Alexey Neyman
  2021-07-24  6:14   ` Alexey Neyman
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Neyman @ 2021-07-22  4:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Neyman

When searching for options like -n in MAKEFLAGS, current code may result
in a false positive match when make is invoked with long options like
--no-print-directory. This has been observed with certain versions of
host make (e.g. 3.82) while building the Qemu package in buildroot.

Filter out such long options before searching for one-character options.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 6c36330eef..401c623a65 100644
--- a/Makefile
+++ b/Makefile
@@ -129,9 +129,11 @@ endif
 # 4. Rules to bridge to other makefiles
 
 ifneq ($(NINJA),)
-MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
-MAKE.k = $(findstring k,$(firstword $(MAKEFLAGS)))
-MAKE.q = $(findstring q,$(firstword $(MAKEFLAGS)))
+# Filter out long options to avoid flags like --no-print-directory which
+# may result in false positive match for MAKE.n
+MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
+MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
+MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
 MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
 NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
         $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
-- 
2.27.0



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

* Re: [PATCH] Makefile: ignore long options
  2021-07-22  4:05 ` [PATCH] Makefile: ignore long options Alexey Neyman
@ 2021-07-24  6:14   ` Alexey Neyman
  2021-07-24 14:04     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Neyman @ 2021-07-24  6:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: stilor

Patch ping...

On 7/21/21 9:05 PM, Alexey Neyman wrote:
> When searching for options like -n in MAKEFLAGS, current code may result
> in a false positive match when make is invoked with long options like
> --no-print-directory. This has been observed with certain versions of
> host make (e.g. 3.82) while building the Qemu package in buildroot.
>
> Filter out such long options before searching for one-character options.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>
> ---
>   Makefile | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 6c36330eef..401c623a65 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -129,9 +129,11 @@ endif
>   # 4. Rules to bridge to other makefiles
>   
>   ifneq ($(NINJA),)
> -MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
> -MAKE.k = $(findstring k,$(firstword $(MAKEFLAGS)))
> -MAKE.q = $(findstring q,$(firstword $(MAKEFLAGS)))
> +# Filter out long options to avoid flags like --no-print-directory which
> +# may result in false positive match for MAKE.n
> +MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> +MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> +MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
>   MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
>   NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
>           $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \


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

* Re: [PATCH] Makefile: ignore long options
  2021-07-24  6:14   ` Alexey Neyman
@ 2021-07-24 14:04     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-07-24 14:04 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Paolo Bonzini, QEMU Developers

On Sat, 24 Jul 2021 at 07:16, Alexey Neyman <stilor@att.net> wrote:
>
> Patch ping...

Ccing Paolo as author of this bit of code...

> On 7/21/21 9:05 PM, Alexey Neyman wrote:
> > When searching for options like -n in MAKEFLAGS, current code may result
> > in a false positive match when make is invoked with long options like
> > --no-print-directory. This has been observed with certain versions of
> > host make (e.g. 3.82) while building the Qemu package in buildroot.
> >
> > Filter out such long options before searching for one-character options.
> >
> > Signed-off-by: Alexey Neyman <stilor@att.net>
> > ---
> >   Makefile | 8 +++++---
> >   1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 6c36330eef..401c623a65 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -129,9 +129,11 @@ endif
> >   # 4. Rules to bridge to other makefiles
> >
> >   ifneq ($(NINJA),)
> > -MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
> > -MAKE.k = $(findstring k,$(firstword $(MAKEFLAGS)))
> > -MAKE.q = $(findstring q,$(firstword $(MAKEFLAGS)))
> > +# Filter out long options to avoid flags like --no-print-directory which
> > +# may result in false positive match for MAKE.n
> > +MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> > +MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> > +MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> >   MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
> >   NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
> >           $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
>

-- PMM


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

* [PATCH] Makefile: ignore long options
       [not found] <20210722020846.3678817-1-stilor.ref@att.net>
@ 2021-07-22  2:08 ` Alexey Neyman
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Neyman @ 2021-07-22  2:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Neyman

When searching for options like -n in MAKEFLAGS, current code may result
in a false positive match when make is invoked with long options like
--no-print-directory. This has been observed with certain versions of
host make (e.g. 3.82) while building the Qemu package in buildroot.

Filter out such long options before searching for one-character options.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 6c36330eef..401c623a65 100644
--- a/Makefile
+++ b/Makefile
@@ -129,9 +129,11 @@ endif
 # 4. Rules to bridge to other makefiles
 
 ifneq ($(NINJA),)
-MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
-MAKE.k = $(findstring k,$(firstword $(MAKEFLAGS)))
-MAKE.q = $(findstring q,$(firstword $(MAKEFLAGS)))
+# Filter out long options to avoid flags like --no-print-directory which
+# may result in false positive match for MAKE.n
+MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
+MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
+MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
 MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
 NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
         $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
-- 
2.27.0



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

end of thread, other threads:[~2021-07-24 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210722040535.3683543-1-stilor.ref@att.net>
2021-07-22  4:05 ` [PATCH] Makefile: ignore long options Alexey Neyman
2021-07-24  6:14   ` Alexey Neyman
2021-07-24 14:04     ` Peter Maydell
     [not found] <20210722020846.3678817-1-stilor.ref@att.net>
2021-07-22  2:08 ` Alexey Neyman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.