Kengo Seki created HADOOP-12206:
-----------------------------------
Summary: The preceding invocations of findlargest in test-patch
effect the following invocations result
Key: HADOOP-12206
URL: https://issues.apache.org/jira/browse/HADOOP-12206
Project: Hadoop Common
Issue Type: Sub-task
Components: yetus
Reporter: Kengo Seki
Because $maxlen is not defined as a local variable, the preceding invocations
effect the following results.
{code}
function findlargest
{
local column=$1
shift
local a=("$@")
local sizeofa=${#a[@]}
local i=0
until [[ ${i} -gt ${sizeofa} ]]; do
# shellcheck disable=SC2086
string=$( echo ${a[$i]} | cut -f$((column + 1)) -d\| )
if [[ ${#string} -gt $maxlen ]]; then
maxlen=${#string}
fi
i=$((i+1))
done
echo "${maxlen}"
}
{code}
Also, {code}until [[ ${i} -gt ${sizeofa} ]]; do{code} should be -eq or -ge.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)