Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/613854/?format=api
{ "id": 613854, "url": "http://patchwork.ozlabs.org/api/patches/613854/?format=api", "web_url": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-3-git-send-email-s.martin49@gmail.com/", "project": { "id": 27, "url": "http://patchwork.ozlabs.org/api/projects/27/?format=api", "name": "Buildroot development", "link_name": "buildroot", "list_id": "buildroot.buildroot.org", "list_email": "buildroot@buildroot.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1461358223-18312-3-git-send-email-s.martin49@gmail.com>", "list_archive_url": null, "date": "2016-04-22T20:50:14", "name": "[v9,02/11] core: re-enter make if $(CURDIR) or $(O) are not absolute canonical path", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ed38e1bf23fbe5287c8247532bba149d74227244", "submitter": { "id": 12868, "url": "http://patchwork.ozlabs.org/api/people/12868/?format=api", "name": "Samuel Martin", "email": "s.martin49@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-3-git-send-email-s.martin49@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/613854/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/613854/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<buildroot-bounces@busybox.net>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "buildroot@lists.busybox.net" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "buildroot@osuosl.org" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3qs7753hlZz9sCk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Apr 2016 06:50:41 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id CD86996665;\n\tFri, 22 Apr 2016 20:50:40 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id YP5pfcbG5aNF; Fri, 22 Apr 2016 20:50:39 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id BE5299666D;\n\tFri, 22 Apr 2016 20:50:39 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 1F9FB1C1750\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:36 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1847B9658C\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:36 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id TbgkbZpCRpKB for <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:35 +0000 (UTC)", "from mail-wm0-f68.google.com (mail-wm0-f68.google.com\n\t[74.125.82.68])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 9C2B696666\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 20:50:34 +0000 (UTC)", "by mail-wm0-f68.google.com with SMTP id e201so6946703wme.2\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 13:50:34 -0700 (PDT)", "from bobook.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net.\n\t[82.229.165.48]) by smtp.gmail.com with ESMTPSA id\n\tiv1sm9826507wjb.34.2016.04.22.13.50.31\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tFri, 22 Apr 2016 13:50:31 -0700 (PDT)" ], "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=DsCNIA/F;\n\tdkim-atps=neutral", "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=EK6nrX8UMfXYU9fy+FFD+JDestuR+8/208SjDfmpnKI=;\n\tb=DsCNIA/FB3xXA/8E29wJzrJXgUMm3FG5nlUDAXrDx3rNAwCJrB8DU1vliuNShgeakI\n\t07NSWld6zcRMP0arjm5tv5M85L+cKHuITdKslfyB8gd6bJ2CZ4EQ25CzrznpYSGT08ex\n\te/iwusDC7FrBpHr8DlpNiOUvBkkBeHljtZAb/802l/mJ8uwG3BXe/oHp3A/9Jd6tZaQu\n\trMvxlr7XeF3NlAEJH+8Q/bFf48NyInIcYuzFIFzxY4VXXD2c6csfrV8qDIOdbdHikEk4\n\tJ2I7IZ+LtjeoKAKvm7UW6AGXPMAxyjeSs+lD1HbYhS7/yXCK/PJmUxMD3ykAEyfn6EA3\n\ttGFw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=EK6nrX8UMfXYU9fy+FFD+JDestuR+8/208SjDfmpnKI=;\n\tb=XAEMgxfUgCormzbtHO45Fd2agEqvX8YN+zAzrIGhcqoSRYoQ6s2An2y4dhkhDaIV1R\n\tyFfQ5cIL3QBiiU8gB5ZRGsyXa4dV9ChWLZRVhDVNBNpeIg/qUEyEtKtMMCuwLXdk97YS\n\ts6BcFzH4ogb/cHOO/UiAKh23xAh0aqxgm7o4puTeW9VJyo2eyhMS3x4MyorW55bmV5Lh\n\tjZ2Yx0EHzP5LyOlf4GalqIB2D66ytxifnNeiMbiCRXseewJ8/072L+c/U71kXcHr7ypo\n\tbbwqdN9mv6oy/qCirJ192iCm201ffz/khquXegPniNkdSSwJS/3/D7gMOMIVO/dhLMMj\n\t3HRQ==", "X-Gm-Message-State": "AOPr4FUd6oRuGXmCHYdHBD6Yis39X7g1+dvnMwHHUHL96LDDmk0PtK8z+ACms3qPKHFNkA==", "X-Received": "by 10.195.31.130 with SMTP id km2mr21018938wjd.86.1461358233165; \n\tFri, 22 Apr 2016 13:50:33 -0700 (PDT)", "From": "Samuel Martin <s.martin49@gmail.com>", "To": "buildroot@buildroot.org", "Date": "Fri, 22 Apr 2016 22:50:14 +0200", "Message-Id": "<1461358223-18312-3-git-send-email-s.martin49@gmail.com>", "X-Mailer": "git-send-email 2.8.0", "In-Reply-To": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>", "References": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>", "Cc": "\"Yann E. MORIN\" <yann.morin.1998@free.fr>", "Subject": "[Buildroot] [PATCH v9 02/11] core: re-enter make if $(CURDIR) or\n\t$(O) are not absolute canonical path", "X-BeenThere": "buildroot@busybox.net", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Discussion and development of buildroot <buildroot.busybox.net>", "List-Unsubscribe": "<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>", "List-Archive": "<http://lists.busybox.net/pipermail/buildroot/>", "List-Post": "<mailto:buildroot@busybox.net>", "List-Help": "<mailto:buildroot-request@busybox.net?subject=help>", "List-Subscribe": "<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "buildroot-bounces@busybox.net", "Sender": "\"buildroot\" <buildroot-bounces@busybox.net>" }, "content": "When $(CURDIR) or $(O) contain symlinks in their path, they can be\nresolved differently, depending on each package build-system (whether it\nuses the given paths or get the absolute canonical ones).\n\nThis will make easier tracking down host machine paths leaking into the\nhost, target or staging trees, the CURDIR and O variables are set to\ntheir absolute canonical paths.\n\nIn order to recall the toplevel makefile with absolute canonical paths\nfor $(CURDIR) and $(O), we need to:\n1- Move the O variable definition out of any if-block; so they are\n always available.\n2- Compute the absolute canonical paths for $(CURDIR) and $(O) that will\n be passed to the sub-make. This is achieved using the 'realpath' make\n primitive. However, some care must be taken when manipulating O:\n - the out-of-tree makefile wrapper happens a trailing \"/.\", we need\n to strip this part away to not break the comparison driving the\n sub-make call;\n - according to [1,2], realpath returns an empty string in case of\n non-existing entry. So, to avoid passing an empty O= variable to\n sub-make, it is necessary to define the output directory and create\n it prior to call realpath on it (because on the first invocation,\n $(O) usually does not yet exists), hence the trick doing the mkdir\n right before calling realpath.\n3- Update EXTRAMAKEARGS with the absobulte canonical $(O) and use it\n when call recalling the toplevel makefile with umask and paths\n correctly set.\n4- Lastly, update the condition for setting the CONFIG_DIR and\n NEED_WRAPPER variables.\n\nNotes:\n* This change takes care of the makefile wrapper installed in $(O) to\n avoid unneeded make recursion.\n* Now, only $(O) is strip away from MAKEOVERRIDES whatever the build is\n done in- or out-of-tree (i.o.w. without or with O set in the command\n line); wheares is the previous implementation, all variables set on\n the command line were stripped away only in the case of out-of-tree\n build.\n\n[1] https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html\n[2] http://man7.org/linux/man-pages/man3/realpath.3.html\n\nReported-by: Matthew Weber <matt@thewebers.ws>\nCc: Matthew Weber <matt@thewebers.ws>\nCc: \"Yann E. MORIN\" <yann.morin.1998@free.fr>\nCc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>\nSigned-off-by: Samuel Martin <s.martin49@gmail.com>\n\n---\nchanges v8->v9:\n- none\n\nchanges v7->v8:\n- keep @ at the beginning of the command (Yann)\n- make ifneq condition easier to read/parsed (Yann)\n- fix O definition before re-entering make (Reported by Matthew)\n- use EXTRAMAKEARGS when re-entering make\n- update the condition for CONFIG_DIR and NEED_WRAPPER\n\nchanges v6->v7:\n- none\n\nchanges v5->v6:\n- new patch\n---\n Makefile | 86 +++++++++++++++++++++++++++++++++++++++++++---------------------\n 1 file changed, 58 insertions(+), 28 deletions(-)", "diff": "diff --git a/Makefile b/Makefile\nindex 3d86c9b..a05b9e1 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -24,18 +24,68 @@\n # You shouldn't need to mess with anything beyond this point...\n #--------------------------------------------------------------\n \n-# Trick for always running with a fixed umask\n+# Set O variable if not already done on the command line;\n+# or avoid confusing packages that can use the O=<dir> syntax for out-of-tree\n+# build by preventing it from being forwarded to sub-make calls.\n+ifneq (\"$(origin O)\", \"command line\")\n+O := $(CURDIR)/output\n+else\n+# Other packages might also support Linux-style out of tree builds\n+# with the O=<dir> syntax (E.G. BusyBox does). As make automatically\n+# forwards command line variable definitions those packages get very\n+# confused. Fix this by telling make to not do so, only for O=..., but\n+# keep all others (such as BR2_EXTERNAL, BR2_DL_DIR, etc).\n+MAKEOVERRIDES := $(filter-out O=%,$(MAKEOVERRIDES))\n+# Strangely enough O is still passed to submakes with MAKEOVERRIDES\n+# (with make 3.81 atleast), the only thing that changes is the output\n+# of the origin function (command line -> environment).\n+# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)\n+# To really make O go away, we have to override it.\n+override O := $(O)\n+endif\n+\n+# Check if the current Buildroot execution meets all the pre-requisites.\n+# If they are not met, Buildroot will actually do its job in a sub-make meeting\n+# its pre-requisites, which are:\n+# 1- Permissive enough umask:\n+# Wrong or too restrictive umask will prevent Buildroot and packages from\n+# creating files and directories.\n+# 2- Absolute canonical CWD (i.e. $(CURDIR)):\n+# Otherwise, some packages will use CWD as-is, others will compute its\n+# absolute canonical path. This makes harder tracking and fixing host\n+# machine path leaks.\n+# 3- Absolute canonical output location (i.e. $(O)):\n+# For the same reason as the one for CWD.\n+\n+# Current state:\n+CUR_UMASK := $(shell umask)\n+# Remove the trailing '/.' from $(O) as it can be added by the makefile wrapper\n+# installed in the $(O) directory.\n+O := $(patsubst %/.,%,$(O))\n+\n+# Buildroot requirements:\n UMASK = 0022\n-ifneq ($(shell umask),$(UMASK))\n+REAL_CURDIR := $(realpath $(CURDIR))\n+# realpath needs the entry to exists, otherwise an empty string is returned.\n+REAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))\n+\n+# Make sure O= is passed (with its absolute canonical path) everywhere the\n+# toplevel makefile is called back.\n+EXTRAMAKEARGS := O=$(REAL_O)\n+\n+# Check Buildroot execution pre-requisites here.\n+ifneq ($(CUR_UMASK):$(CURDIR):$(O),$(UMASK):$(REAL_CURDIR):$(REAL_O))\n .PHONY: _all $(MAKECMDGOALS)\n \n $(MAKECMDGOALS): _all\n \t@:\n \n _all:\n-\t@umask $(UMASK) && $(MAKE) --no-print-directory $(MAKECMDGOALS)\n+\t@umask $(UMASK) && \\\n+\t\t$(MAKE) -C $(REAL_CURDIR) --no-print-directory \\\n+\t\t\t$(MAKECMDGOALS) $(EXTRAMAKEARGS)\n \n-else # umask\n+else # umask / $(CURDIR) / $(O)\n \n # This is our default rule, so must come first\n all:\n@@ -110,30 +160,10 @@ comma := ,\n empty :=\n space := $(empty) $(empty)\n \n-# Set O variable if not already done on the command line;\n-# or avoid confusing packages that can use the O=<dir> syntax for out-of-tree\n-# build by preventing it from being forwarded to sub-make calls.\n-ifneq (\"$(origin O)\", \"command line\")\n-O := output\n-else\n-# other packages might also support Linux-style out of tree builds\n-# with the O=<dir> syntax (E.G. BusyBox does). As make automatically\n-# forwards command line variable definitions those packages get very\n-# confused. Fix this by telling make to not do so\n-MAKEOVERRIDES =\n-# strangely enough O is still passed to submakes with MAKEOVERRIDES\n-# (with make 3.81 atleast), the only thing that changes is the output\n-# of the origin function (command line -> environment).\n-# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)\n-# To really make O go away, we have to override it.\n-override O := $(O)\n-# we need to pass O= everywhere we call back into the toplevel makefile\n-EXTRAMAKEARGS = O=$(O)\n-endif\n-\n # Set variables related to in-tree or out-of-tree build.\n-ifeq ($(O),output)\n-CONFIG_DIR := $(TOPDIR)\n+# Here, both $(O) and $(CURDIR) are absolute canonical paths.\n+ifeq ($(O),$(CURDIR)/output)\n+CONFIG_DIR := $(CURDIR)\n NEED_WRAPPER =\n else\n CONFIG_DIR := $(O)\n@@ -1017,4 +1047,4 @@ include docs/manual/manual.mk\n \n .PHONY: $(noconfig_targets)\n \n-endif #umask\n+endif #umask / $(CURDIR) / $(O)\n", "prefixes": [ "v9", "02/11" ] }