Skip to content

Add _ENCODE_FILE_NEW and _ENCODE_FILE_EXISTING variables#105

Open
sabi789 wants to merge 4 commits into
zopencommunity:mainfrom
sabi789:main
Open

Add _ENCODE_FILE_NEW and _ENCODE_FILE_EXISTING variables#105
sabi789 wants to merge 4 commits into
zopencommunity:mainfrom
sabi789:main

Conversation

@sabi789
Copy link
Copy Markdown
Member

@sabi789 sabi789 commented May 5, 2026

No description provided.

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

augmentcode Bot commented May 5, 2026

🤖 Augment PR Summary

Summary: This PR extends the z/OS (MVS) Bash port to expose two additional encoding-related special variables.

Changes:

  • Adds _ENCODE_FILE_NEW and _ENCODE_FILE_EXISTING to the special_vars table (MVS-only)
  • Introduces sv_encode_file_new and sv_encode_file_existing hooks that synchronize these shell variables to same-named environment variables
  • Updates variables.h declarations (within __MVS__) for the new hook functions
  • Adds an MVS-specific include (<_Nascii.h>) to support the existing autoconversion hook code

Technical Notes: The new hooks aim to influence both child process environments and encoding behavior for file operations on z/OS.

🤖 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. 1 suggestion posted.

Fix All in Augment

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

Comment thread stable-patches/variable.patch Outdated
+
+ value = value_cell (v);
+ /* Set the environment variable for child processes and file operations */
+ if (setenv("_ENCODE_FILE_NEW", value, 1) != 0)
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 5, 2026

Choose a reason for hiding this comment

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

setenv/unsetenv here may conflict with Bash’s own export_env/environ management (Bash can point environ at an internal buffer), which can lead to stale pointers or child processes not seeing the updated values. Other locations where this applies: stable-patches/variable.patch:68, stable-patches/variable.patch:91, stable-patches/variable.patch:97.

Severity: high

Other Locations
  • stable-patches/variable.patch:68
  • stable-patches/variable.patch:91
  • stable-patches/variable.patch:97

Fix This in Augment

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

@IgorTodorovskiIBM
Copy link
Copy Markdown
Member

Do we support _ENCODE_FILE_EXISTING in zoslib now?

@HarithaIBM HarithaIBM linked an issue May 6, 2026 that may be closed by this pull request
sabi789 added 2 commits May 6, 2026 06:03
Signed-off-by: sabi789 <sabithac6298@gmail.com>
Signed-off-by: sabi789 <sabithac6298@gmail.com>
@sabi789
Copy link
Copy Markdown
Member Author

sabi789 commented May 6, 2026

:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
:/home/sabitha/zostools/zopen_sabi/bashport>export _ENCODE_FILE_NEW=UTF-8
:/home/sabitha/zostools/zopen_sabi/bashport>echo "hello" > newfile3.txt
:/home/sabitha/zostools/zopen_sabi/bashport>ls -T newfile3.txt
t ISO8859-1 T=on -rw-rw-r-- 1 SABITHA SYSPGMR 6 May 6 07:28 newfile3.txt
:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
_ENCODE_FILE_NEW=UTF-8
:/home/sabitha/zostools/zopen_sabi/bashport>export _ENCODE_FILE_EXISTING=ISO8859-1
:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
_ENCODE_FILE_EXISTING=ISO8859-1
_ENCODE_FILE_NEW=UTF-8
:/home/sabitha/zostools/zopen_sabi/bashport>ls -T newfile3.txt
t ISO8859-1 T=on -rw-rw-r-- 1 SABITHA SYSPGMR 6 May 6 07:28 newfile3.txt
:/home/sabitha/zostools/zopen_sabi/bashport>cat newfile3.txt
hello
:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
_ENCODE_FILE_EXISTING=ISO8859-1
_ENCODE_FILE_NEW=UTF-8
:/home/sabitha/zostools/zopen_sabi/bashport>unset _ENCODE_FILE_NEW
:/home/sabitha/zostools/zopen_sabi/bashport>unset _ENCODE_FILE_EXISTING
:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
:/home/sabitha/zostools/zopen_sabi/bashport>export _ENCODE_FILE_NEW=IBM-1047
:/home/sabitha/zostools/zopen_sabi/bashport>env | grep _ENCODE_FILE
_ENCODE_FILE_NEW=IBM-1047
:/home/sabitha/zostools/zopen_sabi/bashport>echo "hello" > newfile4.txt
:/home/sabitha/zostools/zopen_sabi/bashport>ls -T newfile4.txt
t IBM-1047 T=on -rw-rw-r-- 1 SABITHA SYSPGMR 6 May 6 07:31 newfile4.txt
:/home/sabitha/zostools/zopen_sabi/bashport>cat newfile4.txt
hello
:/home/sabitha/zostools/zopen_sabi/bashport>unset _ENCODE_FILE_NEW

Signed-off-by: sabi789 <sabithac6298@gmail.com>
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.

Introduce _ENCODE_FILE_EXISTING env variable

2 participants