From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 3/4] Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled
Date: Mon, 7 May 2018 14:54:43 +0200 [thread overview]
Message-ID: <20180507145443.6515b0a3@windsurf> (raw)
In-Reply-To: <20180507124640.7759-4-casantos@datacom.ind.br>
Hello,
On Mon, 7 May 2018 09:46:39 -0300, Carlos Santos wrote:
> 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).
>
> 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.
>
> Add a paragraph to the documentation clarifying that rootfs overlays
> don't need to contain /bin, /lib or /sbin and must not contain them when
> BR2_ROOTFS_MERGED_USR is enabled.
>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
> Changes v1->v2:
>
> - Rebase series to HEAD of master branch
> - Rework commit message and documentation, as suggested by Thomas
> Petazzoni
> ---
> Makefile | 20 +++++++++++++++++---
> docs/manual/customize-rootfs.txt | 8 ++++++++
> 2 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index c024c65f78..dc51269143 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -746,11 +746,25 @@ 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)"); \
> + not_merged_dirs="$$(support/scripts/check-merged-usr.sh $(d))"; \
> + test -n "$$not_merged_dirs" && { \
> + echo "ERROR: The overlay in $(d) is not" \
> + "using a merged /usr for the following directories:" \
> + $$not_merged_dirs; \
> + exit 1; \
> + } || true$(sep))
> +
> +endif # merged /usr
> +
> @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
> $(call MESSAGE,"Copying overlay $(d)"); \
> - rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \
> - --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
> - $(d)/ $(TARGET_DIR)$(sep))
> + $(call SYSTEM_RSYNC,$(d),$(TARGET_DIR))$(sep))
This specific chunk is not directly related to checking that overlays
comply with the merged /usr rule, so shouldn't this be in a separate
commit ?
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-05-07 12:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 12:46 [Buildroot] [PATCH v2 0/4] Improve verification of custom rootfs skeletons and overlays Carlos Santos
2018-05-07 12:46 ` [Buildroot] [PATCH v2 1/4] skeleton-custom: use a script to check merged usr structure Carlos Santos
2018-05-07 12:46 ` [Buildroot] [PATCH v2 2/4] skeleton-custom: install /bin, /lib, and /sbin Carlos Santos
2018-05-07 12:46 ` [Buildroot] [PATCH v2 3/4] Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled Carlos Santos
2018-05-07 12:54 ` Thomas Petazzoni [this message]
2018-05-07 13:05 ` Carlos Santos
2018-05-07 13:10 ` Thomas Petazzoni
2018-05-07 13:28 ` Carlos Santos
2018-05-07 13:51 ` Thomas Petazzoni
2018-05-07 12:46 ` [Buildroot] [PATCH v2 4/4] system: allow selecting merged /usr along with custom rootfs skeleton Carlos Santos
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=20180507145443.6515b0a3@windsurf \
--to=thomas.petazzoni@bootlin.com \
--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.