From patchwork Sun Jan 15 10:03:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ma X-Patchwork-Id: 9517341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BC5A607D4 for ; Sun, 15 Jan 2017 10:04:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE5E42846E for ; Sun, 15 Jan 2017 10:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF16628472; Sun, 15 Jan 2017 10:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4D4F2846E for ; Sun, 15 Jan 2017 10:04:51 +0000 (UTC) Received: from localhost ([::1]:50940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cShg9-00088z-8j for patchwork-qemu-devel@patchwork.kernel.org; Sun, 15 Jan 2017 05:04:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cShfq-00088u-Jy for qemu-devel@nongnu.org; Sun, 15 Jan 2017 05:04:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cShfn-0003BO-Hr for qemu-devel@nongnu.org; Sun, 15 Jan 2017 05:04:30 -0500 Received: from victor.provo.novell.com ([137.65.250.26]:48491 helo=prv3-mh.provo.novell.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cShfn-0003Au-7y for qemu-devel@nongnu.org; Sun, 15 Jan 2017 05:04:27 -0500 Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Sun, 15 Jan 2017 03:04:06 -0700 From: Lin Ma To: qemu-devel@nongnu.org Date: Sun, 15 Jan 2017 18:03:34 +0800 Message-Id: <20170115100334.15694-1-lma@suse.com> X-Mailer: git-send-email 2.9.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 137.65.250.26 Subject: [Qemu-devel] [PATCH] Makefile: Fix owner and group for qemu-version.h.tmp 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 overwrited 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 Reviewed-by: Fam Zheng --- 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