[PATCH] update autogen-waf.sh

Martin Schwenke martin at meltin.net
Fri Aug 11 08:53:16 UTC 2017


Hi Rowland,

On Thu, 10 Aug 2017 14:21:34 +0100, Rowland Penny via
samba-technical <samba-technical at lists.samba.org> wrote:

> OK, here is the first one, this is basically just running the script
> through 'shellcheck' and fixing any errors found, it should not change
> how the script works.

It all looks good.  Can I suggest a minor improvement in a few places?

Instead of doing:

  "$p"/Makefile

it is probably better to do:

  "$p/Makefile"

That way the quotes are around the whole string and future edits are
less likely to be fragile.

However, you need to be careful with examples like this:

  "$p"/include/config*.h*

If you double-quote the wildcards then they don't get expanded.  There
are a few answers to this, including:

  "$p/include/config"*.h*

Deciding where to end the quotes is quite subjective.  :-)

Personally, I tend to "over-punctuate" my shell scripts.  I would write
the first example as:

  "${p}/Makefile"

While the braces aren't necessary in this case, I believe that they
make the variable expansion more obvious... especially in cases where
there are multiple expansions in a string.  The only place I don't use
the braces is when the variable expansion is the whole string, as in
"$p".

peace & happiness,
martin



More information about the samba-technical mailing list