All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, maennich@google.com,
	kernel-team@android.com
Subject: Re: [PATCH] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS
Date: Wed, 29 Jan 2020 17:37:14 +0000	[thread overview]
Message-ID: <20200129173714.GA193443@google.com> (raw)
In-Reply-To: <nycvar.YSQ.7.76.2001291152540.1655@knanqh.ubzr>

On Wednesday 29 Jan 2020 at 12:11:12 (-0500), Nicolas Pitre wrote:
> > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh
> > index a904bf1f5e67..1a6f7f377230 100755
> > --- a/scripts/adjust_autoksyms.sh
> > +++ b/scripts/adjust_autoksyms.sh
> > @@ -48,6 +48,7 @@ cat > "$new_ksyms_file" << EOT
> >  EOT
> >  sed 's/ko$/mod/' modules.order |
> >  xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
> > +cat - $CONFIG_UNUSED_KSYMS_WHITELIST |
> 
> This is a nice trick, however it'll fail if the file path contains 
> spaces or other shell special characters.

Argh! Right, that's a very good point.

> You could try something like 
> this:
> 
> [ -z "$CONFIG_UNUSED_KSYMS_WHITELIST" ] \
> 	&& whitelist= \
> 	|| whitelist="\"$CONFIG_UNUSED_KSYMS_WHITELIST\""
> 
> And then...
> 
>   eval cat - $whitelist | ...
> 
> This way, if $CONFIG_UNUSED_KSYMS_WHITELIST is non empty, it'll get 
> quoted.

A shorter alternative would be something a little like so perhaps ?

diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh
index 1a6f7f377230..8e1b7f70e800 100755
--- a/scripts/adjust_autoksyms.sh
+++ b/scripts/adjust_autoksyms.sh
@@ -48,7 +48,7 @@ cat > "$new_ksyms_file" << EOT
 EOT
 sed 's/ko$/mod/' modules.order |
 xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
-cat - $CONFIG_UNUSED_KSYMS_WHITELIST |
+cat - "${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" |
 sort -u |
 sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file"

No strong opinion, though.

Thanks for the review,
Quentin

  reply	other threads:[~2020-01-29 17:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 15:06 [PATCH] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS Quentin Perret
2020-01-29 17:11 ` Nicolas Pitre
2020-01-29 17:37   ` Quentin Perret [this message]
2020-01-29 17:42     ` Nicolas Pitre
2020-01-30 15:45 ` Christoph Hellwig
2020-01-30 17:01   ` 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=20200129173714.GA193443@google.com \
    --to=qperret@google.com \
    --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.