Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2034687yba; Fri, 17 May 2019 09:18:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5Vn/T5vs8uNwolcRuSG2CyVfg2PCUqavXjYnJOJdr89/iI+6twYdrAi0+BcrdijQ9VC7M X-Received: by 2002:a63:b90a:: with SMTP id z10mr16771133pge.257.1558109933160; Fri, 17 May 2019 09:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558109933; cv=none; d=google.com; s=arc-20160816; b=gclwVS8dOWhWaiHIShV6sAk3IQ3e1TsdpK2CKSYdqAU9ujVBmhfgmv78TJsuFz5mSw ZSW6fn+rFELGu4WDEIYzuuZRFwSX9h31Jgjh9tnnR70PDbEqMH/nACly7ThZfB29CE2B i4NahTKL9lijYtQmE5UeExDlRnKUuFjrlpK4LYa/WJRZ5++bZ2V3x5rwdhfwIiEIa4lD 7Uh9uhjtgH6qkRX+2ZoLFPGWFsg+BB3yoRTwZIQJ212z8Z9aPgjcMdM5zRkPUSlifesO o7G0ncZPzf6UyXC7pdjIonWUo0OJ2Y2mDVW2QQDIwJ5sBD4MrFi2+7D2tvXB0cFOwfFA Cyow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=201g0kbs2uB+GwEUpx//GJ+uGiu2C1BbNfc9wcMx28M=; b=do3M5lU358RBEL8Zrt7/OulQ1fZ6PpmnrS/m82KcKUXF0vhNJ3UPHNwjn1JCGf+tb8 99zrUdZ7vMD0XJRG4rxICgysPNi4zEVJtwnd7ijqW7KwQErXmREWvfwpYVfRlXohUQoz T+CxyyDH8ubUi/fkOeEDwfXTQ6oHyuRQBn5FL9h5bPO4RdYI6qckHuzheuf28FYAkAds reFKefqtXHYlM9pp76yielFlDhr7f1VOSPvgzIbWIyEcZZZsutcPz9M0RQnWVDfKAqod vnY4UdXY3kQqxbaOhEZHp09V1g7JJ8HjoHA5w6Z9tsI6x9dursstZLxb5SkB1FJK2tmz JfBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=daO9zMPt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si8169168pgo.525.2019.05.17.09.18.37; Fri, 17 May 2019 09:18:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=daO9zMPt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729340AbfEQP51 (ORCPT + 99 others); Fri, 17 May 2019 11:57:27 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:32540 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728664AbfEQP50 (ORCPT ); Fri, 17 May 2019 11:57:26 -0400 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x4HFvL9n027883; Sat, 18 May 2019 00:57:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x4HFvL9n027883 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558108642; bh=201g0kbs2uB+GwEUpx//GJ+uGiu2C1BbNfc9wcMx28M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=daO9zMPtTO1SudT852qzfFXT3zN1kX0AnlrMUt9bNXWbBbYbkGr6Bp6NDxrbHuIHx X/4J1e8+cQATiUnou+PuZ4jmwSMIP5OJFnGVnlrD6kOn3Ctt2fo22qEPJYYwKOe35o DxubPrHMzEI//dZzILv91GxM8H/Jzat7AGctFvqFDUgUou/UAUiqgMl07KWX6bk+zr dqVjgNTW05XspY4Q7YtIYAVKNb3Ubb8A6nwh8VeOSeSGXLwmgNI0598VHRNTGfLHIm WOJEJxBrissBxUkwhDbDtPSnYqTZSrnif84FOELRbi006LEtydsZhJ4nNmmcWUyPmC ebwprQ1qvJN3A== X-Nifty-SrcIP: [209.85.222.51] Received: by mail-ua1-f51.google.com with SMTP id n7so2856030uap.12; Fri, 17 May 2019 08:57:21 -0700 (PDT) X-Gm-Message-State: APjAAAVujX9Un6Cmn8ItI0jnfhOKzZwjn8S4lQ7Abj+gN01VJUZqthnJ 1h2xieeq/U1B/94/2QTZ0Ssng575JtMd/P7+FCk= X-Received: by 2002:ab0:3058:: with SMTP id x24mr24619043ual.95.1558108640471; Fri, 17 May 2019 08:57:20 -0700 (PDT) MIME-Version: 1.0 References: <20190517042753.25857-1-yamada.masahiro@socionext.com> <68270a84-966b-05e3-c82e-893c320febfd@petrovitsch.priv.at> In-Reply-To: From: Masahiro Yamada Date: Sat, 18 May 2019 00:56:44 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kbuild: check uniqueness of module names To: Alexander Kapshuk Cc: Bernd Petrovitsch , Linux Kbuild mailing list , Sam Ravnborg , Arnd Bergmann , Greg KH , Jessica Yu , Lucas De Marchi , Stephen Rothwell , Michael Schmitz , Linus Torvalds , Rusty Russell , Kees Cook , Michal Marek , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 17, 2019 at 6:25 PM Alexander Kapshuk wrote: > > On Fri, May 17, 2019 at 11:58 AM Bernd Petrovitsch > wrote: > > > > On 17/05/2019 10:16, Alexander Kapshuk wrote: > > [...] > > > The 'xargs' '-r' flag is a GNU extension. > > > If POSIX compliance is important here, the use of 'cat', 'xargs' and > > > 'basename' may be substituted with that of 'sed' to initialise > > > same_name_modules: > > > sed 's!.*/!!' modules.order modules.builtin | sort | uniq -d > > > > 's!' is TTBOMK also a GNU-extension: > > sed 's/.*\///' modules.order modules.builtin | sort | uniq -d > > It isn't. > Here's an excerpt from the POSIX manpage for 'sed', > http://pubs.opengroup.org/onlinepubs/009695399/utilities/sed.html: > [2addr]s/BRE/replacement/flags > ... Any character other than backslash or can be used > instead of a slash to delimit the BRE and the replacement.... > > > > > > 'Sed' may also be used on its own in the 'for' loop instead of as part > > > of a pipeline along with 'grep' to generate the desired output: > > > sed '/\/'$m'/!d;s:^kernel/: :' modules.order modules.builtin > > > > sed "/\/${m}/!d;s/^kernel\// /" modules.order modules.builtin > > The parameter expansion syntax is redundant here. > See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02: > The parameter name or symbol can be enclosed in braces, which are > optional except for positional parameters with more than one digit or > when parameter is a name and is followed by a character that could be > interpreted as part of the name. > > Here's an alternative version using double quotes. > sed "/\/$m/!d;s:^kernel/: :" modules.order modules.builtin Awesome! This is much shorter. I will use it in v3. Thanks. -- Best Regards Masahiro Yamada