[PATCHv2] powerpc: comvert relocs_check to a shell script using grep

Stephen Rothwell sfr at canb.auug.org.au
Sat Mar 14 08:49:13 AEDT 2015


Hi David,

On Fri, 13 Mar 2015 14:18:10 +0000 David Laight <David.Laight at ACULAB.COM> wrote:
>
> From: Stephen Rothwell
> > This runs a bit faster and removes another use of perl from
> > the kernel build.
> ...
> > diff --git a/arch/powerpc/relocs_check.sh b/arch/powerpc/relocs_check.sh
> > new file mode 100755
> > index 000000000000..182eae9cc40d
> > --- /dev/null
> > +++ b/arch/powerpc/relocs_check.sh
> > @@ -0,0 +1,59 @@
> > +#!/bin/sh
> ...
> > +if [ ${#*} -lt 2 ]; then
> > +	echo "$0 [path to objdump] [path to vmlinux]" 1>&2
> > +	exit 1
> > +fi
> > +
> > +# Have Kbuild supply the path to objdump so we handle cross compilation.
> > +objdump="$1"
> > +vmlinux="$2"
> 
> I'm not 100% sure of the requirements on /bin/sh for kernel builds.
> But ${#*} is probably not completely portable (and may not be safe
> if there are embedded spaces in the arguments).

Oops, that is just wrong :-( ${#*} is undefined in Posix but is the
same as $# in bash.  It needs to be just $#.

> Might be better to check:
> 	if [ -z "$objdump" -o -z "$vmlinux" ]
> instead.
> 
> Or even:
> 	if [ ! -x "$objdump" -o ! -r "$vmlinux" ]

That last is a good idea as well.

I will do another version.

Thanks for catching that.
-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20150314/4ccf3df3/attachment.sig>


More information about the Linuxppc-dev mailing list