Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2156144rwj; Sat, 24 Dec 2022 09:37:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1hhZkJ2tahOHoOfh6DZN5imq3BHtWtCjluBchWJsZRsGb0bjquQ7VlVH05lnxkaJUNLkN X-Received: by 2002:a05:6a00:168d:b0:577:2a9:ec82 with SMTP id k13-20020a056a00168d00b0057702a9ec82mr14475676pfc.5.1671903431228; Sat, 24 Dec 2022 09:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671903431; cv=none; d=google.com; s=arc-20160816; b=J9CjIv6ZGQMzd1B8OYa2yadiR8A1AbIP8b0O6G35pgrfUfHwu1Rv/SNtj6vR32fcV4 +Km6eNUerrsAb2iM5LysT1nk2/2uREoAhQ+XqLtf1ptxc/atK9KC/ykakwbCmfSXfIT5 C6tG+T+46g+2HvTxB34SpP+8/YFMhTgiD2BmrX2I1JCEQ4WBsJzRnb1nhh3gLZQVTJd8 jxyTtyn6hnC2ESPDArYYL7V/dhVF+LcCXcvpJ0YIz24ZUC/ss/OgS+pEjyyB5SF2BlRt nsZyeC3Sj0UXfqmRHay7V0klhSz2KY6O0oSaDkoJfYPlmcAL37cyMb4KTnDOvK7kKukV DsjQ== 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:dkim-filter; bh=TlHmyh0nEjNqJa7OxlDKADlGglP7IhjXAeNsJ0gbZ54=; b=ZuRmtyIBAh99ZykRFNB9QEoM3DOZecFJou1QW5ZwAOAthixdGZw5vlrDZyaruVBALf ciRH0zIc7Gq30bBakBw4ZZKEN+t9KfuQU6uMwsk+kSOB4PqT8KlQANy5+ve6Wjif3u0f P15XJLKQjR2zj6a4Ji/nL2CYSY75YLaWiFPXS+940zJ/4ciq4DPZLiHL/yhLij+GvAcT 0IeJy4fzqHJpkQSblgvp3/bBC75VkEvll624p0UwTEWUm1qn/Wm4nCfwIL3G47lOFq1g opgJcDJ9psdytR8prr0JlG9xRkc8VQ1W7Vc+PMeo0g41NoZM+GzidMB14DZNEW22gKmt 9FfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=orVWby5f; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a056a0016ce00b0058035001254si7225461pfc.46.2022.12.24.09.36.55; Sat, 24 Dec 2022 09:37:11 -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=@nifty.com header.s=dec2015msa header.b=orVWby5f; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbiLXQuT (ORCPT + 66 others); Sat, 24 Dec 2022 11:50:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbiLXQuR (ORCPT ); Sat, 24 Dec 2022 11:50:17 -0500 X-Greylist: delayed 174 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 24 Dec 2022 08:50:16 PST Received: from condef-05.nifty.com (condef-05.nifty.com [202.248.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EBB3C767 for ; Sat, 24 Dec 2022 08:50:16 -0800 (PST) Received: from conssluserg-05.nifty.com ([10.126.8.84])by condef-05.nifty.com with ESMTP id 2BOGklSh019306 for ; Sun, 25 Dec 2022 01:46:47 +0900 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 2BOGkTPF003578 for ; Sun, 25 Dec 2022 01:46:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 2BOGkTPF003578 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1671900390; bh=TlHmyh0nEjNqJa7OxlDKADlGglP7IhjXAeNsJ0gbZ54=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=orVWby5fKyrq+5/4nvDHSDUFTh12G112IDbBuvP1etFAPVrZ/qBw7Z2ThaHQKhR3c ZHsZZqm6+wME+I7vkJIi/gfhJs+58aNlV725zcF3P3eY1ZGNVY/N3acRJaLyfYl8+6 bvXVSSPThOElpmW+Vj6EApcT5p6P0OdxtCW2e8pFh+UIYAMjxPQWd/jxVPvMr+WuEX MIzD4q6Okr5uQwgTk8/6871mvVlpKP2DkvmAYNMvkfjhduj6BR4YA1vmN8HmZfokqr m2ZtN49+tncgayDrigQM/A5ZYcLw+rowebDRzgPc+rpV61gz4lUdNIFcQ19vjKlcnD nPw0JTQqYjxTw== X-Nifty-SrcIP: [209.85.160.43] Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-14455716674so8972959fac.7 for ; Sat, 24 Dec 2022 08:46:30 -0800 (PST) X-Gm-Message-State: AFqh2kpcOXoQPJlhtRJTwlFbB9CjDOrTTFLQRJf2m9S71s5z+mD6RLKV Cb32dXaEORmVuG8ijusE+qTYlS3wUONTR60+QcM= X-Received: by 2002:a05:6871:4193:b0:144:d060:72e with SMTP id lc19-20020a056871419300b00144d060072emr909779oab.287.1671900388872; Sat, 24 Dec 2022 08:46:28 -0800 (PST) MIME-Version: 1.0 References: <20221217084155.663235-1-mgorny@gentoo.org> In-Reply-To: <20221217084155.663235-1-mgorny@gentoo.org> From: Masahiro Yamada Date: Sun, 25 Dec 2022 01:45:52 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kheaders: prefer gtar over tar for better compatibility To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= Cc: Dmitry Goldin , linux-kernel@vger.kernel.org, Sam James Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL 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 Sat, Dec 17, 2022 at 5:42 PM Micha=C5=82 G=C3=B3rny = wrote: > > Commit 86cdd2fdc4e39c388d39c7ba2396d1a9dfd66226 ("kheaders: make headers > archive reproducible") introduced a number of options specific to GNU > tar to the `tar` invocation in `gen_kheaders.sh` script. This causes > the script to fail to work on systems where `tar` is not GNU tar. This > can occur e.g. on recent Gentoo Linux installations that support using > bsdtar from libarchive instead. > > To achieve better portability, try using `gtar` over `tar` if the former > is available. This is the name frequently used on systems featuring > support for installing GNU tar alongside another tar implementation. > If `gtar` is not present, `tar` is used for compatibility with regular > systems. > > Link: https://bugs.gentoo.org/884061 > Reported-by: Sam James > Tested-by: Sam James > Signed-off-by: Micha=C5=82 G=C3=B3rny > --- > kernel/gen_kheaders.sh | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh > index 473036b43..d2445af7f 100755 > --- a/kernel/gen_kheaders.sh > +++ b/kernel/gen_kheaders.sh > @@ -80,11 +80,20 @@ done | cpio --quiet -pdu $cpio_dir >/dev/null 2>&1 > find $cpio_dir -type f -print0 | > xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).= )*?\*\///smg;' > > +# The following tar invocations use options specific to GNU tar. On some > +# systems (e.g. Gentoo), `tar` can be a different tool (e.g. bsdtar), an= d GNU > +# tar can be found as `gtar`. > +if [ -x "$(command -v gtar)" ]; then > + tar=3Dgtar > +else > + tar=3Dtar > +fi > + > # Create archive and try to normalize metadata for reproducibility. > # For compatibility with older versions of tar, files are fed to tar > # pre-sorted, as --sort=3Dname might not be available. > find $cpio_dir -printf "./%P\n" | LC_ALL=3DC sort | \ > - tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=3D$KBUILD_BUILD_TIMESTAMP}" \ > + $tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=3D$KBUILD_BUILD_TIMESTAMP}" = \ > --owner=3D0 --group=3D0 --numeric-owner --no-recursion \ > -I $XZ -cf $tarfile -C $cpio_dir/ -T - > /dev/null I checked the options in bsd tar [1]. Presumably, there is no way to make it work for both due to incompatible options (--owner vs --uid, --group vs --gid). Instead of inserting a workaround like this, another way is to allow users to override a variable from the command line. See the top Makefile, for example, AWK =3D awk Then, users can do "make AWK=3Dgawk" [1] https://www.freebsd.org/cgi/man.cgi?tar(1) > -- > 2.39.0 >