qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Makefile: Fix "make clean"
@ 2014-03-17  1:35 Fam Zheng
  2014-03-17  6:15 ` Stefan Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2014-03-17  1:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Anthony Liguori, Stefan Weil, Michael Roth, stefanha,
	Paolo Bonzini

This fixes a dangerous bug: "make clean" after "make distclean" will
delete every single file including those under .git, if you do in-tree
build!

Rationale: A first "make distclean" will unset $(DSOSUF), a following
"make distclean" or "make clean" will find all the files and delete it.

Fix it by explicitly typing the file extensions here, and combine
multiple find invocations into one.

Signed-off-by: Fam Zheng <famz@redhat.com>

---
v2: Improve as Stefan Weil suggested.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index bd9cd4f..ec74039 100644
--- a/Makefile
+++ b/Makefile
@@ -265,10 +265,7 @@ clean:
 # avoid old build problems by removing potentially incorrect old files
 	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 	rm -f qemu-options.def
-	find . -name '*.[oda]' -type f -exec rm -f {} +
-	find . -name '*.l[oa]' -type f -exec rm -f {} +
-	find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
-	find . -name '*.mo' -type f -exec rm -f {} +
+	find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
 	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -f fsdev/*.pod
 	rm -rf .libs */.libs
-- 
1.9.0

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

* Re: [Qemu-devel] [PATCH v2] Makefile: Fix "make clean"
  2014-03-17  1:35 [Qemu-devel] [PATCH v2] Makefile: Fix "make clean" Fam Zheng
@ 2014-03-17  6:15 ` Stefan Weil
  2014-03-17 11:56   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2014-03-17  6:15 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel, Peter Maydell
  Cc: Paolo Bonzini, stefanha, Michael Roth, Anthony Liguori

Am 17.03.2014 02:35, schrieb Fam Zheng:
> This fixes a dangerous bug: "make clean" after "make distclean" will
> delete every single file including those under .git, if you do in-tree
> build!
> 
> Rationale: A first "make distclean" will unset $(DSOSUF), a following
> "make distclean" or "make clean" will find all the files and delete it.
> 
> Fix it by explicitly typing the file extensions here, and combine
> multiple find invocations into one.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> ---
> v2: Improve as Stefan Weil suggested.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  Makefile | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index bd9cd4f..ec74039 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -265,10 +265,7 @@ clean:
>  # avoid old build problems by removing potentially incorrect old files
>  	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
>  	rm -f qemu-options.def
> -	find . -name '*.[oda]' -type f -exec rm -f {} +
> -	find . -name '*.l[oa]' -type f -exec rm -f {} +
> -	find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
> -	find . -name '*.mo' -type f -exec rm -f {} +
> +	find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
>  	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
>  	rm -f fsdev/*.pod
>  	rm -rf .libs */.libs
> 

Reviewed-by: Stefan Weil <sw@weilnetz.de>

Hello Peter,

this is a bugfix which fixes a potential danger for a developer's
working directory, so I think it should be fixed directly (not via
qemu-trivial).

Regards
Stefan

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

* Re: [Qemu-devel] [PATCH v2] Makefile: Fix "make clean"
  2014-03-17  6:15 ` Stefan Weil
@ 2014-03-17 11:56   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-03-17 11:56 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Fam Zheng, Anthony Liguori, QEMU Developers, Michael Roth,
	Stefan Hajnoczi, Paolo Bonzini

On 17 March 2014 06:15, Stefan Weil <sw@weilnetz.de> wrote:
> Am 17.03.2014 02:35, schrieb Fam Zheng:
>> This fixes a dangerous bug: "make clean" after "make distclean" will
>> delete every single file including those under .git, if you do in-tree
>> build!
>>
>> Rationale: A first "make distclean" will unset $(DSOSUF), a following
>> "make distclean" or "make clean" will find all the files and delete it.
>>
>> Fix it by explicitly typing the file extensions here, and combine
>> multiple find invocations into one.
>>
>> Signed-off-by: Fam Zheng <famz@redhat.com>

> Reviewed-by: Stefan Weil <sw@weilnetz.de>
>
> Hello Peter,
>
> this is a bugfix which fixes a potential danger for a developer's
> working directory, so I think it should be fixed directly (not via
> qemu-trivial).

Agreed; applied to master, thanks.

-- PMM

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

end of thread, other threads:[~2014-03-17 11:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17  1:35 [Qemu-devel] [PATCH v2] Makefile: Fix "make clean" Fam Zheng
2014-03-17  6:15 ` Stefan Weil
2014-03-17 11:56   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).