Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled
@ 2016-11-26 23:40 Peter Korsgaard
  2016-11-27 20:20 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Korsgaard @ 2016-11-26 23:40 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 fs/ubifs/ubi.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/ubi.mk b/fs/ubifs/ubi.mk
index cda4bf4..e488cb5 100644
--- a/fs/ubifs/ubi.mk
+++ b/fs/ubifs/ubi.mk
@@ -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
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled
  2016-11-26 23:40 [Buildroot] [PATCH] fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled Peter Korsgaard
@ 2016-11-27 20:20 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2016-11-27 20:20 UTC (permalink / raw)
  To: buildroot

On Sun, Nov 27, 2016 at 12:40 AM, Peter Korsgaard <peter@korsgaard.com> wrote:
> 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.
>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>

Committed, thanks.

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

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-27 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-26 23:40 [Buildroot] [PATCH] fs/ubifs: work around fakeroot / sed -i issue on systems with SELinux enabled Peter Korsgaard
2016-11-27 20:20 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox