1) strstr " $discarduuids " did not remove the optional
'luks-' prefix from the argument as the documentation says.
2) The lookup seems backwards. $luksdev ($luks in the other code copy)
is the full uuid and thus one should check whether the user-supplied
argument (short form) is contained therein, not the other way around.
Before this commit, the only way to trigger allow-discards was to
specify the full uuid without the 'luks-' prefix.
# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
- if strstr " $discarduuids " " ${luks##luks-}"; then
+ if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then
allowdiscards="allow-discards"
fi
elif getargbool rd.luks.allow-discards; then
# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
- if strstr " $discarduuids " " ${luksdev##luks-}"; then
+ if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then
allowdiscards="--allow-discards"
fi
elif getargbool rd.luks.allow-discards; then