From patchwork Wed May 9 17:59:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 911068 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.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.b="jFuhHq6J"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40h3yz26hjz9s2t for ; Thu, 10 May 2018 03:59:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E8E0586F86; Wed, 9 May 2018 17:59:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ifwq49jncjIt; Wed, 9 May 2018 17:59:34 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2B61986F3C; Wed, 9 May 2018 17:59:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id D67411BFF8E for ; Wed, 9 May 2018 17:59:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D35AA22070 for ; Wed, 9 May 2018 17:59:32 +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 OewNqc3WMwVl for ; Wed, 9 May 2018 17:59:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by silver.osuosl.org (Postfix) with ESMTPS id D992421FA9 for ; Wed, 9 May 2018 17:59:31 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id y189-v6so11281096wmc.3 for ; Wed, 09 May 2018 10:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=QTGJ1FKGQG0Iqdr5P5LDKDthfKWZipgd4u/okwEGZas=; b=jFuhHq6JY9M6LpuJ5nP+DBqMxGJcXzT0BTH2h+Au5f7tlEZ/BaOSxllbY0JLFm3oQY fetBJGbEknb0mKWcfTBwGkbrCcaP2ojf+ZT1gfJYghMLPfvazxNA7PbwJmBMOzga/iq1 DChqyNV+0beMv00NFdEMC/jjTBpFI6MAxxB4l9pCfJLKa7Y/hJXt5cRJAnI5VZFhHQk0 mdNdeYcydyfYstz8bmRpkttYOuGqD9G5cKDJacmbytPQ9Y1wWbz9de+CpDMyi8rnjCPk uT/NP93Q1XgG67W73vyx74hp58JIph1h8h0qs2HI3Dus9jHcko49eC9F4UIay3X0qpEU ILXw== 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; bh=QTGJ1FKGQG0Iqdr5P5LDKDthfKWZipgd4u/okwEGZas=; b=GUQD6yhnhKfLedoVnn+wDjKQnax0bq5BYAG2WN7sm96zc4uslq9HvQTfzwqoD6hm2K XNyHsKaiyTwhFYjVPa2R0MrCAM7JO2nA9IUf9CS/2lpZ3KdoHAFG+wa6tFIWaSFjkw4e nI4jIy85e/f48tmY3T0ODfRYrj/hi3Od9o7VuDUnzdsCutlt9iW8dcHBLN/ZWvCcwZYJ Q8JjjdEZ0b6Bo/+9RMxbqyuK1J5yn6zhx7SuVcFoviN5TvFl1AluErUlId/JQiBcRI3P CemeG6xqz2ig/n8X4EstAMxaavFvsiF434dUEWClhP2PsYvXulIEffWP8KVYYtBh0+Gh GFGA== X-Gm-Message-State: ALKqPwf2ZoFfKb6oCyild+tlcW3Hkk/lygtTmdlfKQtYE94zcVKBS91o uQHFqzQfKIjZDPPsJjLVHNE/9A== X-Google-Smtp-Source: AB8JxZqQhtyDZ+r340xxXJZOyFeBQNHM0sGdBQBr4q0BCQJOs9Vp8vM0KJ9iZS7h8gbDu8I4ipwFDw== X-Received: by 2002:a1c:4ad9:: with SMTP id n86-v6mr7223140wmi.0.1525888770013; Wed, 09 May 2018 10:59:30 -0700 (PDT) Received: from scaer.bzh.lan (2a01cb0886107300a41dbb3001050334.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:a41d:bb30:105:334]) by smtp.gmail.com with ESMTPSA id l37-v6sm48075976wrl.83.2018.05.09.10.59.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 10:59:29 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Wed, 9 May 2018 19:59:24 +0200 Message-Id: <20180509175924.10867-1-yann.morin.1998@free.fr> X-Mailer: git-send-email 2.14.1 Subject: [Buildroot] [PATCH] support/dependencies: check that PATH does not contain CWD X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" ... and simplify the test code for PATH and LD_LIBRARY_PATH. Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni --- support/dependencies/dependencies.sh | 59 ++++++++++++++---------------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh index 985b1d863b..f98678973b 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -11,27 +11,30 @@ if test $? != 0 ; then exit 1 fi -# sanity check for CWD in LD_LIBRARY_PATH -# try not to rely on egrep.. -if test -n "$LD_LIBRARY_PATH" ; then - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep '::' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start:' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':TRiGGER_end' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 || - echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1 - if test $? = 0; then - echo - echo "You seem to have the current working directory in your" - echo "LD_LIBRARY_PATH environment variable. This doesn't work." - exit 1; - fi -fi; +# Sanity check for CWD in LD_LIBRARY_PATH +case ":${LD_LIBRARY_PATH:-unset}:" in +(*::*|*:.:*) + echo + echo "You seem to have the current working directory in your" + echo "LD_LIBRARY_PATH environment variable. This doesn't work." + exit 1 + ;; +esac -# PATH should not contain a newline, otherwise it fails in spectacular ways -# as soon as PATH is referenced in a package rule -case "${PATH}" in +# Sanity check for CWD in PATH. Having the current working directory +# in the PATH makes various packages (e.g. toolchain, coreutils...) +# build process break. +# PATH should not contain a newline, otherwise it fails in spectacular +# ways as soon as PATH is referenced in a package rule +# An empty PATH is technically possible, but in practice we would not +# even arrive here if that was the case. +case ":${PATH:-unset}:" in +(*::*|*:.:*) + echo + echo "You seem to have the current working directory in your" + echo "PATH environment variable. This doesn't work." + exit 1 + ;; (*" "*) printf "\n" # Break the '\n' sequence, or a \n is printed (which is not what we want). @@ -41,22 +44,6 @@ case "${PATH}" in ;; esac -# sanity check for CWD in PATH. Having the current working directory -# in the PATH makes the toolchain build process break. -# try not to rely on egrep.. -if test -n "$PATH" ; then - echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 || - echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 || - echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 || - echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1 - if test $? = 0; then - echo - echo "You seem to have the current working directory in your" - echo "PATH environment variable. This doesn't work." - exit 1; - fi -fi; - if test -n "$PERL_MM_OPT" ; then echo echo "You have PERL_MM_OPT defined because Perl local::lib"