Open-source Languages & Tools for z/OS

 View Only
  • 1.  Bash not finding externally linked files

    Posted 08-02-2016 12:40

    Just started testing bash out and ran across an issue where if a file is externally linked ie ln -e ONETSTAT /bin/netsat bash fails to find the file

    CARROS1:/home/carros1: >netstat
    -bash: netstat: command not found
    CARROS1:/home/carros1: >ls -la /bin | grep -i netstat
    erwxrwxrwx 1 TCPIPST OMVSGRP 8 Jul 23 2013 netstat -> ONETSTAT
    lrwxrwxrwx 1 TCPIPST OMVSGRP 29 Jul 23 2013 onetstat -> …/usr/lpp/tcpip/bin/onetstat

    onetstat works

    now if I create a symbolic like in say $HOME/bin
    lrwxrwxrwx 1 PSC050 OMVSGRP 12 Aug 2 12:12 netstat -> /bin/netstat

    this it find but does not run
    CARROS1:/home/carros1/bin: >./netstat
    Killed

    it is killed instead

    on the console I have this
    BPXP028I SPAWN OR EXEC ERROR FOR FILE PATH ./netstat DEVICE ID 169 957
    INODE 22892. THE ASSOCIATED MVS MEMBER NAME IS ONETSTAT.

    SYS1.SEZALOAD which is where ONETSTAT resides is LINKLIST’d and in LPA. So it should be finding it
    If I add a STEPLIP in OMVS to SYS1.SEZALOAD it works fine.

    I do not have this behavior with /bin/sh or /bin/tcsh

    does anyone else have this behavior?
    I’d like to find out if this is a bug in bash or in our environement

    Sandra



  • 2.  RE: Bash not finding externally linked files

    Posted 08-02-2016 14:10

    I was able to reproduce this problem here at Rocket (using /bin/netstat, which, as in your case, is an external link to ONETSTAT). I can invoke netstat using both /bin/sh and /bin/tcsh.

    For others looking into this, here are some useful links:

    The last of those explains why the symbolic link doesn’t work - the link needs to have an owning UID of 0. However, that doesn’t explain the “command not found” from bash (the problem actually being reported).

    SO - I would say that it looks like a problem with bash, not a problem with your environment.



  • 3.  RE: Bash not finding externally linked files

    Posted 08-02-2016 14:55

    I think I know the root cause. The man page for “ln” (see above) contains this statement:

    exec() does a stat() on the passed filename. stat() does the search, not exec(). If the filename is an external link, then stat() fails with a unique reason code which causes exec() to read the external link.

    I confirmed that, in fact, stat() fails for an external link. bash checks the path to a command before it tries to exec it to make sure it is executable, using stat(). bash would have to be modified to look for the specific reason code from stat() and ignore it to get it to follow external links.



  • 4.  RE: Bash not finding externally linked files

    Posted 08-03-2016 08:59

    Enhancement ticket USSP-476 opened to add support for z/OS external links



  • 5.  RE: Bash not finding externally linked files

    Posted 10-30-2020 13:31
    Hello,
    I know I'm resurrecting an old thread, but I can't seem to find any answers and I'm encountering the exact same issue as the OP. I've just installed bash 4.3.46(51)-release in my z/OS 2.3 environment. Everything is working fine except for the openMVS tcpip utilities, such as netstat. I also can create a link to netstat and put the SEZALOAD expressly in the $STEPLIB envar, like the OP. Was there ever a resolution to this problem? Was USSP-476 accepted as an enhancement and worked on? Are there any other workarounds for this issue rather than creating the links and adding to the STEPLIB envar?
    Thanks!
    Andrew

    ------------------------------
    Andrew Arentsen
    Acuity Insurance
    ------------------------------



  • 6.  RE: Bash not finding externally linked files

    ROCKETEER
    Posted 11-02-2020 07:34

    Hi Andrew,

    Unfortunately, it's not fixed yet.

    As a workaround, you can add the alias for netstat in ~/.bashrc:

    alias netstat='/bin/netstat'

    or

    alias netstat='/bin/onetstat'

    Thanks.



    ------------------------------
    Sergey Rezepin
    Rocket Software
    ------------------------------



  • 7.  RE: Bash not finding externally linked files

    Posted 11-04-2020 07:43
    Thanks for the reply, Sergey. I've added the aliases in as a successful workaround.

    Andrew

    ------------------------------
    Andrew Arentsen
    Acuity Insurance
    ------------------------------



  • 8.  RE: Bash not finding externally linked files

    Posted 08-03-2016 09:21

    Thank you both for taking such a quick look at this and a quick action of getting it added to support.



  • 9.  RE: Bash not finding externally linked files

    Posted 10-05-2016 07:37

    Have you posted a fix for this yet?
    I’ve aliased netstat=onetstat,
    ping=oping
    but would appreciate a fix for it