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

Record lines truncation of target PDS Enhancement #2433

Merged
merged 24 commits into from
Feb 26, 2025

Conversation

pujal0909
Copy link
Contributor

@pujal0909 pujal0909 commented Feb 9, 2025

What It Does

In the scenario when copying from a source PDS to a target PDS where the target does not have enough record lines for a member, initially, it would copy over that member, truncate it's record length, throw a truncation error and would not continue copying over the subsequent members. Now, it will continue copying over the subsequent members and inform the user that member(s)' contents were truncated and they can view the list of members affected in a local file.

How to Test

  1. With the current functionality, copy a source PDS into a target PDS. The target PDS should have a lower record lines value than the source.
  2. Notice that a member with a long record length will be truncated, and subsequent members will not continue to copy over.
  3. Now with the updated functionality, copy the same source PDS into a target PDS with a lower record lines value than the source.
  4. Notice that the user is informed of the truncation and is given a local file of members with this error. The subsequent members were copied over as well.

Review Checklist
I certify that I have:

Additional Comments

Should this technically be a bug fix?
Should the Github security suggestion about using the tmp library be ignored?

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@pujal0909 pujal0909 changed the title Truncate lrecl target Record lines truncation error - target data set Feb 9, 2025
Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.

Project coverage is 91.50%. Comparing base (b91b989) to head (e35a30d).
Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
packages/zosfiles/src/methods/copy/Copy.ts 90.24% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2433      +/-   ##
==========================================
- Coverage   91.50%   91.50%   -0.01%     
==========================================
  Files         641      641              
  Lines       18376    18414      +38     
  Branches     3872     3885      +13     
==========================================
+ Hits        16815    16849      +34     
- Misses       1559     1562       +3     
- Partials        2        3       +1     

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

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@pujal0909 pujal0909 changed the title Record lines truncation error - target data set Record lines truncation of target data set Enhancement Feb 10, 2025
@pujal0909 pujal0909 changed the title Record lines truncation of target data set Enhancement Record lines truncation of target PDS Enhancement Feb 11, 2025
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@pujal0909 pujal0909 force-pushed the truncate-lrecl-target branch from a439165 to c62d262 Compare February 12, 2025 19:51
pujal0909 and others added 2 commits February 12, 2025 14:53
Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@pujal0909 pujal0909 marked this pull request as ready for review February 13, 2025 13:24
Copy link

📅 Suggested merge-by date: 2/27/2025

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
traeok

This comment was marked as outdated.

@traeok traeok self-requested a review February 21, 2025 15:37
@traeok traeok dismissed their stale review February 21, 2025 15:38

Misread conditional logic

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.

Changes LGTM, thanks @pujal0909 for adding the truncation warning!

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! 😋

I'm curious to know if it would be possible to add a progress bar.
Trying to copy a PDS with almost 200 members looks like the command hands 😋

Also... I'm afraid that some errors are not being shown 🤔
image


As a final test, I let it run and here is what happened:
image

Here you can see that the command result only mentions the members that it was able to copy. (24 out of 193)
But it didn't mention the members that were not copied. likely due to not having enough space on the target PDF 🙏


All of that said, I do believe that this PR does handle quite a bit of scenarios and we could tackle these edge cases in a separate issue 🙏

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
const truncatedMembersFile = path.join(tmpdir(), 'truncatedMembers.txt');
if(truncatedMembers.length > 0) {
const firstTenMembers = truncatedMembers.slice(0, 10);
fs.writeFileSync(truncatedMembersFile, truncatedMembers.join('\n'), {flag: 'w'});

Check failure

Code scanning / CodeQL

Insecure temporary file High

Insecure creation of file in
the os temp dir
.
Copy link
Member

Choose a reason for hiding this comment

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

We've already determined that we are fine with writing the list of truncated members in a temporary file : )

Ideally we would make sure the file permissions are 600

Copy link
Member

Choose a reason for hiding this comment

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

We've already determined that we are fine with writing the list of truncated members in a temporary file : )

Ideally we would make sure the file permissions are 600

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@pujal0909 pujal0909 requested a review from anaxceron February 25, 2025 02:56
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Copy link

Reminder: This pull request has a merge-by date coming up within the next 24 hours. Please review this PR as soon as possible.

@awharn @adam-wolfe @jace-roell @ATorrise @t1m0thyj @anaxceron

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Copy link
Contributor

@anaxceron anaxceron left a comment

Choose a reason for hiding this comment

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

Left a couple comments re: changelog.

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Copy link
Contributor

@anaxceron anaxceron left a comment

Choose a reason for hiding this comment

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

Nice changelogs! Thanks @pujal0909!

Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
@zFernand0
Copy link
Member

Found this issue while testing, but this also on the master branch

> zdev files copy ds DS.DOES.NOT.EXIST fernando.test.pds.small      [±truncate-lrecl-target ✓(✹)]
Unable to perform this operation due to the following problem.
Cannot read properties of undefined (reading 'dsorg')

Response From Service
TypeError: Cannot read properties of undefined (reading 'dsorg')

I believe we will need to handle missing datasets in the isPDS function, and maybe fail a bit more gracefully 🙏
image

@zFernand0 zFernand0 dismissed ATorrise’s stale review February 26, 2025 16:17

I believe these requested-changes were addressed 🙏

@zFernand0 zFernand0 merged commit 16b4a25 into master Feb 26, 2025
25 checks passed
@zFernand0 zFernand0 deleted the truncate-lrecl-target branch February 26, 2025 16:18
@zFernand0 zFernand0 added the release-current Indicates that there is no new functionality being delivered label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-current Indicates that there is no new functionality being delivered
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

7 participants