filesystems: also chown symlinks
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 8 Jun 2014 20:02:23 +0000 (22:02 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 9 Jun 2014 09:28:57 +0000 (11:28 +0200)
Currently, the symlinks in the generated filesystems will have the
UID of the user running the build, because 'chown' does not change
the ownership of symlinks, by default.

Although the implications are limited, some may not want that UID
to leak in the generated filesystems.

So, use 'chown -h' so even symlinks get properly chowned.

Reported-by: Angelo Dureghello <angelo@barix.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
fs/common.mk
fs/iso9660/iso9660.mk
support/scripts/mkusers

index 2adaf8ce832f82cf2ae4d57f0b1cbc4eb9acbf03..45f88b2a9b6ae01d5e7323e06b723b0670a6afc5 100644 (file)
@@ -70,7 +70,7 @@ $$(BINARIES_DIR)/rootfs.$(1): target-finalize $$(ROOTFS_$(2)_DEPENDENCIES)
        rm -f $$(FAKEROOT_SCRIPT)
        rm -f $$(TARGET_DIR_WARNING_FILE)
        rm -f $(USERS_TABLE)
-       echo "chown -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
+       echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 ifneq ($$(ROOTFS_DEVICE_TABLES),)
        cat $$(ROOTFS_DEVICE_TABLES) > $$(FULL_DEVICE_TABLE)
 ifeq ($$(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
index 6c8ace0418dd5ace9a763b2f54b9c92af37babec..b0e755db94dcade4c443a6fa3729182dfc2d949f 100644 (file)
@@ -29,7 +29,7 @@ else
 endif
        # Use fakeroot to pretend all target binaries are owned by root
        rm -f $(FAKEROOT_SCRIPT)
-       echo "chown -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
+       echo "chown -h -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
        # Use fakeroot so mkisofs believes the previous fakery
        echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
                "-boot-load-size 4 -boot-info-table -o $@ $(ISO9660_TARGET_DIR)" \
index 3fa0fa84c8976246694750e8bbaef86b55c74299..ffd192dba3732b7e13199cfa5d6debe5db501276 100755 (executable)
@@ -342,7 +342,7 @@ add_one_user() {
     # (Note: stdout goes to the fakeroot-script)
     if [ "${home}" != "-" ]; then
         mkdir -p "${TARGET_DIR}/${home}"
-        printf "chown -R %d:%d '%s'\n" "${uid}" "${_gid}" "${TARGET_DIR}/${home}"
+        printf "chown -h -R %d:%d '%s'\n" "${uid}" "${_gid}" "${TARGET_DIR}/${home}"
     fi
 }