Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4635483

Problem with scripts of SUNWj*rt, SUNWj3rt and SUNWj*dev in S8u7/S9.

XMLWordPrintable

    • 12
    • generic
    • solaris_8
    • Verified

        ###@###.### 2002-02-08

        HW: sun4m, x86
        SW: S8U7 => s9_55
        Cluster: SUNWCprog, SUNWCall
        Media: CD 1of2 + 2of2 + lang CD
        Method: suninstall/ttinstall upgrades w/DSR
        Locales: ja,ja_JP.PCK,ja_JP.UTF-8,en_US
        Isa bits: 32

        For these upgrades the following error for pkg SUNWj2rt appears in the upgrade log. This only seems to happen w/ DSR upgrades. I have attached one of the upgrade logs to this report.

        -------------------------------------------------
        Removing package SUNWj2rt:
        /a/var/sadm/pkg/SUNWj2rt/install/postremove: test: argument expected
        pkgrm: ERROR: postremove script did not complete successfully

        Removal of <SUNWj2rt> failed.
        pkgrm return code = 1
        -------------------------------------------------


        Here is the SUNWj2rt relevant excerpt from the logfile Solaris_9_packages__part_2__install.B02071000:
        ---------------------------------
        Installing Package: SUNWj2rt


        Processing package instance <SUNWj2rt> from </cdrom/sol_9_ia_2/Solaris_9/Produ
        ct>

        JDK 1.2 run time environment
        (i386) 1.2.2,REV=2001.09.11.08.00

        This appears to be an attempt to install the same architecture and
        version of a package which is already installed. This installation
        will attempt to overwrite this package.

        Using </usr> as the package base directory.
        ## Processing package information.
        ## Processing system information.
           4 package pathnames are already properly installed.

        Installing JDK 1.2 run time environment as <SUNWj2rt>

        ## Installing part 1 of 1.
        ## Executing postinstall script.

        Installation of <SUNWj2rt> was successful.
        Copyright 2001 Sun Microsystems, Inc. All rights reserved.
        48548 blocks
        Installed Package: SUNWj2rt
        ---------------------------------------------------------


        ###@###.### 2002-02-11

        I ran pkgremove in debugging mode in the same upgrade from s8u7 FCS to s81_56 and found the following:

        Removing package SUNWj2rt:
        SHARED_LINK=/a/usr/java
        SHARED_LOCATION=/a/usr/bin
        SYS_CONTENTS_FILE_NAME=contents
        DEFAULT=FALSE
        + removef -f SUNWj2rt
        SYS_CONTENTS=/a/var/sadm/install/contents
        + CheckDefault
        + grep+ awk^/usr/java= { n=index($0, "SUNW"); if (n != 0) {
                print substr($0, n); } }/a/var/sadm/install/contents

        sharLinkRec=SUNWj2dev
        + + echoawk SUNWj2dev{ if ($NF ~ /^\-.*/ || $NF ~ /^\+.*/) print substr($NF, 2)
        ; else print $NF }

        prevPkg=SUNWj2dev
        + echo SUNWj2dev
        + awk { if ($NF ~ /^\-.*/ || $NF ~ /^\+.*/) str=substr($NF, 2); else str=$NF; sp
        lit(str, arr, "."); print arr[1]; }
        prevPkgCl=SUNWj2dev
        + [ -n SUNWj2dev ]
        DEFAULT=TRUE
        + [ SUNWj2dev = SUNWjvrt ]
        + [ SUNWj2dev = SUNWj2rt ]
        FIND_BIN=\/native_threads\/javac
        + grep SUNWj2dev /a/var/sadm/install/contents
        + grep \/native_threads\/javac f
        + awk BEGIN{savedLn=""}{ if (NR == 1) {savedLn=$1; next; }
                         if (length(savedLn) > length($1)) savedLn=$1; }
        END{print savedLn;}
        + sed s/\/bin\/[a-z0-9]*\/native_threads\/javac//
        link=/usr/java1.2
        + echo /usr/java1.2
        + echo /usr/java1.2
        + sed s/.*\/java1\./\.\/java1\./
        + sed s/java1.2\/jre/java1.2/
        link=./java1.2
        + [ -z ./java1.2 ]
        + [ TRUE = FALSE ]
        + MoveLink
        + [ -n SUNWj2dev ]
        + installf -c none SUNWj2dev /a/usr/java=./java1.2 s
        + RestoreLinks SUNWj2dev
        + + awkecho {print $NF}SUNWj2dev

        latestPkg=SUNWj2dev
        + [ XSUNWj2dev != X ]
        + [ SUNWj2dev != SUNWj2dev ]
        allPkg=
        othersPkg=
        + [ X/a != X ]
        + pkginfo -R /a -l SUNWj2dev
        + grep VERSION:
        + awk {print $2}
        lVersion=1.2.2,REV=2001.09.10.12.37
        + [ X != X ]
        + grep ../java/bin /a/var/sadm/install/contents
        + grep SUNWj2dev
        + awk {print $1}
        bitList= /usr/bin/appletviewer=../java/bin/appletviewer
        /usr/bin/extcheck=../java/bin/extcheck
        /usr/bin/jar=../java/bin/jar
        /usr/bin/jarsigner=../java/bin/jarsigner
        /usr/bin/javac=../java/bin/javac
        /usr/bin/javadoc=../java/bin/javadoc
        /usr/bin/javah=../java/bin/javah
        /usr/bin/javald=../java/bin/javald
        /usr/bin/javap=../java/bin/javap
        /usr/bin/jdb=../java/bin/jdb
        /usr/bin/native2ascii=../java/bin/native2ascii
        /usr/bin/oldjava=../java/bin/oldjava
        /usr/bin/rmic=../java/bin/rmic
        /usr/bin/serialver=../java/bin/serialver
        + echo /usr/bin/appletviewer=../java/bin/appletviewer
        + sed s/=/ /
        + awk {print $2}
        rFile=../java/bin/appletviewer
        + echo /usr/bin/appletviewer=../java/bin/appletviewer
        + sed s/=/ /
        + awk {print $1}
        rLink=/usr/bin/appletviewer
        + [ ! -h /a/usr/bin/appletviewer ]
        + [ -e ../java/bin/appletviewer ]
        /a/var/sadm/pkg/SUNWj2rt/install/postremove: test: argument expected
        pkgrm: ERROR: postremove script did not complete successfully

        Removal of <SUNWj2rt> failed.


        If you do upgrade with Disk Space reallocation, upgrade will only back up essential files and newfs the disk, thus it is like a new install and /a/java/bin/appletviewer will not be on the system. The postremove script need to be smarter to handle this correctly.

        The postremove script that had problem is as follow:

          for link in $bitList; do
            rFile=`echo $link | sed 's/=/ /' | awk '{print $2}'`
            rLink=`echo $link | sed 's/=/ /' | awk '{print $1}'`
            if [ ! -h $PKG_INSTALL_ROOT$rLink ] && [ -e $rFile ]; then
              ln -s $rFile $PKG_INSTALL_ROOT$rLink
            fi
          done
        Shouln't we have something to check the file existence relative to /a instead of ../java/bin/appletviewer ?

        I had enclosed the upgrade_log.debug with pkgremove running in -v mode.




        ###@###.### 2002-02-12

        I talked to John Perry this morning about this bug and he reminded me to look at the SUNWj2rt package that is in s81_56. It turned out that it was the same package that was delivered in S8u7. So the postremove script in S9 also need to be fixed. Otherewise, when people do S9 FCS upgrade with DSR to later S9 Update releases and to S10 or future Solaris release will have problem.

        The postremove script in s81_56 SUNWj2rt also had problem as follow:

          for link in $bitList; do
            rFile=`echo $link | sed 's/=/ /' | awk '{print $2}'`
            rLink=`echo $link | sed 's/=/ /' | awk '{print $1}'`
            if [ ! -h $PKG_INSTALL_ROOT$rLink ] && [ -e $rFile ]; then
              ln -s $rFile $PKG_INSTALL_ROOT$rLink
            fi
          done

        Besides SUNWj2rt, SUNWj3rt and SUNWj3dev postremove scripts also had similar problems in S9.


        dong{ding}1458: cd S*/Pr*
        /export/s9/combined.s9s_wos/latest/Solaris_9/Product
        dong{ding}1459: grep rFile */install/*remove
        SUNWj2rt/install/postremove: rFile=`echo $link | sed 's/=/ /' | awk '{print $2}'`
        SUNWj2rt/install/postremove: if [ ! -h $PKG_INSTALL_ROOT$rLink ] && [ -e $rFile ]; then
        SUNWj2rt/install/postremove: ln -s $rFile $PKG_INSTALL_ROOT$rLink
        SUNWj3dev/install/postremove: rFile=`echo $link | sed 's/=/ /' | awk '{print $2}'`
        SUNWj3dev/install/postremove: if [ ! -h $PKG_INSTALL_ROOT$rLink ] && [ -e $rFile ]; then
        SUNWj3dev/install/postremove: ln -s $rFile $PKG_INSTALL_ROOT$rLink
        SUNWj3rt/install/postremove: rFile=`echo $link | sed 's/=/ /' | awk '{print $2}'`
        SUNWj3rt/install/postremove: if [ ! -h $PKG_INSTALL_ROOT$rLink ] && [ -e $rFile ]; then
        SUNWj3rt/install/postremove: ln -s $rFile $PKG_INSTALL_ROOT$rLink
        dong{ding}1460:

        For S8 and older releases, SUNWj2rt, SUNWj2dev, SUNWj3rt and SUNWj3dev also had the same problem.

        This had to be fixed in S9 or it will be a problem with upgrade with DSR down the line in future Solaris releases.



        ###@###.### 2002-02-13

        It turns out that test -e option is only supported in ksh and not in sh.
        So we will need to do /usr/bin/test -e in order for the script to work, perhaps something like:



        if [ ! -h $PKG_INSTALL_ROOT$rLink ] && /usr/bin/test -e $PKGINSTALL_ROOT/usr/bin/$rFile; then
              ln -s $rFile $PKG_INSTALL_ROOT$rLink
            fi

        In the process of checking this out with upgrade with DSR and see whether this will work.







        ###@###.### 2002-02-13

        It turns out that the postinstall scripts for the following java packages also do test -e and they had to be fixed too:

        1. SUNWj3rt/postinstall script:

         for ln_str in $links_strs; do
            installf -c none $PKGINST "$SHARED_LOCATION/$ln_str=../java/bin/$ln_str" s
            installf -f $PKGINST
            if [ ! -h $SHARED_LOCATION/$ln_str ] && [ -e ../java/bin/$ln_str ]; then
              ln -s ../java/bin/$ln_str $SHARED_LOCATION/$ln_str
            fi
          done

        2. SUNWj3dev/postinstall script:

         for ln_str in $links_strs; do
            installf -c none $PKGINST "$SHARED_LOCATION/$ln_str=../java/bin/$ln_str" s
            installf -f $PKGINST
            if [ ! -h $SHARED_LOCATION/$ln_str ] && [ -e ../java/bin/$ln_str ]; then
              ln -s ../java/bin/$ln_str $SHARED_LOCATION/$ln_str
            fi
          done

        Please do an audit to see what other bourne shell scripts are using -e option and get those fixed.

              ccheung Calvin Cheung
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: