Bug 40386 - ucslint: check quoting of unwanted glob patterns
ucslint: check quoting of unwanted glob patterns
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: ucslint
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-1-errata
Assigned To: Sönke Schwardt-Krummrich
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-07 13:00 CET by Florian Best
Modified: 2016-02-24 13:07 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-01-07 13:00:01 CET
ucslint should check for unquoted glob characters in arguments.
e.g. tr [:upper:] [:lower:]

It's most often not wanted to use glob patterns (See Bug #40031).
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2016-01-07 13:33:50 CET
ucslint.yaml:
r66629 | Bug #40386: updated yaml
r66628 | Bug #40386: added check for unwanted shell glob patterns

ucslint (5.0.2-1):
r66628 | Bug #40386: added check for unwanted shell glob patterns
Comment 2 Florian Best univentionstaff 2016-01-07 15:06:39 CET
In general this looks very good. But: Is it okay to flag the occurrence as "error"? Because we currently have some packages in UCS 4.0-x which would fail to build with the new version. I don't know which ucslint version is used by our buildsystem, probably the one from the release. So it would okay as every package in UCS 4.1 and UCS@school 4.1 is "now" okay.

It did not detect:
echo Aa | tr -d [:lower:]

base/univention-lib/shell/base.sh:
	ucr_varname="$(echo "$name" | tr [A-Z] [a-z] | sed 's| ||g')"

base/univention-system-setup/usr/lib/univention-system-setup/scripts/10_basis/10hostname:
289 »   kadmin -l ext "ldap/$new_hostname.$domainname@`echo $kerberos_realm | tr [[:lower:]] [[:upper:]]`"

The following files are not detected as shell scripts:
management/univention-directory-manager-modules/test/univention-admin-test
ucs-test/tests/59_udm/udm.sh
ucs-test/tests/10_ldap/42replication_uppercase

I leave it up to you which ones you want to fix. I think [[:upper:]] should also be detected, the other ones aren't that important.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2016-02-11 17:56:20 CET
(In reply to Florian Best from comment #2)
> In general this looks very good. But: Is it okay to flag the occurrence as
> "error"? Because we currently have some packages in UCS 4.0-x which would
> fail to build with the new version. I don't know which ucslint version is
> used by our buildsystem, probably the one from the release. So it would okay
> as every package in UCS 4.1 and UCS@school 4.1 is "now" okay.

The package build for UCS 4.0 uses the ucslint from UCS 4.0.

> It did not detect:
> echo Aa | tr -d [:lower:]
> 
> base/univention-lib/shell/base.sh:
> 	ucr_varname="$(echo "$name" | tr [A-Z] [a-z] | sed 's| ||g')"
> 
> base/univention-system-setup/usr/lib/univention-system-setup/scripts/
> 10_basis/10hostname:
> 289 »   kadmin -l ext "ldap/$new_hostname.$domainname@`echo $kerberos_realm
> | tr [[:lower:]] [[:upper:]]`"

Fixed.
 
> The following files are not detected as shell scripts:
> management/univention-directory-manager-modules/test/univention-admin-test
> ucs-test/tests/59_udm/udm.sh
> ucs-test/tests/10_ldap/42replication_uppercase

I will skip these for now.

ucslint.yaml:
r67372 | Bug #40386, #40639: updated yaml
r66629 | Bug #40386: updated yaml
r66628 | Bug #40386: added check for unwanted shell glob patterns

ucslint (5.0.3-1):
r67371 | Bug #40386: improved check for unwanted shell glob patterns
r67366 | Bug #40386: improved check for unwanted shell glob patterns
r66628 | Bug #40386: added check for unwanted shell glob patterns
Comment 4 Florian Best univentionstaff 2016-02-12 15:17:08 CET
OK: fix
OK: YAML
Comment 5 Janek Walkenhorst univentionstaff 2016-02-24 13:07:46 CET
<http://errata.software-univention.de/ucs/4.1/117.html>