All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nicolas Pitre <nico@fluxnic.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Matthias Maennich <maennich@google.com>,
	"Cc: Android Kernel" <kernel-team@android.com>,
	Jessica Yu <jeyu@kernel.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v5 2/3] kbuild: split adjust_autoksyms.sh in two parts
Date: Fri, 28 Feb 2020 10:03:02 +0000	[thread overview]
Message-ID: <20200228100302.GA228304@google.com> (raw)
In-Reply-To: <CAK7LNAS0D_1k8FUJ+Bre1jrtGvHu28psU_xCa=K24iD7BkcJeA@mail.gmail.com>

On Friday 28 Feb 2020 at 01:41:50 (+0900), Masahiro Yamada wrote:
> Hi.
> 
> On Tue, Feb 18, 2020 at 6:41 PM Quentin Perret <qperret@google.com> wrote:
> >
> > In order to prepare the ground for a build-time optimization, split
> > adjust_autoksyms.sh into two scripts: one that generates autoksyms.h
> > based on all currently available information (whitelist, and .mod
> > files), and the other to inspect the diff between two versions of
> > autoksyms.h and trigger appropriate rebuilds.
> >
> > Acked-by: Nicolas Pitre <nico@fluxnic.net>
> > Tested-by: Matthias Maennich <maennich@google.com>
> > Reviewed-by: Matthias Maennich <maennich@google.com>
> > Signed-off-by: Quentin Perret <qperret@google.com>
> > ---
> >  scripts/adjust_autoksyms.sh | 36 +++-----------------------
> >  scripts/gen_autoksyms.sh    | 51 +++++++++++++++++++++++++++++++++++++
> >  2 files changed, 55 insertions(+), 32 deletions(-)
> >  create mode 100755 scripts/gen_autoksyms.sh
> >
> > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh
> > index ff46996525d3..2b366d945ccb 100755
> > --- a/scripts/adjust_autoksyms.sh
> > +++ b/scripts/adjust_autoksyms.sh
> > @@ -1,14 +1,13 @@
> >  #!/bin/sh
> >  # SPDX-License-Identifier: GPL-2.0-only
> >
> > -# Script to create/update include/generated/autoksyms.h and dependency files
> > +# Script to update include/generated/autoksyms.h and dependency files
> >  #
> >  # Copyright:   (C) 2016  Linaro Limited
> >  # Created by:  Nicolas Pitre, January 2016
> >  #
> >
> > -# Create/update the include/generated/autoksyms.h file from the list
> > -# of all module's needed symbols as recorded on the second line of *.mod files.
> > +# Update the include/generated/autoksyms.h file.
> >  #
> >  # For each symbol being added or removed, the corresponding dependency
> >  # file's timestamp is updated to force a rebuild of the affected source
> > @@ -38,35 +37,8 @@ esac
> >  # We need access to CONFIG_ symbols
> >  . include/config/auto.conf
> >
> > -ksym_wl=/dev/null
> > -if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then
> > -       # Use 'eval' to expand the whitelist path and check if it is relative
> > -       eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
> > -       [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
> > -       if [ ! -f "$ksym_wl" ]; then
> 
> 
> Just a Nit.
> 
> Maybe, is testing  -r better ?
> 
> 'cat - "$ksym_wl"' is piped, so its error code is not checked.
> 
> So, checking the read permission here is robust, I think.

Right, that's a good point. And actually, I think we want both -f and
-r. -r alone would consider a path to a folder as correct.

This should do the trick:

diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh
index 679c9f05e4b4..16c0b2ddaa4c 100755
--- a/scripts/gen_autoksyms.sh
+++ b/scripts/gen_autoksyms.sh
@@ -24,7 +24,7 @@ if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then
        # Use 'eval' to expand the whitelist path and check if it is relative
        eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST"
        [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl"
-       if [ ! -f "$ksym_wl" ]; then
+       if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then
                echo "ERROR: '$ksym_wl' whitelist file not found" >&2
                exit 1
        fi

I'll send a v6 shortly.

Thanks!
Quentin

  reply	other threads:[~2020-02-28 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  9:41 [PATCH v5 0/3] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYM Quentin Perret
2020-02-18  9:41 ` [PATCH v5 1/3] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS Quentin Perret
2020-02-18  9:41 ` [PATCH v5 2/3] kbuild: split adjust_autoksyms.sh in two parts Quentin Perret
2020-02-27 16:41   ` Masahiro Yamada
2020-02-28 10:03     ` Quentin Perret [this message]
2020-02-28 10:44       ` Masahiro Yamada
2020-02-18  9:41 ` [PATCH v5 3/3] kbuild: generate autoksyms.h early Quentin Perret
2020-02-28 10:42   ` Masahiro Yamada
2020-02-28 10:46     ` Quentin Perret

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200228100302.GA228304@google.com \
    --to=qperret@google.com \
    --cc=hch@infradead.org \
    --cc=jeyu@kernel.org \
    --cc=kernel-team@android.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=masahiroy@kernel.org \
    --cc=nico@fluxnic.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.