Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2388276iof; Wed, 8 Jun 2022 04:03:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+yVExyAbRmftArz+cOQ8Xipq4dXCQRDlft3txKk2DQKdJCnRr8TcmobTT4Dhvat++p0dP X-Received: by 2002:a17:903:20d1:b0:168:93b6:a957 with SMTP id i17-20020a17090320d100b0016893b6a957mr3103331plb.156.1654686183664; Wed, 08 Jun 2022 04:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654686183; cv=none; d=google.com; s=arc-20160816; b=alMO0N2WLUD4w8wVTlgI/CexKSo+cCQZXRrvziKcd+PfMw9+nSPV4CXf0KoUBAbNO3 zQAyBB+BbhYJn/eDVH1NIIuSK1KxhgQH+y1R6NA2ICPxEbc07QYdoM0qZHAhYzOzkmaA sqd2Lcr6buDhQbLjNBzA71wukEFHeXoLgXCGGH3LHouqxRDwnhJ5grhBwLIW0mXUXGI7 hsczHk+rryL1IHq6uu0YB1/DhJco9se/iqbCbzv1AWVDlzFoiRQdusVguBQN2CVmTRTG 62ZLxOk7d58wQrIlo4AOjmV9bI6Zm9DbRdByWnnghyQ55gLeIMG3BCzM/MwWQlW1y0zN Cq6w== 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:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=24/6C8NEUmHevwxStKDk7F68KpU510+2fxKFIdAqq3A=; b=pN/eqQh//jrrXKTiYbu2tcWg6bvniC0U9hJAIypYtpTo+uen243SGrojNkosPCT7FP Jq3+bKOoqcbUZ+2l0OWzEdDdroj43erJd8vlHwmZgBPXiWGEkn4Epz/vaSKWjqawix3Z Dz5fO8Ml0+0XL2WFRwXORnRxA4rlE/xocVsiMLVGInrfrRJmXeibPUFG/0xcwG5Q8GWa 1TlFjy3DD10a/CbUTZn2lOKuJYPT9HpsdRXl8tARIQtE92TD8WSkdMj4qbJsg+mSsv/H eyBrzrtg86o2T24dYa3eUG2+sg4/hd5gnchlpifg/6C/skwUNj5jNa+57bHlbesWT0+L zzyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FuXTzy4G; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i70-20020a638749000000b003fe462deda3si456566pge.865.2022.06.08.04.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 04:03:03 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FuXTzy4G; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4984A297511; Wed, 8 Jun 2022 03:27:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236912AbiFHKZh (ORCPT + 99 others); Wed, 8 Jun 2022 06:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235886AbiFHKXR (ORCPT ); Wed, 8 Jun 2022 06:23:17 -0400 Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B47361FD2A7; Wed, 8 Jun 2022 03:12:52 -0700 (PDT) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 258ACbTK008028; Wed, 8 Jun 2022 19:12:38 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 258ACbTK008028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654683158; bh=24/6C8NEUmHevwxStKDk7F68KpU510+2fxKFIdAqq3A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FuXTzy4G/Vtp0qokhsvDdEdDoIMgvktmiD4JrTJuiPEGy3qK7miEgqSi+yVm2a1KZ Fyf4CGpKp4q36ewn/tIZxom5Gd1OT0+mKdKjPluDgalSG9zJ8lT+4gwFdqIotCnEqK xmFq6KNid/3rD0Dd5aC0+Z+TzcTHOeX1tJskqsRXzkmW5o2tE43qBB7YogmRXvj5dB y36knmmrwR87tfSFG6HS21YlE1SqhS2fzRmxNuvqyNBJxLMDLEkxmv8e/mUa8TFSNq 7PSg5+D0TcaVwc72M2JEY5mWaQ1fYEh0dZ/VaBOjx1HJcfTpLqjagiRBYaPs9mV3uB jIQsdoPzDoEsQ== X-Nifty-SrcIP: [209.85.214.175] Received: by mail-pl1-f175.google.com with SMTP id o17so17240022pla.6; Wed, 08 Jun 2022 03:12:37 -0700 (PDT) X-Gm-Message-State: AOAM530PFgGC86xgldMChdmEXJ1E7rpJvW7Uqwd3NWen4LN+A8Q4D1EG /Ox55tcPx5PAgXkiYT19Fh9figynrFzfE/RffPI= X-Received: by 2002:a17:90b:1d83:b0:1e2:f63e:bc37 with SMTP id pf3-20020a17090b1d8300b001e2f63ebc37mr55045802pjb.119.1654683157131; Wed, 08 Jun 2022 03:12:37 -0700 (PDT) MIME-Version: 1.0 References: <368129160298161a9eb40ad4f489458be6be3b6f.1654569774.git.kevin@kevinlocke.name> <05f8480125584a9caea029b9c3111ef4@AcuMS.aculab.com> In-Reply-To: <05f8480125584a9caea029b9c3111ef4@AcuMS.aculab.com> From: Masahiro Yamada Date: Wed, 8 Jun 2022 19:11:59 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: avoid regex RS for POSIX awk To: David Laight Cc: Kevin Locke , "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,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 On Wed, Jun 8, 2022 at 4:43 PM David Laight wrote: > > 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. $(sort ...) does two things, - sort the list alphabetically - deduplicate the elements in the list I want to do only deduplication without changing the order. > > ... > > # 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. Is there any difference if 'printf' were not built-in? Right, for bash and dash, yes, 'printf' is built-in, and we do not need to be worried about "Argument list too long", but I am not sure if we are able to cover all the systems. > But I think: > > cmd_mod = $(addprefix $(obj)/,$(sort $(call real-search, $*.o, .o, -objs -y -m))) >$@ > > will have the required effect. I think 'echo' is missing here. As I noted above, I do not want to change the order. > Without forking and execing multiple processes. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) > -- Best Regards Masahiro Yamada