public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find
@ 2012-03-02 22:17 Brian Norris
  2012-03-08 16:54 ` Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Norris @ 2012-03-02 22:17 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd, Mike Frysinger

findutils v4.1.x does not have the `-exec CMD {} +' syntax. We can just as
easily use the `-exec CMD {} \;' syntax. However, it will launch a lot more
`rm' processes...

RHEL 4 still uses findutils 4.1.20 and gets errors like this:

  $ make clean
  rm -f /XXX/mtd-utils/*.o /XXX/mtd-utils/ftl_format  ...
  find: missing argument to `-exec'
  make: *** [clean] Error 1

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 17a1216..0cbbecc 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ endif
 	@if test -d "$(BUILDDIR)/"; then \
 		find $(BUILDDIR)/ -xdev \
 			'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
-			-exec rm -f {} + ; \
+			-exec rm -f {} \; ; \
 	fi
 	rm -f $(BUILDDIR)/include/version.h
 	$(MAKE) -C $(TESTS) clean

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

* Re: [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find
  2012-03-02 22:17 [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find Brian Norris
@ 2012-03-08 16:54 ` Mike Frysinger
  2012-03-08 17:52   ` Brian Norris
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2012-03-08 16:54 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Artem Bityutskiy

On Fri, Mar 2, 2012 at 17:17, Brian Norris <computersforpeace@gmail.com> wrote:
> findutils v4.1.x does not have the `-exec CMD {} +' syntax. We can just as
> easily use the `-exec CMD {} \;' syntax.

really it's a workaround for old tools that don't adhere to the new POSIX spec

> However, it will launch a lot more `rm' processes...

indeed, that does suck.  you could do this, but it kind of sucks too ...
CLEAN_FIND = find "$(BUILDDIR)/" -xdev '(' -name '*.[ao]' -o -name
'.*.c.dep' ')'
...
    @if test -d "$(BUILDDIR)/"; then
        $(CLEAN_FIND) -exec rm -f {} + 2>/dev/null || \
        $(CLEAN_FIND) -exec rm -f {} \; ; \
    fi
...
-mike

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

* Re: [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find
  2012-03-08 16:54 ` Mike Frysinger
@ 2012-03-08 17:52   ` Brian Norris
  2012-03-09  9:41     ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Norris @ 2012-03-08 17:52 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Artem Bityutskiy

On Thu, Mar 8, 2012 at 8:54 AM, Mike Frysinger <vapier.adi@gmail.com> wrote:
> On Fri, Mar 2, 2012 at 17:17, Brian Norris <computersforpeace@gmail.com> wrote:
>> However, it will launch a lot more `rm' processes...
>
> indeed, that does suck.  you could do this, but it kind of sucks too ...
> CLEAN_FIND = find "$(BUILDDIR)/" -xdev '(' -name '*.[ao]' -o -name
> '.*.c.dep' ')'
> ...
>    @if test -d "$(BUILDDIR)/"; then
>        $(CLEAN_FIND) -exec rm -f {} + 2>/dev/null || \
>        $(CLEAN_FIND) -exec rm -f {} \; ; \
>    fi

I'm fine with that too. It's a little uglier, but it's not quite as
bad for systems that have a modern `find', I think. I'll resend with
your suggestion if there are no better suggestions.

Brian

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

* Re: [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find
  2012-03-08 17:52   ` Brian Norris
@ 2012-03-09  9:41     ` Artem Bityutskiy
  2012-03-09 17:46       ` Brian Norris
  0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2012-03-09  9:41 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd, Mike Frysinger

On Thu, 2012-03-08 at 09:52 -0800, Brian Norris wrote:
> On Thu, Mar 8, 2012 at 8:54 AM, Mike Frysinger <vapier.adi@gmail.com> wrote:
> > On Fri, Mar 2, 2012 at 17:17, Brian Norris <computersforpeace@gmail.com> wrote:
> >> However, it will launch a lot more `rm' processes...
> >
> > indeed, that does suck.  you could do this, but it kind of sucks too ...
> > CLEAN_FIND = find "$(BUILDDIR)/" -xdev '(' -name '*.[ao]' -o -name
> > '.*.c.dep' ')'
> > ...
> >    @if test -d "$(BUILDDIR)/"; then
> >        $(CLEAN_FIND) -exec rm -f {} + 2>/dev/null || \
> >        $(CLEAN_FIND) -exec rm -f {} \; ; \
> >    fi
> 
> I'm fine with that too. It's a little uglier, but it's not quite as
> bad for systems that have a modern `find', I think. I'll resend with
> your suggestion if there are no better suggestions.

May be adding a one-line comment like "work-around for ancient find
utils not supporting '+'" would also be a good idea?

-- 
Best Regards,
Artem Bityutskiy

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

* Re: [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find
  2012-03-09  9:41     ` Artem Bityutskiy
@ 2012-03-09 17:46       ` Brian Norris
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2012-03-09 17:46 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd, Mike Frysinger

On Fri, Mar 9, 2012 at 1:41 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> May be adding a one-line comment like "work-around for ancient find
> utils not supporting '+'" would also be a good idea?

Already have something similar in my patch. Will send now.

Brian

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

end of thread, other threads:[~2012-03-09 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 22:17 [PATCH (mtd-utils)] Makefile: fix "make clean" for old GNU find Brian Norris
2012-03-08 16:54 ` Mike Frysinger
2012-03-08 17:52   ` Brian Norris
2012-03-09  9:41     ` Artem Bityutskiy
2012-03-09 17:46       ` Brian Norris

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