From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v6 03/13] core: re-enter make if $(CURDIR) or $(O) are not absolute canonical path
Date: Wed, 3 Feb 2016 21:15:27 +0100 [thread overview]
Message-ID: <20160203211527.009e08aa@free-electrons.com> (raw)
In-Reply-To: <1454342021-22960-4-git-send-email-s.martin49@gmail.com>
Hello,
On Mon, 1 Feb 2016 16:53:31 +0100, Samuel Martin wrote:
> When $(CURDIR) or $(O) contain symlinks (or mount-bind) in their path,
> they can be resolved differently, depending on each package build-system
> (whether it uses the given paths or get the absolute canonical ones).
>
> Thus, to make easier tracking down host machine paths leaking into the
> host, target or staging trees, the CURDIR and O variables are set to
> their absolute canonical paths.
>
> Note that this change takes care of the makefile wrapper installed in
> $(O) to avoid unneeded make recursion.
>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
I have to say I kind of hate how complicated our Makefile "entry" logic
has become over time. But well, certainly not your fault.
> +# Check if we need to re-enter make for one or several of the following reasons:
> +# 1- Wrong (too restrictive) umask:
> +# This prevents Buildroot and packages from creating files and directories.
> +# 2- CWD (i.e. $(CURDIR)) not being the absolute canonical path:
> +# This makes harder tracking and fixing host machine path leaks.
> +# 3- Output location (i.e. $(O)) not being the absolute canonical path:
> +# This makes harder tracking and fixing host machine path leaks.
> +#
> +# Note:
> +# - remove the trailing '/.' from $(O) as it can be added by the makefile
> +# wrapper installed in the $(O).
> +ifneq ($(shell umask):$(CURDIR):$(patsubst %/.,%,$(O)),$(UMASK):$(realpath $(CURDIR)):$(realpath $(O)))
Can we simplify this a bit with an intermediate "NEED_RECURSE" or
something like that ?
# umask is too restrictive
ifneq ($(shell umask),$(UMASK))
NEED_RECURSE = YES
endif
...
ifeq ($(NEED_RECURSE),YES)
Maybe "RECURSE" is not the appropriate word. Maybe "NEED_SUBMAKE" is
better. Or other folks might have better suggestions.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-02-03 20:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 15:53 [Buildroot] [PATCH v6 00/13] Relocatable SDK / build machine leaks Samuel Martin
2016-02-01 15:53 ` [Buildroot] [PATCH v6 01/13] package/linux-headers: cleanup installation Samuel Martin
2016-02-01 17:34 ` Thomas Petazzoni
2016-02-01 15:53 ` [Buildroot] [PATCH v6 02/13] core: use $(CURDIR) to set TOPDIR Samuel Martin
2016-02-01 18:51 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 03/13] core: re-enter make if $(CURDIR) or $(O) are not absolute canonical path Samuel Martin
2016-02-01 18:58 ` Arnout Vandecappelle
2016-02-03 20:15 ` Thomas Petazzoni [this message]
2016-02-01 15:53 ` [Buildroot] [PATCH v6 04/13] core: staging symlink uses a relative path when possible Samuel Martin
2016-02-01 17:38 ` Thomas Petazzoni
2016-02-01 15:53 ` [Buildroot] [PATCH v6 05/13] core: make staging *-config scripts relocatable Samuel Martin
2016-02-01 20:18 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 06/13] core: make host " Samuel Martin
2016-02-01 18:45 ` Thomas Petazzoni
2016-02-01 20:01 ` Arnout Vandecappelle
2016-02-01 20:03 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 07/13] support/scripts: add fix-rpath script + a bunch of helpers Samuel Martin
2016-02-01 21:50 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 08/13] core: add HOST_SANITIZE_RPATH_HOOK to TARGET_FINALIZE_HOOKS Samuel Martin
2016-02-02 17:46 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 09/13] core: add {TARGET, STAGING}_SANITIZE_RPATH_HOOK " Samuel Martin
2016-02-02 18:13 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 10/13] package/speex: remove no longer needed hook Samuel Martin
2016-02-02 18:17 ` Arnout Vandecappelle
2016-02-01 15:53 ` [Buildroot] [PATCH v6 11/13] support/scripts: update check-host-rpath to use the shell helpers Samuel Martin
2016-02-01 15:53 ` [Buildroot] [PATCH v6 12/13] support/scripts: add check-host-leaks script + all needed helpers Samuel Martin
2016-02-01 15:53 ` [Buildroot] [PATCH v6 13/13] core: add check-leaks-in-{target, host, staging} targets Samuel Martin
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=20160203211527.009e08aa@free-electrons.com \
--to=thomas.petazzoni@free-electrons.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.