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

[v2] Download special char issue #2362

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Conversation

jace-roell
Copy link
Contributor

@jace-roell jace-roell commented Nov 15, 2024

What It Does
This PR resolves an issue where special characters could become corrupted when downloading large files. The corruption was caused by each chunk buffer being converted to a string when calling the processNewLines() function and then converted back to a buffer. This PR introduces support for passing buffers directly into the processNewLines() function to prevent corruption.

How to Test
The issue arises when a special character appears as the last character of a stream chunk. To reproduce, create a PDS file containing exclusively special characters with a size larger than the default chunk size (>8KB). In such cases, the last character of each chunk may be corrupted and appear as two unknown characters.

To observe this issue, download a PDS file that meets the criteria using the following example command (assuming the use of IBM-1147 encoding):

zowe zos-files download ds <PDSMEMBER> --encoding "IBM-1147"

where <PDSMEMBER> is a file larger than 8KB containing special characters.

Example Line (about 105 are required in a file to exceed 8KB):
àèéìòùÀÈÉÌÒÙ°àèéìòùÀÈÉÌÒÙ°àèéìòùÀÈÉÌÒÙ°àèéìòùÀÈÉÌÒÙ°àèéìòùÀÈÉÌÒÙ°àèéìòùÀÈÉÌÒÙ°à

Review Checklist
I certify that I have:

@jace-roell jace-roell changed the title [v2] Download am special char issue [v2] Download special char issue Nov 15, 2024
@jace-roell jace-roell linked an issue Nov 15, 2024 that may be closed by this pull request
@jace-roell jace-roell added the needs-ported Indicates that a PR needs to be ported (master - lts-incremental) label Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.25%. Comparing base (4df8041) to head (fcb259a).
Report is 9 commits behind head on zowe-v2-lts.

Additional details and impacted files
@@              Coverage Diff              @@
##           zowe-v2-lts    #2362    +/-   ##
=============================================
  Coverage        91.24%   91.25%            
=============================================
  Files              638      638            
  Lines            19146    19158    +12     
  Branches          3943     4060   +117     
=============================================
+ Hits             17470    17482    +12     
  Misses            1675     1675            
  Partials             1        1            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@jace-roell jace-roell marked this pull request as ready for review November 15, 2024 16:04
jace-roell and others added 2 commits November 18, 2024 08:44
Co-authored-by: Timothy Johnson <[email protected]>
Signed-off-by: Jace Roell <[email protected]>
Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for porting 😋

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how we are handling buffers in the processNewLines function.
Left a couple of comments, but I don't believe that they should stop this PR from being merged. 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to generate this file as part of the test resources, and remove after the test is done?

packages/imperative/src/io/src/IO.ts Show resolved Hide resolved
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as expected 🙏

Wondering if we should fix the same issue for the upload operation 🙏

zdev files ul ftds ".../testfiles/specialCharTestData.txt" "fernando.test.ps001" --encoding "IBM-1147"

image

@zFernand0 zFernand0 dismissed their stale review November 19, 2024 17:18

This could be handled in a separate PR, my apologies 🙏

Copy link
Member

@gejohnston gejohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once Fernando's questions are resolved, I approve.

@zFernand0
Copy link
Member

This works as expected 🙏

Wondering if we should fix the same issue for the upload operation 🙏

zdev files ul ftds ".../testfiles/specialCharTestData.txt" "fernando.test.ps001" --encoding "IBM-1147"

image

This was a Zowe Explorer issue.
The data on the mainframe looks good.
Once ZE adopts this version, it should be resolved there as well.

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😋

Apologies for the oversight. Zowe Explorer still has the issue, but the data on the mainframe looks good 🙏

@zFernand0 zFernand0 merged commit 4388893 into zowe-v2-lts Nov 20, 2024
14 checks passed
@zFernand0 zFernand0 deleted the download-am-special-char-issue branch November 20, 2024 13:58
@zFernand0 zFernand0 added the release-patch Indicates a patch to existing code has been applied label Nov 20, 2024
Copy link

Release succeeded for the zowe-v2-lts branch. 🎉

The following packages have been published:

Powered by Octorelease 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ported Indicates that a PR needs to be ported (master - lts-incremental) release-patch Indicates a patch to existing code has been applied released
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

Download all-members replaces special characters
6 participants