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] [day] [month] [year] [list]
Message-ID: <CAJ1xhMVn3O-7VhYKCmjH4NNuyRModcLJkURow+g=67tghAUgAA@mail.gmail.com>
Date:   Fri, 22 Jan 2021 09:18:35 +0200
From:   Alexander Kapshuk <alexander.kapshuk@...il.com>
To:     linux-kernel <linux-kernel@...r.kernel.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] ver_linux: Eliminate duplicate code in ldconfig
 processing logic

On Fri, Jan 8, 2021 at 1:26 PM Alexander Kapshuk
<alexander.kapshuk@...il.com> wrote:
>
> The code that acquires the version strings for libc and libcpp is
> identical, as is the printversion call. The only difference being the
> name of the library being printed.
>
> Refactor the code by unifying the bits that are common to both libraries.
>
> Signed-off-by: Alexander Kapshuk <alexander.kapshuk@...il.com>
> ---
>  scripts/ver_linux | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/ver_linux b/scripts/ver_linux
> index 0968a3070eff..a92acc703f9b 100755
> --- a/scripts/ver_linux
> +++ b/scripts/ver_linux
> @@ -15,7 +15,7 @@ BEGIN {
>
>         vernum = "[0-9]+([.]?[0-9]+)+"
>         libc = "libc[.]so[.][0-9]+$"
> -       libcpp = "(libg|stdc)[+]+[.]so[.][0-9]+$"
> +       libcpp = "(libg|stdc)[+]+[.]so([.][0-9]+)+$"
>
>         printversion("GNU C", version("gcc -dumpversion"))
>         printversion("GNU Make", version("make --version"))
> @@ -37,12 +37,10 @@ BEGIN {
>         printversion("Bison", version("bison --version"))
>         printversion("Flex", version("flex --version"))
>
> -       while ("ldconfig -p 2>/dev/null" | getline > 0) {
> -               if ($NF ~ libc && !seen[ver = version("readlink " $NF)]++)
> -                       printversion("Linux C Library", ver)
> -               else if ($NF ~ libcpp && !seen[ver = version("readlink " $NF)]++)
> -                       printversion("Linux C++ Library", ver)
> -       }
> +       while ("ldconfig -p 2>/dev/null" | getline > 0)
> +               if ($NF ~ libc || $NF ~ libcpp)
> +                       if (!seen[ver = version("readlink " $NF)]++)
> +                               printversion("Linux C" ($NF ~ libcpp? "++" : "") " Library", ver)
>
>         printversion("Dynamic linker (ldd)", version("ldd --version"))
>         printversion("Procps", version("ps --version"))
> --
> 2.30.0
>

I'd appreciate getting some feedback on the patch in question at your
convenience.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ