Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4902466rwb; Tue, 17 Jan 2023 06:58:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1u457b6sElC4W9LKPg9Mx9mX5MeH0e0mHceRLZzqQngWh6gNcJsJcZ0aPdAlFqJEWtLqq X-Received: by 2002:a05:6402:201:b0:47e:eb84:c598 with SMTP id t1-20020a056402020100b0047eeb84c598mr2919011edv.30.1673967538235; Tue, 17 Jan 2023 06:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673967538; cv=none; d=google.com; s=arc-20160816; b=lXOwDvhOBM3ZNVgaWYS17HStT73omSG31X04vxPe6kouOp/qjcDEhwZCcdV1XE5x5v fdXmo4D5At7U2JmhpOWxmhRZVloH6QTvXjblLvPxKCOJrEq3f65wnFIxWwFbGUwPHFLT Ku7tdLmHpnRb9lmSJGpTzU8mrupeUI/6Wy0SrUbdH0+mDxAfXIQ7WxX9YKNCplxrwzh+ qCdrQmn9GFzsiUavnRgS1HZXaSiSyCqcpadKLNZK6GgvfM7JEesg6MvgFwXCK2PVfgOz oJAk+sOlMs+6xhAEC62ra9bTTa2t0ThhuHEqsieUTOboEm0FlajvAdEzr0PeJ2/5zL+b jSKQ== 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=gwGbVWv9+rcQ50L461RXrHTO3h2EaC9jt7Gxe7N8JIs=; b=m/1ReF1th5rZiv/n5ktWHVBlXR1q3Xy3NjIGdpuLrM6M4YjdyQw2oNZfB9MiJqJRE3 e5AzjnpjltwhW+K+9twAhRh+ofHept/5G/Nsgr4PBtE6Ntufd+0U5YDFYwuvLAdjuiZR emvnfgTza1BR3aEq8iCf5okMFjvIm6LQiNMboYW9gQbDkWntXrOzlWG8U7xT7CI7Gfxz HIqqrioVsMlp0XYJjZUBstDk7NKigUNvQoiEAXThlosIFah7mqMErFnpiEoEdUJYjOvL sBEhUYWweQiuutFsV5UR725fHJBi0GmbcFxv2W2YT4nbr0/vZN/mFC1NtEAKL9k8FdrX KpnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzGqPT+r; 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 ey7-20020a0564022a0700b0049216736fd2si3623772edb.542.2023.01.17.06.58.46; Tue, 17 Jan 2023 06:58:58 -0800 (PST) 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=QzGqPT+r; 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 S232686AbjAQOe2 (ORCPT + 48 others); Tue, 17 Jan 2023 09:34:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbjAQOeL (ORCPT ); Tue, 17 Jan 2023 09:34:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BFF3C2A3; Tue, 17 Jan 2023 06:34:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86ECFB81112; Tue, 17 Jan 2023 14:34:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 392C2C433F1; Tue, 17 Jan 2023 14:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673966047; bh=hCDrOLdb+rE+r1D0INnM9e1g81qWnJBWV0FvTqnhAwg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QzGqPT+rzcyjOvQ/ULH/oxFdXIWTZqhtB09ZocEk3ckyorQlCrTISaYcXWDRG7Qh7 xLWqndt8dCq17m8/VptTrczyG49mI4xhJYLv2aJcwvPV4VJ5zuVPPbXjEO1k6hiu8N 008jv8DpWzOlag9PCNmdgK0Wi0kDF3IkjJ7yU0KfBO0Elhuxsn1OnAMQGoNmFIan2I T741wDav/mjzyrRbySRPkawOIohAGuupo9ETgjnpVyQA1mMX9L7UYC9n90xX42uE5I SkyNXKiAV+Ef2M9Q8fL57EcuspbIf23Tt19MZUx9EuXmpzBnTGz6tbBLeOwH/9dvAS 2kt5NqOjEZ3dw== Received: by mail-oi1-f177.google.com with SMTP id v17so4690869oie.5; Tue, 17 Jan 2023 06:34:07 -0800 (PST) X-Gm-Message-State: AFqh2kqyKFsVA9iAMUESDZq6348VkhpxKw9sOGMlRQTZNLrDxQJ5xtsz 4tLmPdozAZFouS885FTc4DcsJNnhCFLsy5xzPbc= X-Received: by 2002:aca:acd5:0:b0:364:5d10:7202 with SMTP id v204-20020acaacd5000000b003645d107202mr143711oie.194.1673966046471; Tue, 17 Jan 2023 06:34:06 -0800 (PST) MIME-Version: 1.0 References: <20230117-kernel-kheaders-cpio-v1-1-058d3e1c8621@weissschuh.net> <20230117131919.3ywkaptian2y242d@t-8ch.de> In-Reply-To: <20230117131919.3ywkaptian2y242d@t-8ch.de> From: Masahiro Yamada Date: Tue, 17 Jan 2023 23:33:30 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kheaders: explicitly validate existence of cpio command To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , linux-kbuild@vger.kernel.org, Amy Parker , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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, Jan 17, 2023 at 10:19 PM Thomas Wei=C3=9Fschuh wr= ote: > > On Tue, Jan 17, 2023 at 09:46:02AM +0100, Nicolas Schier wrote: > > On Tue, Jan 17, 2023 at 05:30:43AM +0000, Thomas Wei=C3=9Fschuh wrote: > > > If the cpio command is not available the error emitted by > > > gen_kheaders.so is not clear as all output of the call to cpio is > > > discarded: > > > > > > GNU make 4.4: > > > > > > GEN kernel/kheaders_data.tar.xz > > > find: 'standard output': Broken pipe > > > find: write error > > > make[2]: *** [kernel/Makefile:157: kernel/kheaders_data.tar.xz] Error= 127 > > > make[1]: *** [scripts/Makefile.build:504: kernel] Error 2 > > > > > > GNU make < 4.4: > > > > > > GEN kernel/kheaders_data.tar.xz > > > make[2]: *** [kernel/Makefile:157: kernel/kheaders_data.tar.xz] Error= 127 > > > make[2]: *** Waiting for unfinished jobs.... > > > make[1]: *** [scripts/Makefile.build:504: kernel] Error 2 > > > > > > Add an explicit check that will trigger a clear message about the iss= ue: > > > > > > CHK kernel/kheaders_data.tar.xz > > > ./kernel/gen_kheaders.sh: line 17: type: cpio: not found > > > > Thanks for the patch! What would you think about an even more verbose > > message? Perhaps something like: > > > > echo >&2 ' *** "cpio" is required for "CONFIG_IKHEADERS". >&2 > > Wouldn't hurt obviously. > The other scripts used by the kernel don't seem to try to provide this > kind of explicit message either, though. > Having a line number, some sort of "not found" and the name of the > command are enough, in my opinion. Agree. I am fine with this patch. Just a side note. 'type' is defined in posix [1], so this code is portable. Kbuild often uses "command -v" to check the existence of a command because it is also posix compliant [2]. I just wondered why we did not use 'type' before... 'type' is more efficient because it is shell-builtin (at least for dash and bash) but 'command' is not. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html [2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.htm= l > > > Reviewed-by: Nicolas Schier > > Thanks! > > Thomas --=20 Best Regards Masahiro Yamada