Univention Bugzilla – Bug 41926
Check for unquoted "dash" local variables
Last modified: 2017-04-04 18:28:57 CEST
Created attachment 7858 [details] Unquotet use of local in UCS-4.1-3 "dash" in contrast to "bash" needs quoting for local function variables; otherwise the value is slit on IFS: > $ dash -c 'f () { local var=$1; }; f "a-b.c-d a-b"' > dash: 1: local: a-b: bad variable name > $ dash -c 'f () { local var="$1"; }; f "a-b.c-d > a-b"' This caused Bug #41917. ucslint should check shell files for git grep -n "\<local\> \w\+=\([^\"'0-9 \$(]\|\$[^'?\$!#({]\|\${[^?\$!#]\)" This is not perfect as "local" can be used to assign multiple local variables at once. $ dash -c 'f () { local var=`echo a-b.c-d a-b`; }; f "a-b.c-d > a-b"' dash: 1: local: a-b: bad variable name $ dash -c 'f () { local var="`echo a-b.c-d a-b`"; }; f "a-b.c-d > a-b"'
r72024 | Bug #41926 ucslint: Check for unquoted local variables Package: ucslint Version: 6.0.0-1A~4.2.0.201608301342 Branch: ucs_4.2-0 r72027 | Bug #32539,Bug #41926,Bug #37203: ucslint ucs-4.2-0/doc/changelog/changelog-4.2-0.xml
OK: I changed e.g. bash to sh in: W:0013-4: univention-backup2master:43: unquoted local variable: local message=$1 OK: changelog
UCS 4.2 has been released: https://docs.software-univention.de/release-notes-4.2-0-en.html https://docs.software-univention.de/release-notes-4.2-0-de.html If this error occurs again, please use "Clone This Bug".