Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2302835iof; Wed, 8 Jun 2022 01:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwopMTYecA/7Kp9v1v8f+/5hXSoCXOdjojXzavliWzS77Qwvdzutf0GkNhEtkOHX61wFCek X-Received: by 2002:a65:4304:0:b0:3fb:9303:de99 with SMTP id j4-20020a654304000000b003fb9303de99mr29714095pgq.429.1654678606517; Wed, 08 Jun 2022 01:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654678606; cv=none; d=google.com; s=arc-20160816; b=deSXhvoKGdEnLP6urvMk1CmtkA20UkLhu/8ZEDwpE2nxI1ecGVGp9b5k2ZUFYoNeRc nfVxx/RFnDR73JIdZH/RxWEsgt5OK4X8cGNaeLe/YSKGw/F4RUx7GbolKUW8+atbT/LQ XR0zK+iOk8RhycVbqSkuGMZbyFJIedP/75FL5q8BB2i4Qxy7PMu5FWzsTIwxMTjOaGOB CHeKVsK1VZ8iMabVkuimlWSQPUaEG1ZPQ+rl6QMbnJUwY+AKnnVW4vhip44uHBti6y63 JnNdFjAo/YDpjOvX3G4lNubaivsexMmcyXBLQqLuqaIoWJW5HH9FSYx8M1nDXiVgfTLa M5cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=mzB0jfxe0cCJbnkidxnyJbAMF6wYnj22HDKZ64bNe80=; b=uJ0/NCk3FqfABuVQBLopX2ViabvL8dzM6yS8ji1GUfursXhrw7com9Km0myJSNqfEm Rrj0oE/aU8qaDATuDIWKY9R967If1C0uYmOnif8ZACJFopv3hG26ho88I5svYVdjsbqw +YLdyINxXFpfVpOWQoqEarSbDvlWT256zOEHVFAnv+9inM8xG+F/+m/hBIdLNyqnpiJi t/mLy2UZqLMyg2fjEKHiGf6wDpLLMU3x/RD6s25xZPRzRyguIl9kbs2ADHAjTG1towJN WiIorKfgrv7l5D9Vo6yQKYg2zwEPhB3L+QEHV+0gEEyEoUp51NL/HoUa2uwDUdaGEDXA /3sg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s137-20020a632c8f000000b003fdbe9d3497si10048934pgs.459.2022.06.08.01.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:56:46 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E10933ED856; Wed, 8 Jun 2022 01:19:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbiFHIQZ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Jun 2022 04:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbiFHIPH (ORCPT ); Wed, 8 Jun 2022 04:15:07 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 75987353B34 for ; Wed, 8 Jun 2022 00:43:49 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-40-KvQNsg_GNi2gAmxjzgy3lw-1; Wed, 08 Jun 2022 08:43:47 +0100 X-MC-Unique: KvQNsg_GNi2gAmxjzgy3lw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Wed, 8 Jun 2022 08:43:45 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.036; Wed, 8 Jun 2022 08:43:45 +0100 From: David Laight To: 'Kevin Locke' , Masahiro Yamada , "linux-kbuild@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] kbuild: avoid regex RS for POSIX awk Thread-Topic: [PATCH] kbuild: avoid regex RS for POSIX awk Thread-Index: AQHYehnE8MyxlCD7vU+9QFA+5sTsgK1FIDcA Date: Wed, 8 Jun 2022 07:43:45 +0000 Message-ID: <05f8480125584a9caea029b9c3111ef4@AcuMS.aculab.com> References: <368129160298161a9eb40ad4f489458be6be3b6f.1654569774.git.kevin@kevinlocke.name> In-Reply-To: <368129160298161a9eb40ad4f489458be6be3b6f.1654569774.git.kevin@kevinlocke.name> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: Kevin Locke > Sent: 07 June 2022 03:43 > > In 22f26f21774f8 awk was added to deduplicate *.mod files. Can't this be done with gmake's $(sort) function? $(sort list) Sorts the words of list in lexical order, removing duplicate words. The output is a list of words separated by single spaces. ... > # 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) }' > $@ I think the above only works because 'printf' is (usually) a shell builtin - so the kernel's argv[] limit doesn't apply. So the comment isn't really right. But I think: cmd_mod = $(addprefix $(obj)/,$(sort $(call real-search, $*.o, .o, -objs -y -m))) >$@ will have the required effect. Without forking and execing multiple processes. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)