Skip to content

Commit 177cba1

Browse files
akinomyogascop
andcommitted
fix(_tilde): fix false negative with 256 generated users
In the original code, the exit status becomes unexpectedly 0 (True) when 256 (or multiples of 256) users are generated. This commit checks the number of generated users and returns 1 explicitly if there are one or more users are generated. Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
1 parent b05d37a commit 177cba1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bash_completion

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,8 @@ _ncpus()
12661266

12671267
# Perform tilde (~) completion
12681268
# @return True (0) if completion needs further processing,
1269-
# False (> 0) if tilde is followed by a valid username, completions
1270-
# are put in COMPREPLY and no further processing is necessary.
1269+
# False (1) if tilde is followed by a valid username, completions are
1270+
# put in COMPREPLY and no further processing is necessary.
12711271
_tilde()
12721272
{
12731273
local result=0
@@ -1278,7 +1278,7 @@ _tilde()
12781278
# 2>/dev/null for direct invocation, e.g. in the _tilde unit test
12791279
((result > 0)) && compopt -o filenames 2>/dev/null
12801280
fi
1281-
return "$result"
1281+
return $((result > 0 ? 1 : 0))
12821282
}
12831283

12841284
# Expand variable starting with tilde (~)

0 commit comments

Comments
 (0)