Skip to content

Add _ENCODE_FILE_EXISTING variable#4

Closed
sabi789 wants to merge 1 commit into
zopen2from
zopen2
Closed

Add _ENCODE_FILE_EXISTING variable#4
sabi789 wants to merge 1 commit into
zopen2from
zopen2

Conversation

@sabi789
Copy link
Copy Markdown
Member

@sabi789 sabi789 commented May 12, 2026

No description provided.

Signed-off-by: sabi789 <sabithac6298@gmail.com>
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 12, 2026

🤖 Augment PR Summary

Summary: Adds an environment override for how existing files are opened via _ENCODE_FILE_EXISTING, and expands UTF-8 support coverage.

Changes:

  • Introduce __tag_existing_file() and apply it in the ASCII open/fopen overrides for regular files
  • Update the manpage to document _ENCODE_FILE_NEW=UTF-8 and the new _ENCODE_FILE_EXISTING options
  • Add unit tests covering UTF-8 new-file tagging and existing-file overrides (IBM-1047/BINARY/ISO8859-1/UTF-8)

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread man/zoslib.1
.B _ENCODE_FILE_NEW=BINARY

.TP
.B _ENCODE_FILE_NEW=UTF-8
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

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

man/zoslib.1:26: This .TP starts a new term immediately after _ENCODE_FILE_NEW=BINARY, which leaves the BINARY option with no description and makes the “tagged as BINARY” paragraph apply to the UTF-8 entry instead.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread src/zos-io.cc
}
// Enable auto-conversion of untagged files
else if (S_ISREG(sb.st_mode)) {
__tag_existing_file(fd);
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

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

src/zos-io.cc:894: The return value from __tag_existing_file(fd) is ignored and errno is reset unconditionally, so failures (e.g., invalid _ENCODE_FILE_EXISTING or a failing tag operation) can be silently dropped while still returning a usable fd.

Severity: medium

Other Locations
  • src/zos-io.cc:939

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

write(fd, buff, sizeof(buff));
close(fd);

fd = open(temp_path, O_RDONLY);
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

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

test/test-clib-override.cc:191: This fd isn’t closed before remove(temp_path) and reassigning fd, which can leak a descriptor and make the subsequent remove() behavior platform-dependent. It also means the final close(fd) later in the test may double-close or close the wrong descriptor.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@zopencommunity zopencommunity closed this by deleting the head repository May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants