zopencommunity / zopencommunity/bashport
Executing an UTF-8 tagged file via shebang throws an error
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 12
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
We're hitting an error when executing an UTF-8 tagged file via shebang. It works fine with ISO8859-1 tagged files.
It looks that zopen bash isn't behaving like /bin/sh, it needs to inherit the _BPXK_AUTOCVT variable setting.
ZOS version: z/OS 3.2 (One thing to note that it works correctly using zopen-bash on zos2.4)
How to reproduce:
ZOS 3.2
IBMUSER:/u/ibmuser #>cat test_cat.sh
#!/bin/cat
Hello world
# tagged ISO8859-1
IBMUSER:/u/ibmuser #>ls -T test_cat.sh
t ISO8859-1 T=on test_cat.sh
IBMUSER:/u/ibmuser #>./test_cat.sh
#!/bin/cat
Hello world
bash-4.3$ env -i /opt/zopen/usr/local/bin/bash --norc
bash-5.2$ export _BPXK_AUTOCVT=ALL
bash-5.2$ ./test_cat.sh
./test_cat.sh: line 2: Hello: command not found
# if inherited
bash-5.2$ env -i _BPXK_AUTOCVT=ALL /opt/zopen/usr/local/bin/bash --norc
bash-5.2$ ./test_cat.sh
#!/bin/cat
Hello world
ZOS2.4
> env -i bash --norc
> export _BPXK_AUTOCVT=ALL
>./utf.sh
#!/bin/cat
Hello world
> env -i _BPXK_AUTOCVT=ALL bash --norc
> ./utf.sh
#!/bin/cat
Hello world
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue on z/OS 3.2 with test_cat.sh and the /opt/zopen/usr/local/bin/bash --norc entry point, comparing the explicit and inherited _BPXK_AUTOCVT cases. Compare this with the z/OS 2.4 and ISO8859-1 examples in the report. Done means a UTF-8 tagged script executed via shebang behaves correctly when the variable is inherited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100