Backport more complete fix for bash regexp quoting bug from libguestfs.