From 8e5aab4d76896b4dcf735a626c281ddcb7b2d211 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Sat, 6 Feb 2021 04:40:41 +1000 Subject: [PATCH] Support large folder size comparisons for win_find (#58466) (#73382) Changed [int] to [int64] to support larger folders. Otherwise module fails as soon as a large folder is encountered. (cherry picked from commit 8def67939dbd5dbba84fe160f3ad187c76ebe63a) Co-authored-by: joshinryz --- ...58466-FIX_win_find-Bug-Get-FileStat_fails_on_large_files.yml | 2 ++ lib/ansible/modules/windows/win_find.ps1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/58466-FIX_win_find-Bug-Get-FileStat_fails_on_large_files.yml diff --git a/changelogs/fragments/58466-FIX_win_find-Bug-Get-FileStat_fails_on_large_files.yml b/changelogs/fragments/58466-FIX_win_find-Bug-Get-FileStat_fails_on_large_files.yml new file mode 100644 index 00000000000..8b40976a93a --- /dev/null +++ b/changelogs/fragments/58466-FIX_win_find-Bug-Get-FileStat_fails_on_large_files.yml @@ -0,0 +1,2 @@ +bugfixes: + - "win_find - Get-FileStat used [int] instead of [int64] for file size calculations" diff --git a/lib/ansible/modules/windows/win_find.ps1 b/lib/ansible/modules/windows/win_find.ps1 index 8857692033e..d7f6652e1c8 100644 --- a/lib/ansible/modules/windows/win_find.ps1 +++ b/lib/ansible/modules/windows/win_find.ps1 @@ -177,7 +177,7 @@ Function Assert-Size($info) { $size_pattern = '^(-?\d+)(b|k|m|g|t)?$' $match = $size -match $size_pattern if ($match) { - [int]$specified_size = $matches[1] + [int64]$specified_size = $matches[1] if ($null -eq $matches[2]) { $chosen_byte = 'b' } else {