Bug#525655: /usr/share/initramfs-tools/hooks/mdadm: warnings

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sun Apr 26 17:20:22 UTC 2009


On Sun, 26 Apr 2009, martin f krafft wrote:

> > @@ -179,7 +179,7 @@
> >    exit 0
> >  else
> >    # obtain dev:level pairs from config file, honouring multiline entries
> > -  devpairs="$(
> > +  devpairs=$(
> >      while read line; do
> >        case "$line" in
> >          (ARRAY*) :;;
> > @@ -207,7 +207,7 @@
> >          echo -n "$($MDADM --detail $dev | sed -rne 's,[[:space:]]+Raid Level : ,,p')"
> >        fi
> >        echo -n ' '
> > -    done < $DESTMDADMCONF)" || exit $?
> > +    done < $DESTMDADMCONF) || exit $?
> >  fi
>
> Not a bug.

Alright.

> Inside $(), I can use "" without quoting them again.

Still.  Outside quotes are useless.  $(...) protects the resulting string.

> That's one of the great things about $() over ``.

Right.  Why not use it through the whole script then?  Here's another
spot:

-	rubbish=`echo $rubbish | sed 's/metadata=[^ ]* //'`
+	rubbish=$(echo $rubbish | sed 's/metadata=[^[:blank:]]*[[:blank:]]//')

> > --- mdadm.1	2009-04-26 12:56:39.000000000 +0200
> > +++ mdadm.2	2009-04-26 12:54:29.000000000 +0200
> > @@ -6,14 +6,14 @@
> >  #
> >  set -eu
> >
> > -PREREQ=""
> > +PREREQ=
>
> I don't see the real difference.

That's 2 bytes shorter.

> I saw that policy now allows this, but then again, there's not
> really any benefit, so I'll leave it for now.
>
> > @@ -218,7 +218,7 @@
> >  if [ "$INITRDSTART" != none ] && [ -n "$devpairs" ]; then
> >    echo "MD_DEVPAIRS='${devpairs% }'" >> $DESTCONFIG
> >
> > -  devs=''; levels=''
> > +  devs=; levels=
>
> See above; no difference that I can make out.

See above.  A whole ... several bytes shorter script :)

> Thanks for your feedback. New version pending.


Cheers,


-- 
cii





More information about the pkg-mdadm-devel mailing list