Skip to content

Executing an UTF-8 tagged file via shebang throws an error #94

@shjeong9

Description

@shjeong9

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions