Skip to content

Commit

Permalink
fix: bugs in cmd_test()
Browse files Browse the repository at this point in the history
bug #1: serial generator ommited the seconds
fix: include the seconds

bug #2: dupe detection wrongly set empty string, then attempted to
detect a new entry checking for empty string
fix: set the $results entry to non empty (just use $count)
  • Loading branch information
3coma3 committed Jul 1, 2021
1 parent f43f56c commit c3f6db0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backup
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,12 @@ cmd_test() {
(( y = RANDOM % (yr + 1) + $(date +%Y) - yr, m = RANDOM % 12 + 1 ))
(( leapfeb = ! (y % 4 || ! y % 100 && y % 400) && m == 2 ))
(( d = RANDOM % (daysmonth[m - 1] + leapfeb) + 1 ))
(( h = RANDOM % 23 + 1, mi = RANDOM % 59 + 1 ))
(( h = RANDOM % 23 + 1, mi = RANDOM % 59 + 1 , s = RANDOM % 59 + 1 ))

new="$(printf "%02d/%02d/%02d/%02d%02d" $y $m $d $h $mi)"
new="$(printf "%02d/%02d/%02d/%02d%02d%02d" $y $m $d $h $mi $s)"
[[ -z "${results[$new]:-}" ]] && {
results[$new]=''
(( results[$new] = count-- ))
echo "$destination/$new"
(( count-- ))
}
done | sort -dr | tokenize_path | check_retention --all | rotate_test
}
Expand Down

0 comments on commit c3f6db0

Please sign in to comment.