From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled
Date: Sat, 5 May 2018 12:01:00 +0200 [thread overview]
Message-ID: <20180505100100.GA2481@scaer> (raw)
In-Reply-To: <20180503121958.9462-1-casantos@datacom.ind.br>
Carlos, All,
On 2018-05-03 09:19 -0300, Carlos Santos spake thusly:
> Since commit 0db34529f48 we use rsync with the --keep-dirlinks option to
> prevent overlays from accidentally overwriding /{usr,bin,sbin,lib} links
> when BR2_ROOTFS_MERGED_USR option is enabled. Unfortunately this also
> prevents replacing a symlink by a directory on purpose (e.g. /var/log,
> to persist system logs).
In that case, I suggest your use a post-build script instead.
In facct, I think that any modifications that change the layout of the
filesystem should be done as a post-build script rather than an overlay.
So, I am pretty much reluctant to see this patch go in.
Regards,
Yann E. MORIN.
> Steps to reproduce:
>
> - enable BR2_ROOTFS_MERGED_USR and BR2_PACKAGE_SKELETON_INIT_SYSV
> - mkdir some_path/rootfs-overlay/var/log
> - enable BR2_ROOTFS_OVERLAY="some_path/rootfs-overlay"
> - run 'make'
> - 'target/var/log' is still a symlink to '../tmp', not a directory
>
> Fix the problem by adding a step in target-finalize that checks each
> overlay, using the same criteria used in skeleton-custom.mk.
>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
> Makefile | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 957ba6634a..1b306f8556 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -751,9 +751,40 @@ endif
> @$(call MESSAGE,"Sanitizing RPATH in target tree")
> $(TOPDIR)/support/scripts/fix-rpath target
>
> +# For a merged /usr, ensure that /lib, /bin and /sbin and their /usr
> +# counterparts are appropriately setup as symlinks ones to the others.
> +ifeq ($(BR2_ROOTFS_MERGED_USR),y)
> +
> + @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
> + $(call MESSAGE,"Sanity check in overlay $(d)"); \
> + lib_inode=$$(stat -c '%i' $(d)/lib/. 2>/dev/null || true); \
> + bin_inode=$$(stat -c '%i' $(d)/bin/. 2>/dev/null || true); \
> + sbin_inode=$$(stat -c '%i' $(d)/sbin/. 2>/dev/null || true); \
> + usr_lib_inode=$$(stat -c '%i' $(d)/usr/lib/. 2>/dev/null || true); \
> + usr_bin_inode=$$(stat -c '%i' $(d)/usr/bin/. 2>/dev/null || true); \
> + usr_sbin_inode=$$(stat -c '%i' $(d)/usr/sbin/. 2>/dev/null || true); \
> + not_merged_dirs=""; \
> + test -z "$$lib_inode" || \
> + test "$$lib_inode" = "$$usr_lib_inode" || \
> + not_merged_dirs="$$not_merged_dirs /lib"; \
> + test -z "$$bin_inode" || \
> + test "$$bin_inode" = "$$usr_bin_inode" || \
> + not_merged_dirs="$$not_merged_dirs /bin"; \
> + test -z "$$sbin_inode" || \
> + test "$$sbin_inode" = "$$usr_sbin_inode" || \
> + not_merged_dirs="$$not_merged_dirs /sbin"; \
> + test -n "$$not_merged_dirs" && { \
> + echo "ERROR: The custom skeleton in $(d) is not" \
> + "using a merged /usr for the following directories:" \
> + $$not_merged_dirs; \
> + exit 1; \
> + } || true)
> +
> +endif # merged /usr
> +
> @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
> $(call MESSAGE,"Copying overlay $(d)"); \
> - rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
> + rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
> --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
> $(d)/ $(TARGET_DIR)$(sep))
>
> --
> 2.14.3
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2018-05-05 10:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 12:19 [Buildroot] [PATCH] Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled Carlos Santos
2018-05-05 10:01 ` Yann E. MORIN [this message]
2018-05-05 13:47 ` Carlos Santos
2018-05-05 14:45 ` Yann E. MORIN
2018-05-05 15:01 ` Peter Korsgaard
2018-05-05 15:21 ` Yann E. MORIN
2018-05-05 18:13 ` Arnout Vandecappelle
2018-05-05 14:41 ` Peter Korsgaard
2018-05-05 15:06 ` Yann E. MORIN
2018-05-05 15:26 ` Peter Korsgaard
2018-05-05 14:54 ` 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=20180505100100.GA2481@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/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.