Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1806804iol; Fri, 10 Jun 2022 15:46:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG4vH5UHSN7Cz0+AsOCzt53PRjbaoEMNQ461sBgTCyimDWYYK3p3b8OVcpFYVx7QSV5JwM X-Received: by 2002:a17:903:22cb:b0:167:992f:60c3 with SMTP id y11-20020a17090322cb00b00167992f60c3mr20461754plg.59.1654901168817; Fri, 10 Jun 2022 15:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654901168; cv=none; d=google.com; s=arc-20160816; b=adhqnLcos4xLmbfPJU6oY4Q3BobVQRLPQz9N3B2oh6EqVKwYB9T4KqtlT+FcksnCrp Q++Z2fZop9BMTioX+z6kQ3FnZsAzobbqu1rPWH99oX25QeV2QeLCCcdpgiE4uj94LbM5 LMnhlMYrPuNFEKlgYWaYq8OubtxBnNEb0Rk5m8sXWsWqECBvQXV0SWW1W50oghYZxya+ aY7BUGPj3/GMnWFcxmbXwGcFesYZ8LKBHSBXEhMnFEOxSWFCbHuoypTbvyjLhUjOiuH4 Cxij+Q0W9hg6BjyzDrPw1ayt8a0+CuckkjtIWf9cgbq9kQebMQ8om0URNpuGUemEwqRN 32AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Jlsqq7ENvzaBFmYrM2EurpWQmALPa/xYxdqi5jsfiWY=; b=JNmXQVP5AZEapPhSoy2cTZz9I2WW4kN0QSD41ccVHSU1VheNe63av28z/ldzys58tu i2Has3JSnZd3ewlumCHyHk9/YQSPofEHS69PZGZqSgGdr80A74GwJ3Yr74tRSx01I7hd 5CIkGh5/RQ4e2XrwD2qOYHZ7NNCOcMY2u0xaY6MfTJmrnaERsnlqzus9Xc3DzKYFDnYG Dh/hSqEgGocMetHUFxZLjME+jR+G4xkQl3hpihIlOXwiu7iDjisem9covd5/xZ/kyDYB 645J6ibD/dfDpr+Ks3xNvSo0HMIIN+oW318IbldjooRdFK/CLMbqt/iey4ArJ+kROXKa FqSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@pqrs.dk header.s=google header.b=CXF+NeUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc14-20020a17090b1c0e00b001dc40c6c7besi498068pjb.53.2022.06.10.15.45.56; Fri, 10 Jun 2022 15:46:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@pqrs.dk header.s=google header.b=CXF+NeUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350886AbiFJVfM (ORCPT + 99 others); Fri, 10 Jun 2022 17:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350668AbiFJVfK (ORCPT ); Fri, 10 Jun 2022 17:35:10 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5DE59966 for ; Fri, 10 Jun 2022 14:35:07 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id gl15so433818ejb.4 for ; Fri, 10 Jun 2022 14:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jlsqq7ENvzaBFmYrM2EurpWQmALPa/xYxdqi5jsfiWY=; b=CXF+NeUoCyYJUvbNACNtBhwGfBuGl/3hLER61cBCZPQ7uXOUZldZy83nBEMs77hhqN BL6+m5kaNZ3H4xImv0ykiTvblGE1e4GBPCsiobg0vr192yJdFpOOfQxu6BahlTTHi2mk N5j3FUWMqS/DwNSBh0ARdPbBjd9Cyiy/usgR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jlsqq7ENvzaBFmYrM2EurpWQmALPa/xYxdqi5jsfiWY=; b=JOCUV3gB8W0g3i1zNnCbJuSFaSRvqRLL/FHi6SYMwylHZtz7mtRGb3a09fcpoPy3BY bKzt9rFXNnzFUAAhMXmNRZOzliYWa2+R0zZ63/G4btd4hmtVREjXbDQx16YbxrT9LGpN Nm6IIeXEvTGYy8Y7iJ70T46gRblhqW00tBzgmUOlaJ/vPvllQ2RBSvF/EUN4An5jsFFA pm6sCSqoiZkrPqZD1O7wEnyjprH/HFDqZ89u1ELVxaSW2ikLtBDjYUeV/1+uycZ05c2/ 78sTMJgKVTAyF4FqKkIFRJhaZrfIOpEFw25o+dkas7aO2AgQOZkiZ62zBkMpkEsrMJdb qVsw== X-Gm-Message-State: AOAM530Tl//btCnBsYSNpZcOO+fFTeDIoV3+1mO5qlPoPELhtcSr+ms/ U8R/tMQAu3vrNgpC1utqkRTX+w== X-Received: by 2002:a17:907:868c:b0:6fe:fd7a:e0d7 with SMTP id qa12-20020a170907868c00b006fefd7ae0d7mr41997149ejc.90.1654896905963; Fri, 10 Jun 2022 14:35:05 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id f16-20020a170906085000b006fec4ee28d0sm80783ejd.189.2022.06.10.14.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 14:35:05 -0700 (PDT) From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= To: Nathan Chancellor , Nick Desaulniers , Tom Rix , Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, =?UTF-8?q?Alvin=20=C5=A0ipraga?= , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] kbuild: use a pipe rather than process substitution Date: Fri, 10 Jun 2022 23:34:52 +0200 Message-Id: <20220610213453.630304-1-alvin@pqrs.dk> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alvin Šipraga Bash process substitution of the form `foo < <(bar)`, as found in scripts/check-local-export, can cause issues in chrooted environments and with tools such as pseudo. The blamed commit started to cause build errors for me when using the Yocto project's devshell environment; devshell uses pseudo internally: .../scripts/check-local-export: line 51: /dev/fd/63: No such file or directory Replace the process substitution with a simple pipe into the while loop. This is functionally equivalent and more portable than the former. Note that pipefail is enabled so that the script terminates when ${NM} fails. Link: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13288 Fixes: 31cb50b5590f ("kbuild: check static EXPORT_SYMBOL* by script instead of modpost") Signed-off-by: Alvin Šipraga --- scripts/check-local-export | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/scripts/check-local-export b/scripts/check-local-export index da745e2743b7..42de6f8f2541 100755 --- a/scripts/check-local-export +++ b/scripts/check-local-export @@ -7,12 +7,24 @@ # EXPORT_SYMBOL should be used for global symbols. set -e +set -o pipefail declare -A symbol_types declare -a export_symbols exit_code=0 +# If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) +# shows 'no symbols' diagnostic (but exits with 0). It is harmless and +# hidden by '2>/dev/null'. However, it suppresses real error messages +# as well. Add a hand-crafted error message here. +# +# Use --quiet instead of 2>/dev/null when we upgrade the minimum version +# of binutils to 2.37, llvm to 13.0.0. +# +# Then, the following line will be really simple: +# done < <(${NM} --quiet ${1}) +(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } ) | \ while read value type name do # Skip the line if the number of fields is less than 3. @@ -37,21 +49,7 @@ do if [[ ${name} == __ksymtab_* ]]; then export_symbols+=(${name#__ksymtab_}) fi - - # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) - # shows 'no symbols' diagnostic (but exits with 0). It is harmless and - # hidden by '2>/dev/null'. However, it suppresses real error messages - # as well. Add a hand-crafted error message here. - # - # Use --quiet instead of 2>/dev/null when we upgrade the minimum version - # of binutils to 2.37, llvm to 13.0.0. - # - # Then, the following line will be really simple: - # done < <(${NM} --quiet ${1}) -done < <(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } ) - -# Catch error in the process substitution -wait $! +done for name in "${export_symbols[@]}" do -- 2.36.1