-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(available_interfaces): fix regression of unwanted trailing colons
This is a fix for regression introduced in commit b603535 and reported in GitHub #1129 [1]. The trailing colons of the generated interface names were removed before, but not they are not removed. [1] #1129 In addition, generated words can have the form `veth0@veth1`, where we want only the first part `veth0` not containing any punctuation characters. In this patch, we remove any [[:punct:]] and all the later characters in the generated words.
- Loading branch information
1 parent
fdd8048
commit c2f83e0
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
|
||
from conftest import assert_bash_exec | ||
|
||
|
||
@pytest.mark.bashcomp(cmd=None) | ||
class TestUtilCompgenAvailableInterfaces: | ||
@pytest.fixture | ||
def functions(self, bash): | ||
assert_bash_exec( | ||
bash, | ||
"_comp__test_dump() { ((${#arr[@]})) && printf '<%s>' \"${arr[@]}\"; echo; }", | ||
) | ||
assert_bash_exec( | ||
bash, | ||
'_comp__test_compgen() { local -a arr=(00); _comp_compgen -v arr "$@"; _comp__test_dump; }', | ||
) | ||
|
||
def test_1_trailing_colons(self, bash, functions): | ||
output = assert_bash_exec( | ||
bash, | ||
"_comp__test_compgen available_interfaces", | ||
want_output=True, | ||
) | ||
assert ":" not in output.strip() |