[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
parameter expansion null check fails for arrays when [*] or [@] is used
From: |
Andreas Luik |
Subject: |
parameter expansion null check fails for arrays when [*] or [@] is used |
Date: |
Mon, 21 Mar 2022 13:45:47 +0100 (CET) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -DSYSLOG_HISTORY -O2 -g -pipe
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fexceptions -fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-Wno-parentheses -Wno-format-security
uname output: Linux tst-rocky85.innovative-navigation.de
4.18.0-348.el8.0.2.x86_64 #1 SMP Sun Nov 14 00:51:12 UTC 2021 x86_64 x86_64
x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 4.4
Patch Level: 20
Release Status: release
Description:
Bash fails to correctly test for parameter to be unset or null when the
parameter is an array reference [*] or [@].
Repeat-By:
myvar[0]=
echo "${myvar[0]:+nonnull}"
<empty> -> OK
echo "${myvar[*]:+nonnull}"
nunnull -> not OK, because "${myvar[*]}" is null
echo "${myvar[@]:+nonnull}"
nunnull -> likewise not OK, because "${myvar[@]}" is null
--
Andreas Luik
Leiter Systemintegration & IT / Head of System Integration & IT
in-innovative navigation GmbH
Leibnizstr. 11
D-70806 Kornwestheim
tel: +49 7154 807171 | fax: +49 7154 807154
email: andreas.luik@innovative-navigation.de
www.innovative-navigation.de
in-innovative navigation GmbH is ISO 9001:2015 certified.
Geschäftsführer: Dr. Thomas Gern, Dr. Reinhard Zimmermann, Uwe Vögele
Kreissparkasse Esslingen
BIC: ESSL DE 66 | IBAN: DE51 6115 0020 0008 5986 55 | SWIFT: ESSL DE 66
Handelsregister: Stuttgart HRB 205770 | Steuer-Nr.71330/00796 |
Umsatzsteuer-ID: DE201463746
- parameter expansion null check fails for arrays when [*] or [@] is used,
Andreas Luik <=
Re: parameter expansion null check fails for arrays when [*] or [@] is used, Chet Ramey, 2022/03/23