Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2788545iof; Wed, 8 Jun 2022 12:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlDj0Qe7N06V8LBeiL/1CArFMPOBwigoqLfzDr5WVJPAxrPcrhY+LJeoBjQGmLYkxFjJAt X-Received: by 2002:a05:6402:2750:b0:42e:3d52:d270 with SMTP id z16-20020a056402275000b0042e3d52d270mr33804378edd.332.1654715000914; Wed, 08 Jun 2022 12:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654715000; cv=none; d=google.com; s=arc-20160816; b=YrVQuwLdMQMiuNxtbDMwhuf/rtVKiBvm7S6fv/msxvy/xrgPEHT3g7OOyhgAkxDjju fq+cQ4TspheuwNiyOAJa8VfjXUNl/qOh96o30i98jU3GJgEONO8rmYQksnnMSICT4NI+ hJsHZkBEx36N5tkrfjItnaPraGOxhh26aGeWTvpgCYZA0hmgxApFPQEAi+hdC6YYqv2J AOCdtn9MV8mGujxw+XTH+9ckpgH2b3mgyRFpLU4ymjCv8OnJYMYpCAPpW1DawJOAgvOi FfyMB/1O1vfGdFDA15Z0oB5LuOePZxMuUXu3n23KVXor4SJnPnCLLulhZjvBF9ZSJK61 x9+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=tNp7Xl2ONrziHqUHN3+KG6+K6ACxMxBGEDZRaVtiLTM=; b=Enbs03h4oqyzlUF8OAuWz/FqejLlEh5EhJrKtq4jcNlVeeOSr5afENmJDBcSvt/Lhm ID/q1+Y88e5ifRWw9uZfq01rKy5rBYBLbnui7wIvtY05R6vUNE8zghvmkPLbNGJIQJzi ldfrP4FUMcPd8FSYpGy7KmYFmUdGHz+PRmvl8Bu/A/AH3O5BZOCDj98xFIZucuoGvM1i MjZ5eBFIEroxpW9WZarMY7VNRBPTT5J3QRMDJa3JCkmz0Q5sNhTHkDnZlLH8hWqFuayB Vn8mkUVFtnnSl9YJd/gVWO/sPZt+Ed8ao6GOihqBcpkuUuDkh1K7VCR98GzKIrmEbmrP nLNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=a0WGY7pQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a170906014700b00712018edf25si358027ejh.687.2022.06.08.12.02.54; Wed, 08 Jun 2022 12:03:20 -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=pass header.i=@gmail.com header.s=20210112 header.b=a0WGY7pQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbiFHS72 (ORCPT + 99 others); Wed, 8 Jun 2022 14:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233318AbiFHS70 (ORCPT ); Wed, 8 Jun 2022 14:59:26 -0400 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67C9C3BBF5; Wed, 8 Jun 2022 11:59:23 -0700 (PDT) Received: by mail-io1-xd2b.google.com with SMTP id n144so6814659iod.4; Wed, 08 Jun 2022 11:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=tNp7Xl2ONrziHqUHN3+KG6+K6ACxMxBGEDZRaVtiLTM=; b=a0WGY7pQV78GAPPNOoarbrKvv7WINsDSERS1fqq5UgLMq08+sgzqzn07+h0aeSZ6q/ 0ZKXzXAmt3MPxgUgIzAq3lNkrRor9WRQvHAlBmheIg7tcU7SPknO7gJcCn2p0T+Corg0 thumiRq31tj4NczQLAUSmkZ7EHQb938f+O88bHiTQd+72vVZAyrnvqHQJ91w1UsaiYRb NjgYOdfLNvkWBCrZWUuKWMaFYQrwJ56hDLlzkT2T+7ubq8RiQzLNwjfjcjUBIHwbRYz1 yf/Y/bKDiWCFC0hI0+eUiLNUE+9iNwt0xgrzNg9/7fZ0WP9DfQFC3gaowf2fBdZ+VOg3 q8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=tNp7Xl2ONrziHqUHN3+KG6+K6ACxMxBGEDZRaVtiLTM=; b=79PlYE2meb+4OCFtjYPpBVnHgNfkOuM0Vc6GBGwLkhnWJjSo34wIUTIdfJ0NMS4E+w 9crTrEzvE+cxit4VBhX3bh+2HTT1xZT8s5X/VN1WW8uTuRV9+96AEkn2cdbNbbmymA30 0/uaXCcfj6+8KLQS2Zd3x7fA4oVA/yYuNG+cYXtrRcMuJo9m4fW/m5b3hTZ1vV9qtrhD zuNUVYzjPhSlPLw6Eo63xRT7smGHYXETFD8o+hrKTOi2shNHM1sSVN0f6Z/RH79uW+KF HGcbTq70JXk1SGtiXzM2ilLiBqeYnxs2GkJ5ooCtKBZrOAS1waxO7pRqmmJPUxSuyliI eJ5w== X-Gm-Message-State: AOAM5328RKLIXVdqJl49PCOi+mfSa/ae1BPEfrMAl/CoZRtOhZfWekkQ MucC2dGFghknnX+9fVGk+uHzww53sim3EvUPIYu350ZSahs= X-Received: by 2002:a05:6638:1415:b0:331:d318:83ab with SMTP id k21-20020a056638141500b00331d31883abmr4969324jad.126.1654714762766; Wed, 08 Jun 2022 11:59:22 -0700 (PDT) MIME-Version: 1.0 References: <368129160298161a9eb40ad4f489458be6be3b6f.1654569774.git.kevin@kevinlocke.name> In-Reply-To: <368129160298161a9eb40ad4f489458be6be3b6f.1654569774.git.kevin@kevinlocke.name> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 8 Jun 2022 20:58:46 +0200 Message-ID: Subject: Re: [PATCH] kbuild: avoid regex RS for POSIX awk To: Kevin Locke Cc: Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Tue, Jun 7, 2022 at 7:31 AM Kevin Locke wrote: > > In 22f26f21774f8 awk was added to deduplicate *.mod files. The awk > invocation passes -v RS='( |\n)' to match a space or newline character > as the record separator. Unfortunately, POSIX states[1] > > > If RS contains more than one character, the results are unspecified. > > Some implementations (such as the One True Awk[2] used by the BSDs) do > not treat RS as a regular expression. When awk does not support regex > RS, build failures such as the following are produced (first error using > allmodconfig): > > CC [M] arch/x86/events/intel/uncore.o > CC [M] arch/x86/events/intel/uncore_nhmex.o > CC [M] arch/x86/events/intel/uncore_snb.o > CC [M] arch/x86/events/intel/uncore_snbep.o > CC [M] arch/x86/events/intel/uncore_discovery.o > LD [M] arch/x86/events/intel/intel-uncore.o > ld: cannot find uncore_nhmex.o: No such file or directory > ld: cannot find uncore_snb.o: No such file or directory > ld: cannot find uncore_snbep.o: No such file or directory > ld: cannot find uncore_discovery.o: No such file or directory > make[3]: *** [scripts/Makefile.build:422: arch/x86/events/intel/intel-uncore.o] Error 1 > make[2]: *** [scripts/Makefile.build:487: arch/x86/events/intel] Error 2 > make[1]: *** [scripts/Makefile.build:487: arch/x86/events] Error 2 > make: *** [Makefile:1839: arch/x86] Error 2 > > To avoid this, use printf(1) to produce a newline between each object > path, instead of the space produced by echo(1), so that the default RS > can be used by awk. > > [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html > [2]: https://github.com/onetrueawk/awk > > Fixes: 22f26f21774f ("kbuild: get rid of duplication in *.mod files") > Signed-off-by: Kevin Locke Tested-by: Sedat Dilek # LLVM-14 (x86-64) -Sedat- > --- > scripts/Makefile.build | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 1f01ac65c0cd..cac070aee791 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -251,8 +251,8 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE > > # To make this rule robust against "Argument list too long" error, > # ensure to add $(obj)/ prefix by a shell command. > -cmd_mod = echo $(call real-search, $*.o, .o, -objs -y -m) | \ > - $(AWK) -v RS='( |\n)' '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ > +cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \ > + $(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ > > $(obj)/%.mod: FORCE > $(call if_changed,mod) > -- > 2.35.1 >