Menu

#1542 STAFInst USE_PYTHON_SYSTEM_PATH option does not work on Solaris or FreeBSD

Next
closed-fixed
Install (167)
5
2015-03-24
2015-03-24
No

On Solaris (any architecture) or FreeBSD, when installing STAF via the tar.gz install file and STAFInst, -option USE_PYTHON_SYSTEM_PATH=1 does not work correctly.

For example, on staf3b (Solaris-x86):

bash-3.2# pwd
/tmp
bash-3.2# gunzip STAF3420-solaris-x86.tar.gz
bash-3.2# tar xf STAF3420-solaris-x86.tar
bash-3.2# cd staf
bash-3.2# PATH=/opt/Python-3.1/bin:$PATH
bash-3.2# export PATH
bash-3.2# python -V
Python 3.1.2
bash-3.2# ./STAFInst -acceptlicense -target /tmp/staf3420 -option USE_PYTHON_SYSTEM_PATH=1
Installation successful
bash-3.2# cd ../staf34
bash-3.2# cd /tmp/staf3420/lib
bash-3.2# ls -l PYSTAF.so
lrwxrwxrwx   1 root     root          36 Mar 24 15:53 PYSTAF.so -> /tmp/staf3420/lib/python22/PYSTAF.so
bash-3.2#

The above shows that the system path contains the python command for Python 3.1 when STAFInst was run on this Solaris x86 system specifying option USE_PYTHON_SYSTEM_PATH=1. However, note that PYSTAF.so is incorrectly linked to STAF's Python 2.2 PYSTAF.so (Python 2.2 is the default Python version for Solaris x86) when it should have been linked to STAF's Python 3.1 PYSTAF.so (in /tmp/staf3420/lib/python31).

Similarly, on staf1c (FreeBSD):

# pwd
/tmp
# tar xfz STAF3420-freebsd.tar.gz
# cd staf
# pwd
/tmp/staf
# echo $PATH
# export PATH=/opt/Python-3.1/bin:$PATH
# python -V
Python 3.1.2
# ./STAFInst -acceptlicense -target /tmp/staf3420 -option USE_PYTHON_SYSTEM_PATH=1
Installation successful
# cd ../staf3420/lib
# ls -l PYSTAF.so
lrwxr-xr-x  1 root  wheel  36 Mar 24 16:45 PYSTAF.so -> /tmp/staf3420/lib/python24/PYSTAF.so
#

The above shows that the system path contains the python command for Python 3.1 when STAFInst was run on the FreeBSD system specifying option USE_PYTHON_SYSTEM_PATH=1. However, note that PYSTAF.so is incorrectly linked to STAF's Python 2.4 PYSTAF.so (Python 2.4 is the default Python version for FreeBSD) when it shoudl have been linked to STAF's Python 3.1 PYSTAF.so (in /tmp/staf3420/lib/python31).

Also, note that option USE_PYTHON_SYSTEM_PATH=1 is working correctly on Linux and Linux-amd64.

Discussion

  • Sharon Lucas

    Sharon Lucas - 2015-03-24
    • summary: STAFInst USE_PYTHON_SYSTEM_PATH option does not work on Solaris --> STAFInst USE_PYTHON_SYSTEM_PATH option does not work on Solaris or FreeBSD
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -On Solaris (any architecture), when installing STAF via the tar.gz install file and STAFInst, -option USE_PYTHON_SYSTEM_PATH=1 does not work correctly.
    +On Solaris (any architecture) or FreeBSD, when installing STAF via the tar.gz install file and STAFInst, -option USE_PYTHON_SYSTEM_PATH=1 does not work correctly.
    
     For example, on staf3b (Solaris-x86):
    
    @@ -19,4 +19,27 @@
         lrwxrwxrwx   1 root     root          36 Mar 24 15:53 PYSTAF.so -> /tmp/staf3420/lib/python22/PYSTAF.so
         bash-3.2#
    
    -The above shows that the system path contains the python command for Python 3.1 when STAFInst was run specifying option USE_PYTHON_SYSTEM_PATH=1.  However, note that PYSTAF.so is incorrectly linked to STAF's Python 2.2 PYSTAF.so (Python 2.2 default Python version for Solaris x86) when it should have been linked to STAF's Python 3.1 PYSTAF.so (in /tmp/staf3420/lib/python31).
    +The above shows that the system path contains the python command for Python 3.1 when STAFInst was run on this Solaris x86 system specifying option USE_PYTHON_SYSTEM_PATH=1.  However, note that PYSTAF.so is incorrectly linked to STAF's Python 2.2 PYSTAF.so (Python 2.2 is the default Python version for Solaris x86) when it should have been linked to STAF's Python 3.1 PYSTAF.so (in /tmp/staf3420/lib/python31).
    +
    +Similarly, on staf1c (FreeBSD):
    +
    +    # pwd
    +    /tmp
    +    # tar xfz STAF3420-freebsd.tar.gz
    +    # cd staf
    +    # pwd
    +    /tmp/staf
    +    # echo $PATH
    +    # export PATH=/opt/Python-3.1/bin:$PATH
    +    # python -V
    +    Python 3.1.2
    +    # ./STAFInst -acceptlicense -target /tmp/staf3420 -option USE_PYTHON_SYSTEM_PATH=1
    +    Installation successful
    +    # cd ../staf3420/lib
    +    # ls -l PYSTAF.so
    +    lrwxr-xr-x  1 root  wheel  36 Mar 24 16:45 PYSTAF.so -> /tmp/staf3420/lib/python24/PYSTAF.so
    +    #
    +
    +The above shows that the system path contains the python command for Python 3.1 when STAFInst was run on the FreeBSD system specifying option USE_PYTHON_SYSTEM_PATH=1.  However, note that PYSTAF.so is incorrectly linked to STAF's Python 2.4 PYSTAF.so (Python 2.4 is the default Python version for FreeBSD) when it shoudl have been linked to STAF's Python 3.1 PYSTAF.so (in /tmp/staf3420/lib/python31).
    +
    +Also, note that option USE_PYTHON_SYSTEM_PATH=1 is working correctly on Linux and Linux-amd64.
    
    • Group: Unix::Solaris --> Next
     
  • Sharon Lucas

    Sharon Lucas - 2015-03-24

    The problem was caused by how STAFInst was using sed on the output from a "python -V" (or "python3 -V" command) to remove the leading "Python " and the trailing end of the version (e.g. "Python 3.1.2" --> "3.1"). This worked fine on Linux versions but not on Solaris or FreeBSD.

    This fix will be in STAF V3.4.21 which is planned to be released at the end of March 2015.

    Here's a cvs diff of the changes:

    $ cvs diff STAFInst
    Index: STAFInst
    ===================================================================
    RCS file: /cvsroot/staf/src/staf/install/unix/STAFInst,v
    retrieving revision 1.50
    diff -r1.50 STAFInst
    1146c1146
    <                 if [ "$OS" = "Darwin" ]
    ---
    >                 if [ "$OS" = "Darwin" ] || [ "$OS" = "FreeBSD" ]
    1148c1148
    <                     # sed on Mac OS X does not support special character '+'
    ---
    >                     # sed on Mac OS X and FreeBSD does not support special character '+'
    1149a1150,1154
    >                 elif [ "$OS" = "SunOS" ]
    >                 then
    >                     # Remove leading "Python " and remove last two characters from "python -V" output
    >                     # e.g. Python 2.4.3 -> 2.4
    >                     PYTHONVERSION=`python -V 2>&1 | sed 's/^Python //;s/..$//'`
    1192c1197
    <                     if [ "$OS" = "Darwin" ]
    ---
    >                     if [ "$OS" = "Darwin" ] || [ "$OS" = "FreeBSD" ]
    1194c1199
    <                         # sed on Mac OS X does not support special character '+'
    ---
    >                         # sed on Mac OS X and FreeBSD does not support special character '+'
    1195a1201,1205
    >                     elif [ "$OS" = "SunOS" ]
    >                     then
    >                         # Remove leading "Python " and remove last two characters from "python3 -V" output
    >                         # e.g. Python 3.4.3 -> 3.4
    >                         PYTHONVERSION=`python3 -V 2>&1 | sed 's/^Python //;s/..$//'`
    
     
  • Sharon Lucas

    Sharon Lucas - 2015-03-24
    • status: open --> closed-fixed
     

Log in to post a comment.