Skip to contentSkip to conversation

Makefile: Fix owner and group for qemu-version.h.tmp

PATCH Superseded Lin Ma 1 participant 2 messages Jan 17, 2017 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

PATCH 1/1 Makefile: Fix owner and group for qemu-version.h.tmp

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 1a8bfb2..1ca45b2 100644
@@ -184,7 +184,7 @@ qemu-version.h: FORCE
 				printf '""\n'; \
 			fi; \
 		fi) > [email protected])
-	$(call quiet-command, cmp -s $@ [email protected] || mv [email protected] $@)
+	$(call quiet-command, cmp -s $@ [email protected] || cp [email protected] $@)
 
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
Signature · 1 line
2.9.2
author
#1 lore raw

Oops, Sorry that I forgot to add 'V2' in email's title. Thank Fam Zheng to review the patch.

Lin

Quoted 1 line
Quoted 1 line
Quoted 1 line

Lin Ma <[email protected]> 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.

---
Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 1a8bfb2..1ca45b2 100644
@@ -184,7 +184,7 @@ qemu-version.h: FORCE
				printf '""\n'; \
			fi; \
		fi) > [email protected])
-	$(call quiet-command, cmp -s $@ [email protected] || mv [email protected] $@)
+	$(call quiet-command, cmp -s $@ [email protected] || cp [email protected] $@)

config-host.h: config-host.h-timestamp
config-host.h-timestamp: config-host.mak

Signature · 1 line
2.9.2