public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] Re: [RFC] patch linux-mod.eclass to add support for module signing
  @ 2013-03-08 17:44 99% ` Steven J. Long
  0 siblings, 0 replies; 1+ results
From: Steven J. Long @ 2013-03-08 17:44 UTC (permalink / raw
  To: gentoo-dev

On Wed, Mar 06, 2013 at 06:25:38PM -0100, Carlos Silva wrote:
> + if ! use module-signing; then
> + return 1
> + fi

use module-signing || return 1

> +
> + # Check that the configuration is correct
> + KERNEL_MODSECKEY="${KERNEL_MODSECKEY:-${KV_DIR}/signing_key.priv}"

No shell field-splits (aka word-split) assignments. If sh did that, then
things like foo=$(cmd ...) would not work; so there's no need to quote
there. It's only needed for foo="$bar baz" and the like, and foo="$*" iff
you're playing with IFS (for completeness.)

That, and case $foo in .. are the *only* two places I know of where sh
doesn't field split; bash also has [[ as below. arr[i]=$bar works, but
arr+=("$bar") requires the quotes.

> + if [ ! -z "${KERNEL_MODSECKEY}x" -a ! -e "${KERNEL_MODSECKEY}" ]; then

What is the x for there? It's forcing the first test to true and is thus
redundant. Also, bash has [[ which doesn't field-split, and is quicker:

if [[ -n $KERNEL_MODSECKEY -a ! -e $KERNEL_MODSECKEY ]]; then

Though from the above, the -n (or ! -z) test is not needed, as it's set to
$KV_DIR/signing_key.priv if empty:

if [[ ! -e $KERNEL_MODSECKEY ]]; then

I think I'd use -s instead of -e here, as an empty file is also incorrect.
(help test)

> + eerror "KERNEL_MODSECKEY points to a missing file:"
> + eerror "${KERNEL_MODSECKEY}"
> + die "Invalid KERNEL_MODSECKEY"
> + fi
> + if [ ! -z "${KERNEL_MODPUBKEY}x" -a ! -e "${KERNEL_MODPUBKEY}" ]; then

Ditto.

-- 
#friendly-coders -- We're friendly, but we're not /that/ friendly ;-)


^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-03-06 19:25     [gentoo-dev] [RFC] patch linux-mod.eclass to add support for module signing Carlos Silva
2013-03-08 17:44 99% ` [gentoo-dev] " Steven J. Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox