Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support large folder size comparisons for win_find #58466

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@joshinryz
Copy link

commented Jun 27, 2019

Changed [int] to [int64] to support larger folders. Otherwise module fails as soon as a large folder is encountered.

SUMMARY

It appears that large folders break win_find when the size is too large to fit inside a System.Int32.
Further, win_find breaks as soon as a warning is encountered, causing it to no longer process folders.

Fixes #58463

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_find.ps1

ANSIBLE VERSION

2.8.0

STEPS TO REPRODUCE
---
- name: Search for folders
  win_find:
    paths: C:\ProgramData
    file_type: directory
ADDITIONAL INFO

Example of using the Get-FileStat function on a large folder.

PS C:\Windows\system32> $file = Get-Item -LiteralPath C:\ProgramData\Anaconda2 -Force

PS C:\Windows\system32> Get-FileStat -file $file
Cannot convert value "4444553383" to type "System.Int32". Error: "Value was either too large or too small for an Int32."
At line:186 char:13
[int]$specified_size = $matches[1]
CategoryInfo : InvalidArgument: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : InvalidCastFromStringToInteger

ACTUAL RESULTS
win_find failed to check some files, these files were ignored and will not be part of the result output
Support large folder size comparisons for win_find
Changed [int] to [int64] to support larger folders. Otherwise module fails as soon as a large folder is encountered.
@ansibot

This comment has been minimized.

@ShachafGoldstein

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2019

Seems ok to me, please add a changelog fragment
https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment

and maybe add fixes #58463 to your description of the PR to make the issue close automatically

@ansibot ansibot removed the needs_triage label Jun 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.