From patchwork Tue Jan 17 08:15:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lin Ma X-Patchwork-Id: 716054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v2jyf3vgFz9tkD for ; Tue, 17 Jan 2017 19:32:25 +1100 (AEDT) Received: from localhost ([::1]:33529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTPBl-00020T-Jn for incoming@patchwork.ozlabs.org; Tue, 17 Jan 2017 03:32:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTPAz-0001Uy-Nl for qemu-devel@nongnu.org; Tue, 17 Jan 2017 03:31:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTPAu-0007Of-AX for qemu-devel@nongnu.org; Tue, 17 Jan 2017 03:31:33 -0500 Received: from prv-mh.provo.novell.com ([137.65.248.74]:33515) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cTPAt-0007OM-W8 for qemu-devel@nongnu.org; Tue, 17 Jan 2017 03:31:28 -0500 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 17 Jan 2017 01:31:25 -0700 Message-Id: <587E432802000062000C4E19@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Tue, 17 Jan 2017 01:15:36 -0700 From: "Lin Ma" To: ,"Lin Ma" References: <20170117043348.21314-1-lma@suse.com> In-Reply-To: <20170117043348.21314-1-lma@suse.com> Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 137.65.248.74 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] =?utf-8?b?562U5aSN77yaICBbUEFUQ0hdIE1ha2VmaWxlOiBG?= =?utf-8?q?ix_owner_and_group_for_qemu-version=2Eh=2Etmp?= X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, famz@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Oops, Sorry that I forgot to add 'V2' in email's title. Thank Fam Zheng to review the patch. Lin >>> Lin Ma 2017/1/17 星期二 下午 12:33 >>> 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 uses 'cp' instead of 'mv' to keep the qemu-version.h.tmp file, So during the 'sudo make install' stage, new qemu-version.h.tmp's owner and group wont be set to privileged user/group. Signed-off-by: Lin Ma --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a8bfb2..1ca45b2 100644 --- a/Makefile +++ b/Makefile @@ -184,7 +184,7 @@ qemu-version.h: FORCE printf '""\n'; \ fi; \ fi) > $@.tmp) - $(call quiet-command, cmp -s $@ $@.tmp || mv $@.tmp $@) + $(call quiet-command, cmp -s $@ $@.tmp || cp $@.tmp $@) config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak