z/OS Tools & Language

Expand all | Collapse all

Bash 4.3.46 translates .bashrc before execution

  • 1.  Bash 4.3.46 translates .bashrc before execution

    Posted 01-11-2017 18:54

    When invoking bash as an interpreter, it is converting the .bashrc characters before trying to execute the commands inside. This does not occur with bash 4.2.53.

    4.3.46 startup:

    $ ./ported/bin/bash --version
    GNU bash, version 4.3.46(6)-release (i370-ibm-openedition)
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    
    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    $ ./ported/bin/bash
    bash:$'\205\247\227\226\231\243@\327\301\343\310~\241a\202\211\225z[\327\301\343\310\025\205\247\227\226\231\243@\324\301\325\327\301\343\310~\241a\224\201\225z[\324\301\325\327\301\343\310\025\205\247\227\226\231\243@\327\350\343\310\326\325\310\326\324\305~\241a\202\211\225\025\205\247\227\226\231\243@\327\350\343\310\326\325\327\301\343\310~\241a\223\211\202a\227\250\243\210\226\225\362K\367\025\205\247\227\226\231\243@\327\305\331\323\365\323\311\302~\241a\223\211\202z[\327\305\331\323\365\323\311\302\025\205\247\227\226\231\243@\323\311\302\327\301\343\310~\241a\223\211\202a\365K\362\362K\360a\226\242\363\371\360a\303\326\331\305z[\323\311\302\327\301\343\310\025\025\344\325~\177y\205\203\210\226@[\344\342\305\331@O@\243\231@}\255z\244\227\227\205\231z\275}@}\255z\223\226\246\205\231z\275}y\177\025\310\325~\177y\205\203\210\226@[\310\326\342\343\325\301\324\305@O@\243\231@}\255z\244\227\227\205\231z\275}@}\255z\223\226\246\205\231z\275}y\177\025\025\327\342\361~}\340\246@n@}\025\025\211\206@\255\255@[\343\305\331\324@~~@}\247\243\205\231\224}@\275\275\025@@\243\210\205\225\025@@@@\327\342\361~}\340\255\340\205\255\360^\363\362\224\340\275\255[\344\325': command not found
    bash: $'\223}\025\201\223\211\201\242@\223\223\201~}\223\242@': command not found
    bash: $'\204}\025\201\223\211\201\242@\247\245\206\226~}\243\201\231@': command not found
    bash: $'[\310\325\275\340\255\340\205\255\224\340\275@\340\255\340\205\255\361^\363\364\224\340\275\340\246\340\255\340\205\255\224\340\275@\340\255\340\205\255\361^\363\362\224\340\275\340\225\340[\340\255\340\205\255\224\340\275@\340\255\340\205\255\361^\363\367\224\340\275}\025\206\211\025\025\201\223\211\201\242@\223\223~}\223\242@\223\201}\025\201\223\211\201\242@\207\251\211\227\204~}\207\251\211\227@\247\245\206\226}\025': command not found
    bash-4.3$
    

    4.2.53 startup:

    $ ./bin/bash --version
    GNU bash, version 4.2.53(2)-release (i370-ibm-openedition)
    Copyright (C) 2011 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    
    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    $ ./bin/bash
    [$USER@$SERVER] ~
    $
    

    The .bashrc file is also translated to a different character encoding after starting the latest version of bash. However, if I start bash 4.3 without an empty, or nonexistent .bashrc file then bash starts correctly:

    $ ./ported/bin/bash --version
    GNU bash, version 4.3.46(6)-release (i370-ibm-openedition)
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    
    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    $ ls -la ~ | grep .bashrc
    $ ./ported/bin/bash
    bash-4.3$
    

    This is my .profile with the exports from the install README.ZOS document:

    export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
    export _BPXK_AUTOCVT=ON
    export _TAG_REDIR_ERR=txt
    export _TAG_REDIR_IN=txt
    export _TAG_REDIR_OUT=txt
    

    I’ve searched through the forums and saw a reference to this in a git+bash forum, but it hasn’t been answered, and I feel this problem warrants its own thread. Is there currently any way to circumvent this problem?



  • 2.  RE: Bash 4.3.46 translates .bashrc before execution

    Posted 01-12-2017 10:55

    Hmmm. I’ve done some testing, but since there are so many interacting pieces (login vs. non-login shells, interactive vs. non-interactive shells, presence or absence of /etc/profile, various dot files, etc…), it’s hard to be sure what’s going on.

    That said - it SEEMS to be the case that if I:

    • encode my .bashrc as EBCDIC
    • tag .bashrc as EBCDIC (using chtag -tc 1047.bashrc)

    then it works.

    Can you give that a try?



  • 3.  RE: Bash 4.3.46 translates .bashrc before execution

    Posted 01-12-2017 20:32

    This fixed it! Thanks!