Skip to contentSkip to conversation

fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled

PATCH New Peter Korsgaard 1 participant 2 messages Nov 26, 2016 – Nov 27, 2016 UBI file system (UBIFS)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled

Fixes #9386

GNU sed -i misbehaves on systems with SELinux enabled, as it tries to copy to the SELinux security context (xattr) from the source file to to the new destination file, which fails under fakeroot and leaves the file with 000 permissions, causing ubinize to fail when it cannot read to configuration file.

So as a workaround, combine the install and tweak steps in a single sed with a redirect to the destination file instead.

---
 fs/ubifs/ubi.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ubifs/ubi.mk +4 -2
index cda4bf4..e488cb5 100644
@@ -20,9 +20,11 @@ else
 UBINIZE_CONFIG_FILE_PATH = fs/ubifs/ubinize.cfg
 endif
 
+# don't use sed -i as it misbehaves on systems with SELinux enabled when this is
+# executed through fakeroot (see #9386)
 define ROOTFS_UBI_CMD
-	$(INSTALL) -m 0644 $(UBINIZE_CONFIG_FILE_PATH) $(BUILD_DIR)/ubinize.cfg
-	$(SED) 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' $(BUILD_DIR)/ubinize.cfg
+	sed 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' \
+		$(UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.cfg
 	$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
 	rm $(BUILD_DIR)/ubinize.cfg
 endef
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled

Quoted 8 lines · Peter Korsgaard

Fixes #9386

GNU sed -i misbehaves on systems with SELinux enabled, as it tries to copy to the SELinux security context (xattr) from the source file to to the new destination file, which fails under fakeroot and leaves the file with 000 permissions, causing ubinize to fail when it cannot read to configuration file.

Quoted 4 lines

So as a workaround, combine the install and tweak steps in a single sed with a redirect to the destination file instead.

Committed, thanks.

I will now revert the changes moving from fakeroot to pseudo.

Signature · 1 line
Bye, Peter Korsgaard