From patchwork Mon Jan 13 18:03:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1222257 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=BLv3jFdD; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47xM0D5j3lz9s4Y for ; Tue, 14 Jan 2020 05:03:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5D3A820465; Mon, 13 Jan 2020 18:03:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1F-rgCQ6pZYB; Mon, 13 Jan 2020 18:03:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id D005C20458; Mon, 13 Jan 2020 18:03:36 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1C5EA1BF357 for ; Mon, 13 Jan 2020 18:03:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 13B7885ADF for ; Mon, 13 Jan 2020 18:03:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IWo320WrtW0z for ; Mon, 13 Jan 2020 18:03:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by whitealder.osuosl.org (Postfix) with ESMTPS id 32658855D3 for ; Mon, 13 Jan 2020 18:03:33 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id a5so10797140wmb.0 for ; Mon, 13 Jan 2020 10:03:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tWXKY/LwuzZd3FWswhMYj0yRhw/PacXpa7UU8GWi2j0=; b=BLv3jFdDwIsLKmUvvCfxcUCYYuO6eRm1U0GUspYyJu2EWMX41d6ge2pFrZB1Ks73RE UbXxphea91MHuMNKiftNSaHHrKx6eW/2Q2I9g7AR660fHe01r7004Y6NwzMY9ByJvVXZ vGAjDMu1WG/NoDi11Omm7G/jX9ImKAlW34Dc6YkSjmo1XFtshcuLIX+ZT8YgrRkMV7RW r2QKu1DTC1gwfONCxs40XBidOqMa9qS47lKldRamewL1NExHHc5YLZ9YQ970wcedBF/+ bMdneyLby4ilS6K0Ylt94IdBmpyhR2EIS+BIIQEkhn8IJG4t41HvpEA9dXS4PjPn4ZZN 3suw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=tWXKY/LwuzZd3FWswhMYj0yRhw/PacXpa7UU8GWi2j0=; b=otqQ9ORtPK9PGBrVEltt77ZByRjHgkLQh6UmlgnkW4OX10uQG1SXoshfFjcGfz3J6T wkQHLyaiVP+kcmR7G7MpXMFFY0If/X359jc2FJD+W8K0qOko3cpx7DYyXaVRoHjTjIUV ycyhbxhPhJn///DaLAsxTRz0XvrUjSdfe0ri2qgrlyABtiIM0hkuzruwP5sKL0iuFiAh gexGb+79VYx6lv2E7wiKOEaAAy55NNuAKEaH1LX49h9VjsJV1vkH99zTJEx2+S+pWI3H RA1i2ySsFYMro9ac0IrIKe3n6vxZYDPqOcWs8HzXwEPdSpb5v7of3oi3Y+7eiVRAChdd sPgw== X-Gm-Message-State: APjAAAUGVQleQsnEKse96tRXYVU3x4z6pecCOKJzsY2s8KUFyMQqfQrF MccMBKvXDnO/rmS+387MnnkT/X0u X-Google-Smtp-Source: APXvYqxQgIOxEDdoSsb69F6qvpreegeuDXdIe9bQahckRe2tL/O4Mmozlq/ZyD1DUmuJ6d/ZEqWATA== X-Received: by 2002:a1c:e289:: with SMTP id z131mr20705049wmg.18.1578938611413; Mon, 13 Jan 2020 10:03:31 -0800 (PST) Received: from scaer.home ([2a01:cb19:8b51:cb00:594d:b725:2487:1810]) by smtp.gmail.com with ESMTPSA id x10sm15743875wrp.58.2020.01.13.10.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 10:03:30 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 13 Jan 2020 19:03:22 +0100 Message-Id: <20200113180322.5618-1-yann.morin.1998@free.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/meson: fix shabang in deep build trees X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Matthias_Wei=C3=9Fer?= , "Yann E. MORIN" , Thomas Petazzoni , Jean-pierre Cartal Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The meson script includes the full path to the python interpreter. In deep build trees, this path can be more than 128 characters long, which is the limit a shabang might be. In older kernels, that was silently ignored, leading to potential bugs, but newer kernels enforce that limit, and refuse to execve() the script, returning with NOEXEC. Since the script is +x, the shell (any bourne shell, as well as the C shell) will conclude from that situation that they should interpret it as a shell script, which it obviously is not. Fix the problem bu replacing the shabang with a call to /usr/bin/env which will redirect to the correct pytohn3 interpreter found in the PATH. Note however that this means our meson installation can no longer be called from outside of the meson-package infrastructure anymore (not that we ever supported it before, but who knows what people may have done in their br2-external), unless one does set the PATH to include $(HOST_DIR)/bin/ earlier than a system-provided python3 would be found. Fixes: #12331 #12461 Reported-by: Jean-pierre Cartal Reported-by: Matthias Weißer Signed-off-by: Yann E. MORIN Cc: Thomas Petazzoni --- package/meson/meson.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/meson/meson.mk b/package/meson/meson.mk index d409ae7b52..179daaa38a 100644 --- a/package/meson/meson.mk +++ b/package/meson/meson.mk @@ -49,4 +49,10 @@ HOST_MESON_SED_CFLAGS = $(if $(strip $(TARGET_CFLAGS)),`printf '"%s"$(comma) ' $ HOST_MESON_SED_LDFLAGS = $(if $(strip $(TARGET_LDFLAGS)),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`) HOST_MESON_SED_CXXFLAGS = $(if $(strip $(TARGET_CXXFLAGS)),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`) +# Avoid interpreter shabang longer than 127 chars +define HOST_MESON_SET_INTERPRETER + $(SED) '1s:.*:#!/usr/bin/env python3:' $(HOST_DIR)/bin/meson +endef +HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_SET_INTERPRETER + $(eval $(host-python-package))