Skip to contentSkip to conversation

btrfs-progs: build: Do not use cp -a to install files

PATCH In review Peter Kjellerstedt 3 participants 3 messages Apr 4, 2018 – Apr 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: build: Do not use cp -a to install files

Using cp -a to install files will preserve the ownership of the original files (if possible), which is typically not wanted. E.g., if the files were built by a normal user, but are being installed by root, then the installed files would maintain the UIDs/GIDs of the user that built the files rather than be owned by root.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 92cfe7b5..0e8bfd98 100644
@@ -578,7 +578,7 @@ install: $(libs) $(progs_install) $(INSTALLDIRS)
 	$(LN_S) -f btrfs $(DESTDIR)$(bindir)/btrfsck
 	$(INSTALL) -m755 -d $(DESTDIR)$(libdir)
 	$(INSTALL) $(libs) $(DESTDIR)$(libdir)
-	cp -a $(lib_links) $(DESTDIR)$(libdir)
+	cp -d $(lib_links) $(DESTDIR)$(libdir)
 	$(INSTALL) -m755 -d $(DESTDIR)$(incdir)
 	$(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
 ifneq ($(udevdir),)
Signature · 1 line
2.12.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Peter Kjellerstedt

Using cp -a to install files will preserve the ownership of the original files (if possible), which is typically not wanted. E.g., if the files were built by a normal user, but are being installed by root, then the installed files would maintain the UIDs/GIDs of the user that built the files rather than be owned by root.

Thanks, Anand

#2 lore raw
In reply to Peter Kjellerstedt
Quoted 7 lines · Peter Kjellerstedt

Using cp -a to install files will preserve the ownership of the original files (if possible), which is typically not wanted. E.g., if the files were built by a normal user, but are being installed by root, then the installed files would maintain the UIDs/GIDs of the user that built the files rather than be owned by root.

Applied and added to 4.16, thanks.