]> git.ipfire.org Git - thirdparty/dracut.git/commit
Specify strstr tightly, add strglob/strglobin.
authorChapman Flack <g2@anastigmatix.net>
Sat, 5 Apr 2014 01:11:38 +0000 (21:11 -0400)
committerHarald Hoyer <harald@redhat.com>
Mon, 7 Apr 2014 08:49:07 +0000 (10:49 +0200)
commit2c19a5fa78fe7c75f050ec9547c87663ee15b04b
tree0a83a1d76d9bacc5580b43f9a6cf1aeb2719e2e0
parent2e094b20a6875fdb0a7ef8772e3d7688ad91c036
Specify strstr tightly, add strglob/strglobin.

By convention, strstr should be a literal string match. Previously, it
would match as a glob pattern. Some code used that, so add new
functions strglob and strglobin to do what that code expects, and
specify them tightly too. strglob tests whether the glob pattern
matches the entire string (the name strglob is also used in the yorick
language, and that's what it does there), while strglobin tests whether
the glob pattern matches anywhere in the string.

Also tightens str_starts, str_ends, and str_replace to deal with
literal strings only. In a quick grep I did not find code that depended
on these functions matching globs.

Changes the call sites where strstr was used with glob patterns to use
strglobin or strglob as the intention seemed to be (or, in one case,
strstr with the * removed as it did not affect the result anyway).
20 files changed:
dracut-functions.sh
modules.d/40network/ifup.sh
modules.d/40network/net-lib.sh
modules.d/45ifcfg/write-ifcfg.sh
modules.d/80cms/cms-write-ifcfg.sh
modules.d/80cms/cmsifup.sh
modules.d/95nfs/nfs-lib.sh
modules.d/99base/dracut-lib.sh
test/TEST-01-BASIC/test-init.sh
test/TEST-02-SYSTEMD/test-init.sh
test/TEST-03-USR-MOUNT/test-init.sh
test/TEST-04-FULL-SYSTEMD/test-init.sh
test/TEST-10-RAID/test-init.sh
test/TEST-11-LVM/test-init.sh
test/TEST-12-RAID-DEG/test-init.sh
test/TEST-14-IMSM/test-init.sh
test/TEST-16-DMSQUASH/test-init.sh
test/TEST-17-LVM-THIN/test-init.sh
test/TEST-20-NFS/client-init.sh
test/TEST-50-MULTINIC/client-init.sh