Closed demolot closed 1 year ago
Thank you for pointing out the issue for win_zip module!
I believe this behavior is coming from .NET Framework. However, this behavior has been changed from .NET Framework 4.6.1. I will test with that version to see there is any difference.
To workaround this, might be I can add some function to replace backslash to forward slash forcibly.
SUMMARY
The overall issue is that when we use win_zip on a Windows and then try to unzip on a Linux asset it returns warning:
From my testings the file gets unzipped, however, I can't say that with 100% of confidence. The real root cause is in the creation of that zip file in the first place - that one should not use backslashes as a separator.
Looking at the community win_zip implementation at https://github.com/ansible-collections/community.windows/blob/107df28cbfad19ea06d794c3b877a4d829fccca7/plugins/modules/win_zip.ps1#L56 it is using
[System.IO.Compression.ZipFile]::CreateFromDirectory
, see relevant discussion about that method and baskslash separators at https://stackoverflow.com/questions/27289115/system-io-compression-zipfile-net-4-5-output-zip-in-not-suitable-for-linux-macSame issue could be found under https://github.com/ansible/ansible/issues/30976 however suggestion is to "hide" the issue instead of solving it
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
Windows / Linux
STEPS TO REPRODUCE
EXPECTED RESULTS
No warnings on unzip function on Linux
ACTUAL RESULTS