Skip to contentSkip to conversation

Ensure files we modify are writable

PATCH New Yann E. MORIN 2 participants 11 messages Jan 28, 2014

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

v3 cover Ensure files we modify are writable

From: "Yann E. MORIN" <[email protected]>

Hello All!

This series ensures that target/ and our copies of the .config files are writeable.

In case the Buildroot tree is RO (eg. shared via a read-only NFS mount), target/ would end-up read-only, which is a bit awkward, since we won't be able to add files in there. Ditto for the busybox', uClibc's, and Linux' .config files, since we need to tweak them with sed.

I've had this locally for some time now, grabbed from some patches in patchwork. A previous submission of this series has been marked as "Changes Requested", but there's no trace of it in the ML, so I'm just re-spinning them as-is for further comments.

Changes v2 -> v3:
- small nit and typoes (Danomi, Thomas)

                                                                                                                                                                                      ?

Changes v1 -> v2: ?
- add three other files to the list (Danomi) ?

Regards,
Yann E. MORIN.

----------------------------------------------------------------
Nathan Lynch (2):
target: ensure target/ dir is writable
busybox: ensure $(BUSYBOX_BUILD_CONFIG) is writable

Yann E. MORIN (3):
linux: ensure buildroot_defconfig is writable package/uClibc: ensure .config is writable
fs: ensure $(TARGET_DIR_WARNING_FILE) is writable

 Makefile                   | 6 +++---
 fs/common.mk               | 2 +-
 linux/linux.mk             | 2 +-
 package/busybox/busybox.mk | 2 +-
 package/uclibc/uclibc.mk   | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v3 1/5 target: ensure target/ dir is writable

From: Nathan Lynch <[email protected]>

If the source target skeleton is read-only (eg. because Buildroot's source dir is), modifications to the output target (such as creating /etc/hostname and /etc/issue) fail.

(This can happen if the Buildroot source dir is NFS-mounted read-only to be shared between different machines, for example).

[yann.morin.1998 at free.fr: we use rsync now, not cp; --chmod=Du+w
suggested by Arnout; clarify commit log]

Cc Arnout Vandecappelle <[email protected]>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 067458b..d8a8dad 100644
@@ -473,7 +473,7 @@ RSYNC_VCS_EXCLUSIONS = \
 $(BUILD_DIR)/.root:
 	mkdir -p $(TARGET_DIR)
 	rsync -a $(RSYNC_VCS_EXCLUSIONS) \
-		--exclude .empty --exclude '*~' \
+		--chmod=Du+w --exclude .empty --exclude '*~' \
 		$(TARGET_SKELETON)/ $(TARGET_DIR)/
 	cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
 	@ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
@@ -549,7 +549,7 @@ endif
 	@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
 		$(call MESSAGE,"Copying overlay $(d)"); \
 		rsync -a $(RSYNC_VCS_EXCLUSIONS) \
-			--exclude .empty --exclude '*~' \
+			--chmod=Du+w --exclude .empty --exclude '*~' \
 			$(d)/ $(TARGET_DIR)$(sep))
 
 	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 1/5 target: ensure target/ dir is writable

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Nathan Lynch <[email protected]>
If the source target skeleton is read-only (eg. because Buildroot's source dir is), modifications to the output target (such as creating /etc/hostname and /etc/issue) fail.

Quoted 8 lines

(This can happen if the Buildroot source dir is NFS-mounted read-only to be shared between different machines, for example).

[yann.morin.1998 at free.fr: we use rsync now, not cp; --chmod=Du+w
suggested by Arnout; clarify commit log]

Cc Arnout Vandecappelle <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v3 2/5 busybox: ensure $(BUSYBOX_BUILD_CONFIG) is writable

In reply to Yann E. MORIN

From: Nathan Lynch <[email protected]>

If $(BUSYBOX_CONFIG_FILE) is read-only (eg. because Buildroot's source dir is), the sed fixups to $(BUSYBOX_BUILD_CONFIG) fail.

Fixes #4363
[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp]
Cc Arnout Vandecappelle <[email protected]>
---
 package/busybox/busybox.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/busybox/busybox.mk +1 -1
index f6f542e..948f3e4 100644
@@ -135,7 +135,7 @@ endef
 endif
 
 define BUSYBOX_COPY_CONFIG
-	cp -f $(BUSYBOX_CONFIG_FILE) $(BUSYBOX_BUILD_CONFIG)
+	$(INSTALL) -D -m 0644 $(BUSYBOX_CONFIG_FILE) $(BUSYBOX_BUILD_CONFIG)
 endef
 
 # Disable shadow passwords support if unsupported by the C library
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 2/5 busybox: ensure $(BUSYBOX_BUILD_CONFIG) is writable

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Nathan Lynch <[email protected]>
If $(BUSYBOX_CONFIG_FILE) is read-only (eg. because Buildroot's source dir is), the sed fixups to $(BUSYBOX_BUILD_CONFIG) fail.

Fixes #4363
[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp]
Cc Arnout Vandecappelle <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH v3 3/5 linux: ensure buildroot_defconfig is writable

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

If $(KERNEL_SOURCE_CONFIG) is read-only (eg. because Buildroot's source dir is), the rm of $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig will either fail, or prompt the user, both of which we want to avoid.

Make it writable by using $(INSTALL).

Fixes #4363
[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp, don't 'rm -f']
---
 linux/linux.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
index ab25fe9..62033d2 100644
@@ -164,7 +164,7 @@ KERNEL_SOURCE_CONFIG = $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE)
 endif
 
 define LINUX_CONFIGURE_CMDS
-	cp $(KERNEL_SOURCE_CONFIG) $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig
+	$(INSTALL) -m 0644 $(KERNEL_SOURCE_CONFIG) $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig
 	$(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) buildroot_defconfig
 	rm $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig
 	$(if $(BR2_arm)$(BR2_armeb),
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH 3/5 linux: ensure buildroot_defconfig is writable

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
If $(KERNEL_SOURCE_CONFIG) is read-only (eg. because Buildroot's source dir is), the rm of $(KERNEL_ARCH_PATH)/configs/buildroot_defconfig will either fail, or prompt the user, both of which we want to avoid.

Quoted 6 lines

Make it writable by using $(INSTALL).

Fixes #4363
[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp, don't 'rm -f']

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH v3 4/5 package/uClibc: ensure .config is writable

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

If $(UCLIBC_CONFIG_FILE) is read-only (eg. because Buildroot's source dir is), the sed fixups to .config fail.

[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp]
---
 package/uclibc/uclibc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/uclibc/uclibc.mk +1 -1
index 1978bbd..7df9721 100644
@@ -414,7 +414,7 @@ UCLIBC_MAKE_FLAGS = \
 	HOSTCC="$(HOSTCC)"
 
 define UCLIBC_SETUP_DOT_CONFIG
-	cp -f $(UCLIBC_CONFIG_FILE) $(@D)/.config
+	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(@D)/.config
 	$(call UCLIBC_OPT_SET,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(@D))
 	$(call UCLIBC_OPT_SET,TARGET_$(UCLIBC_TARGET_ARCH),y,$(@D))
 	$(call UCLIBC_OPT_SET,TARGET_ARCH,"$(UCLIBC_TARGET_ARCH)",$(@D))
Signature · 1 line
1.8.1.2
#8 lore raw

PATCH 4/5 package/uClibc: ensure .config is writable

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
If $(UCLIBC_CONFIG_FILE) is read-only (eg. because Buildroot's source dir is), the sed fixups to .config fail.

[yann.morin.1998 at free.fr: use $(INSTALL) instead of cp]

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#9 lore raw

PATCH v3 5/5 fs: ensure $(TARGET_DIR_WARNING_FILE) is writable

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

If the Buildroot tree is read-only, then $(TARGET_DIR_WARNING_FILE) is copied read-only into target/ but we may want to remove it during the build process.

This poses no real problem, since target/ itself is guaranteed to be writable, but for good measure, force $(TARGET_DIR_WARNING_FILE) to be writable itself.

---
 Makefile     | 2 +-
 fs/common.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index d8a8dad..dc57cf4 100644
@@ -475,7 +475,7 @@ $(BUILD_DIR)/.root:
 	rsync -a $(RSYNC_VCS_EXCLUSIONS) \
 		--chmod=Du+w --exclude .empty --exclude '*~' \
 		$(TARGET_SKELETON)/ $(TARGET_DIR)/
-	cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
+	$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
 	@ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
 	@mkdir -p $(TARGET_DIR)/usr
 	@ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
fs/common.mk +1 -1
index 9f32620..30e7524 100644
@@ -83,7 +83,7 @@ endif
 	echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
 	chmod a+x $$(FAKEROOT_SCRIPT)
 	$$(HOST_DIR)/usr/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
-	cp support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
+	$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
 	- at rm -f $$(FAKEROOT_SCRIPT) $$(FULL_DEVICE_TABLE)
 ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)
 	$$(ROOTFS_$(2)_COMPRESS_CMD) $$@ > $$@$$(ROOTFS_$(2)_COMPRESS_EXT)
Signature · 1 line
1.8.1.2
#10 lore raw

PATCH 5/5 fs: ensure $(TARGET_DIR_WARNING_FILE) is writable

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
If the Buildroot tree is read-only, then $(TARGET_DIR_WARNING_FILE) is copied read-only into target/ but we may want to remove it during the build process.

Quoted 6 lines

This poses no real problem, since target/ itself is guaranteed to be writable, but for good measure, force $(TARGET_DIR_WARNING_FILE) to be writable itself.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard