* [PATCH] dracut: fix arithemtic ${#VAR[@]} tests
@ 2011-03-20 19:56 Michal Soltys
[not found] ` <1300650977-29456-1-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Michal Soltys @ 2011-03-20 19:56 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
This patch fixes a handful of ${#VAR[@]} tests, which can't be evaluated
as text expressions - the results is always true in such case, because
"0" is non-empty string.
Signed-off-by: Michal Soltys <soltys-R61QfzASbfY@public.gmane.org>
---
dracut | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dracut b/dracut
index 0c1cc14..dd32b88 100755
--- a/dracut
+++ b/dracut
@@ -276,48 +276,48 @@ if [[ $confdir && -d $confdir ]]; then
fi
# these optins add to the stuff in the config file
-if [[ ${#add_dracutmodules_l[@]} ]]; then
+if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do
add_dracutmodules+=" $val "
done
fi
-if [[ ${#add_drivers_l[@]} ]]; then
+if (( ${#add_drivers_l[@]} )); then
while pop add_drivers_l val; do
add_drivers+=" $val "
done
fi
# these options override the stuff in the config file
-if [[ ${#dracutmodules_l[@]} ]]; then
+if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
while pop dracutmodules_l val; do
dracutmodules+="$val "
done
fi
-if [[ ${#omit_dracutmodules_l[@]} ]]; then
+if (( ${#omit_dracutmodules_l[@]} )); then
omit_dracutmodules=''
while pop omit_dracutmodules_l val; do
omit_dracutmodules+="$val "
done
fi
-if [[ ${#drivers_l[@]} ]]; then
+if (( ${#drivers_l[@]} )); then
drivers=''
while pop drivers_l val; do
drivers+="$val "
done
fi
-if [[ ${#filesystems_l[@]} ]]; then
+if (( ${#filesystems_l[@]} )); then
filesystems=''
while pop filesystems_l val; do
filesystems+="$val "
done
fi
-if [[ ${#fw_dir_l[@]} ]]; then
+if (( ${#fw_dir_l[@]} )); then
fw_dir=''
while pop fw_dir_l val; do
fw_dir+="$val "
--
1.7.2.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dracut: fix arithemtic ${#VAR[@]} tests
[not found] ` <1300650977-29456-1-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
@ 2011-03-23 10:23 ` Harald Hoyer
0 siblings, 0 replies; 2+ messages in thread
From: Harald Hoyer @ 2011-03-23 10:23 UTC (permalink / raw)
To: Michal Soltys; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
Am 20.03.2011 20:56, schrieb Michal Soltys:
> This patch fixes a handful of ${#VAR[@]} tests, which can't be evaluated
> as text expressions - the results is always true in such case, because
> "0" is non-empty string.
>
> Signed-off-by: Michal Soltys <soltys-R61QfzASbfY@public.gmane.org>
> ---
> dracut | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/dracut b/dracut
> index 0c1cc14..dd32b88 100755
> --- a/dracut
> +++ b/dracut
> @@ -276,48 +276,48 @@ if [[ $confdir && -d $confdir ]]; then
> fi
>
> # these optins add to the stuff in the config file
> -if [[ ${#add_dracutmodules_l[@]} ]]; then
> +if (( ${#add_dracutmodules_l[@]} )); then
> while pop add_dracutmodules_l val; do
> add_dracutmodules+=" $val "
> done
> fi
>
> -if [[ ${#add_drivers_l[@]} ]]; then
> +if (( ${#add_drivers_l[@]} )); then
> while pop add_drivers_l val; do
> add_drivers+=" $val "
> done
> fi
>
> # these options override the stuff in the config file
> -if [[ ${#dracutmodules_l[@]} ]]; then
> +if (( ${#dracutmodules_l[@]} )); then
> dracutmodules=''
> while pop dracutmodules_l val; do
> dracutmodules+="$val "
> done
> fi
>
> -if [[ ${#omit_dracutmodules_l[@]} ]]; then
> +if (( ${#omit_dracutmodules_l[@]} )); then
> omit_dracutmodules=''
> while pop omit_dracutmodules_l val; do
> omit_dracutmodules+="$val "
> done
> fi
>
> -if [[ ${#drivers_l[@]} ]]; then
> +if (( ${#drivers_l[@]} )); then
> drivers=''
> while pop drivers_l val; do
> drivers+="$val "
> done
> fi
>
> -if [[ ${#filesystems_l[@]} ]]; then
> +if (( ${#filesystems_l[@]} )); then
> filesystems=''
> while pop filesystems_l val; do
> filesystems+="$val "
> done
> fi
>
> -if [[ ${#fw_dir_l[@]} ]]; then
> +if (( ${#fw_dir_l[@]} )); then
> fw_dir=''
> while pop fw_dir_l val; do
> fw_dir+="$val "
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-23 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-20 19:56 [PATCH] dracut: fix arithemtic ${#VAR[@]} tests Michal Soltys
[not found] ` <1300650977-29456-1-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
2011-03-23 10:23 ` Harald Hoyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox