lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 25 Dec 2022 01:45:52 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Michał Górny <mgorny@...too.org>
Cc:     Dmitry Goldin <dgoldin+lkml@...tonmail.ch>,
        linux-kernel@...r.kernel.org, Sam James <sam@...too.org>
Subject: Re: [PATCH] kheaders: prefer gtar over tar for better compatibility

On Sat, Dec 17, 2022 at 5:42 PM Michał Górny <mgorny@...too.org> 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 <sam@...too.org>
> Tested-by: Sam James <sam@...too.org>
> Signed-off-by: Michał Górny <mgorny@...too.org>
> ---
>  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), and GNU
> +# tar can be found as `gtar`.
> +if [ -x "$(command -v gtar)" ]; then
> +       tar=gtar
> +else
> +       tar=tar
> +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=name might not be available.
>  find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \
> -    tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
> +    $tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
>      --owner=0 --group=0 --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             = awk


Then, users can do "make AWK=gawk"





[1] https://www.freebsd.org/cgi/man.cgi?tar(1)






> --
> 2.39.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ