[Buildroot] [PATCH v2] fs/common.mk: fix the globing pattern
Mathieu Mirmont
mat at parad0x.org
Thu Mar 10 12:02:56 UTC 2022
The FAKEROOT script uses [^x] wildcard patterns which, while supported
by many shells and interpreted like a regex, are undefined according
to POSIX.
The dash shell (/bin/sh) on Debian testing switched to a different
fnmatch/glob implementation that does not support [^x]. Instead it
treats [^x] as either "^" or "x", and as a result buildroot fails to
build on this distro:
rm: refusing to remove '.' or '..' directory: skipping '/build/buildroot-fs/cpio/target/run/..'
rm: refusing to remove '.' or '..' directory: skipping '/build/buildroot-fs/cpio/target/tmp/..'
The correct form should be [!x] rather than [^x].
Signed-off-by: Mathieu Mirmont <mat at parad0x.org>
---
fs/common.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/common.mk b/fs/common.mk
index 45beb5ae7b..64a94d9ad8 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -186,7 +186,7 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
- echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/run/.[^.]* $$(TARGET_DIR)/tmp/* $$(TARGET_DIR)/tmp/.[^.]*" >> $$(FAKEROOT_SCRIPT)
+ echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/run/.[!.]* $$(TARGET_DIR)/tmp/* $$(TARGET_DIR)/tmp/.[!.]*" >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_SELINUX)) >> $$(FAKEROOT_SCRIPT)
$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
--
2.35.1
Changes v1 -> v2:
- Fix the regex rather than use find|xargs (suggested by Edgar Bonet & David Laight)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.buildroot.org/pipermail/buildroot/attachments/20220310/fa2f1204/attachment-0001.asc>
More information about the buildroot
mailing list