Received: from eggs.gnu.org ([2001:4830:134:3::10]:41653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdq5x-0006WW-AR for qemu-devel@nongnu.org; Tue, 14 Feb 2017 22:17:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdq5v-00020H-Qr for qemu-devel@nongnu.org; Tue, 14 Feb 2017 22:17:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cdq5v-0001zs-Kg for qemu-devel@nongnu.org; Tue, 14 Feb 2017 22:17:27 -0500 Date: Wed, 15 Feb 2017 11:17:23 +0800 From: Fam Zheng Message-ID: <20170215031723.GB26331@lemon.lan> References: <20170215024030.23895-1-lma@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170215024030.23895-1-lma@suse.com> Subject: Re: [Qemu-devel] [PATCH v3] Makefile: avoid leaving the temporary QEMU_PKGVERSION header file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lin Ma Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, stefanha@redhat.com On Wed, 02/15 10:40, Lin Ma wrote: > By commit 67a1de0d, When we perform 'git pull && make && sudo make install', > In 'make' stage a qemu-version.h.tmp will be generated. If the content of > qemu-version.h.tmp and qemu-version.h aren't consistent, The qemu-version.h.tmp > will be renamed to qemu-version.h. Because of the target FORCE, The same action > will be do again in 'make install' stage. > > In 'make install' stage, If there is no qemu-version.h.tmp exists and we run > 'make install' with sudo, The owner and group of new qemu-version.h.tmp will be > privileged user/group. When we run 'make' next time, qemu-version.h.tmp can't > be overwritten because of permission issue. > > This patch removed qemu-version.h.tmp after build to fix this issue. > > Signed-off-by: Lin Ma > --- > Makefile | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index b993741..830fa5a 100644 > --- a/Makefile > +++ b/Makefile > @@ -299,7 +299,11 @@ qemu-version.h: FORCE > printf '""\n'; \ > fi; \ > fi) > $@.tmp) > - $(call quiet-command, cmp -s $@ $@.tmp || mv $@.tmp $@) > + $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ > + mv $@.tmp $@; \ > + else \ > + rm $@.tmp; \ > + fi) > > config-host.h: config-host.h-timestamp > config-host.h-timestamp: config-host.mak > -- > 2.9.2 > Reviewed-by: Fam Zheng