From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Mathieu Mirmont <mat@parad0x.org>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2] fs/common.mk: fix the globing pattern
Date: Sat, 12 Mar 2022 17:19:12 +0100 [thread overview]
Message-ID: <20220312161912.GF283544@scaer> (raw)
In-Reply-To: <20220310120256.GA11974@parad0x.org>
Mathieu, All,
On 2022-03-10 13:02 +0100, Mathieu Mirmont via buildroot spake thusly:
> 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@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)
I think I preferred your find-based solution, because, as far as I
understand, this is still broken, as it won't match files named, for
example "..foo"
The find-based solution, though, should work for everything and does not
risk any issue with badly interpreted blobs in varios shells and various
shell versions.
Regards,
Yann E. MORIN.
> $$(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)
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-03-12 16:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 10:18 [Buildroot] [PATCH 1/1] fs/common.mk: use find instead of shell glob patterns Mathieu Mirmont via buildroot
2022-03-10 10:45 ` David Laight
2022-03-10 11:33 ` Mat via buildroot
2022-03-10 11:52 ` David Laight
2022-03-10 12:11 ` Mathieu Mirmont via buildroot
2022-03-10 13:47 ` David Laight
2022-03-10 15:42 ` Mathieu Mirmont via buildroot
2022-03-10 11:22 ` Edgar Bonet
2022-03-10 11:31 ` David Laight
2022-03-10 12:02 ` [Buildroot] [PATCH v2] fs/common.mk: fix the globing pattern Mathieu Mirmont via buildroot
2022-03-12 16:19 ` Yann E. MORIN [this message]
2022-03-12 16:52 ` [Buildroot] [PATCH 1/1] fs/common.mk: use find instead of shell glob patterns Yann E. MORIN
2022-03-19 19:01 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220312161912.GF283544@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=mat@parad0x.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.