Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5315243rwd; Sun, 18 Jun 2023 09:03:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6XJEDvZ5LHKOXOzzZzrXftWQnm2lZPyIFMR2xDBtDqi5X6eFP6ByLuFpf/r93SjvsL50jG X-Received: by 2002:a17:90a:c08b:b0:25e:83a7:abab with SMTP id o11-20020a17090ac08b00b0025e83a7ababmr4201823pjs.8.1687104203457; Sun, 18 Jun 2023 09:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687104203; cv=none; d=google.com; s=arc-20160816; b=l8N63vjnq7oT05OWhBs70BmnVrqqqFwLKGN1QRgj5Lw3JVAffsgKo9m+OQ80J/NVl0 iOOZ/iuR5Kz1jXRq3MWwVtldyFM4FJphozWiz/+kF3L9/9uoB0LOcynby9eQLmN+6B9f CQ7zcgXx94R7YawXC+J+F/h9X5tX1D+4n81tjmlUIlP9P3xiRjwzuK830r6fG3Pel8Xm YFujZMv7pRSdmmpMSQJlXjd4sVcmYyxhpTTmLp2DjK7ACXzvNUvo2lDRajuUE0cEDRRl gBF0Nr3aGcfzUBn81OYgeYYOwgMnBZA7v4242nR6RslJQMSXCG7Rwe078W8V7O4IBRRO 4YWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZNQCDXziIIX31Iwz2ftqH6AZLU86GrYt6Q074lVHLiw=; b=gy6OQRkSt1FYBlWcmjkGVdi4EPBp0deRoL6Kj5B2mn2BWE2Ro1e3RVavxIUIYEa1bf 62skED/zkRrElYMnmsoKA38eTY3vAFSImKvgokgpz8TW6y4uFewZk+qxxfzk21bSK5cQ 7mGACj2+HriYAklfpzZ6ZsMXD/ma+5RW8Va+dgWU92nEa/68nIMwoPlJozwxWJftTc7o V1Te5wsWniO9pyACGzBpkOL8XykOK/Y0ENlzyL7fZCTniPtTHlMmv6UjskQ3oFslcKZd 7lQCCSLaCxWv3QmC/6FeVhCAETCoX7iIIHSodu6jeyjA2VWtG1lhLiFtkSoDJg0b8D3r mRiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MEIBUVXD; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q72-20020a17090a1b4e00b0025e2c7b1808si5847515pjq.53.2023.06.18.09.03.10; Sun, 18 Jun 2023 09:03:23 -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=@kernel.org header.s=k20201202 header.b=MEIBUVXD; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbjFRPv3 (ORCPT + 99 others); Sun, 18 Jun 2023 11:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjFRPv1 (ORCPT ); Sun, 18 Jun 2023 11:51:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24F01E4F; Sun, 18 Jun 2023 08:51:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B19F460BC5; Sun, 18 Jun 2023 15:51:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14FD1C433CA; Sun, 18 Jun 2023 15:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687103486; bh=V3ot2K88MpwMz51CvN4r3BLcrOzGzi0eMF77QypVbpU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MEIBUVXDFCisCsR4stQQrmNAk+Y7E+e470RA1B3CGZVf8ZTpQwyivA+pZML+i7Fux ItlxQNrbqTYdIVuVlqeuxzkd2txTUE2j97ZcytTVUqyC0NnWCSAfC1CMcjQUWqwkQt b11LXV0LTfJDszA/SzUhoKRt2WwKB0pEiXc3KKnOCgMoP24HFZ8n4QnzHSCvnDEVL6 70vLvgzdygQ2LmIiqNiMOIrS4y5BBFJ44bVzzaGLf1NviIwe4w1DbDcnDAeI/d5hhk NfSBoAmEtbXsAqNqil84CSCiu4oXHZUO1FPImn1VHp96FtF6QDinwvI5WDuBeKrpuZ lxwxObwxgeh+Q== Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-55a35e2a430so1687568eaf.0; Sun, 18 Jun 2023 08:51:26 -0700 (PDT) X-Gm-Message-State: AC+VfDyjjeoJdFicOPGM3NHbwEXnH7ZxmUF/+WE6JmzowABgsKpBUwQ4 MehOh4WXuqDaijco/GNuwUDV7MIa7l09qf6LqfA= X-Received: by 2002:a4a:eb86:0:b0:55e:14a2:e99f with SMTP id d6-20020a4aeb86000000b0055e14a2e99fmr4104465ooj.9.1687103485326; Sun, 18 Jun 2023 08:51:25 -0700 (PDT) MIME-Version: 1.0 References: <20230617153025.1653851-1-masahiroy@kernel.org> <20230617200700.GA31221@lxhi-065> In-Reply-To: <20230617200700.GA31221@lxhi-065> From: Masahiro Yamada Date: Mon, 19 Jun 2023 00:50:48 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: make clean rule robust against too long argument error To: Eugeniu Rosca Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Eugeniu Rosca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SORTED_RECIPS,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 Sun, Jun 18, 2023 at 5:07=E2=80=AFAM Eugeniu Rosca wrote: > > Hello Yamada-san, > > Many thanks for your feedback and for your patch. > It indeed addresses the issue I have reported in [1]. > > On Sun, Jun 18, 2023 at 12:30:25AM +0900, Masahiro Yamada wrote: > > Commit cd968b97c492 ("kbuild: make built-in.a rule robust against too > > long argument error") made a build rule robust against "Argument list > > too long" error. > > > > Eugeniu Rosca reported the same error occurred when cleaning an externa= l > > module. > > > > The $(obj)/ prefix can be a very long path for external modules. > > Confirmed. I am seeing an instance of $(obj) being 150 characters long, > due to an out-of-tree module deeply buried in a specific Yocto build. > > In the current vanilla version of 'make clean' (w/o this patch), the > $(obj) prefix is applied to each and every file being removed, > dramatically increasing the strlen of arguments passed to 'rm -rf'. > > > > > Apply a similar solution to 'make clean'. > > > > Reported-by: Eugeniu Rosca > > Signed-off-by: Masahiro Yamada > > --- > > > > scripts/Makefile.clean | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean > > index 3649900696dd..235408a44f90 100644 > > --- a/scripts/Makefile.clean > > +++ b/scripts/Makefile.clean > > @@ -37,8 +37,9 @@ __clean-files :=3D $(wildcard $(addprefix $(obj)/, = $(__clean-files))) > > > > # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > > > +# Use xargs to make this robust against "Argument list too long" error > > Please, correct me if I am wrong, but it looks like the magic/brilliance > is in the 'patsubst' function, since below version also fails for me: > > NOK: cmd_clean =3D printf '%s ' $(__clean-files) | xargs rm -rf Right. Now, 'printf' (instead of 'rm') failed with the too long argument list. GNU Make does not have the length limit, but shell does. So, the full-path list must be passed via stdout instead of the command line. The comment might be confusing. I will repeat the same comment written in scripts/Makefile.build: # To make this rule robust against "Argument list too long" error, # remove $(obj)/ prefix, and restore it by a shell command. --=20 Best Regards Masahiro Yamada