Bug #36612 solaris pkg post-install scripts broken
Submitted: 9 May 2008 5:10 Modified: 15 May 2008 15:44
Reporter: Timothy Smith Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.0.51a OS:Solaris (Solaris 10)
Assigned to: CPU Architecture:Any

[9 May 2008 5:10] Timothy Smith
Description:
There's been a couple of errors packaging up MySQL Community Server for
Solaris 10 ... critical errors, which prevent the system databases etc from
being initialized.

My platform is a Solaris 10, nov06 sparc install, reasonably patched, with
pretty much everything installed. (MySQL 4 SUNW packages were removed)

I am installing the mysql-5.50.51a-solaris10-sparc-64bit.pkg.gz which I
downloaded the other day.  This is a typical package stream, with a
post-install script.  The pkginfo indicates

   PKGINST:  mysql
      NAME:  MySQL Community Server (GPL)
  CATEGORY:  application
      ARCH:  sun4u
   VERSION:  5.0.51a
   BASEDIR:  /opt/mysql
    VENDOR:  MySQL AB
    PSTAMP:  MySQL AB Build Engineers
  INSTDATE:  May 06 2008 14:28
     EMAIL:  build@mysql.com
    STATUS:  completely installed
     FILES:     2319 installed pathnames
                  84 directories
                 178 executables
              383815 blocks used (approx)

How to repeat:
Okay, so what's wrong?  Two things:

1.  The post-install script uses the "/bin/sh" shell, and the bang operator
to negate a test (if ! test -x ...) This generates the syntax error "!: not
found" a couple of times.  To correct this, there are couple of solutions --
use /bin/bash as the script interpreter, or, you can probably use
/usr/xpg4/bin/sh as the script interpreter. XPG4 supports the bang syntax
but I did not test the whole post install script.

*My Workaround: I temporarily replaced the /bin/sh symlink with a link to
/bin/bash*

2. When the post-install script launches mysqld, it gives up root
permissions and becomes mysql.  This is reasonable behaviour, however,
mysqld needs to be able to create files/dirs in /var/tmp/installXXXXXX.
This is not possible, because the post-install script creates that tmpdir
with 0700 perms and root ownership. I _did_ try modifying my shell's umask
and group membership before launching pkgadd.

Specifically, EACCES on open("/var/tmp//installczaqrE/#sql3cf3_1_0.frm",
O_WRONLY_O_CREAT|O_EXCL, 0100660) on a non-primordial thread (thread 3) of
mysqld causes it to close ./mysql/db.frm (which it had just opened), return
error 1004 to stderr, and the LWP exits.  As soon as thread id 3 exits,
thread 1 reports it is aborting, kills thread 2, and exits with WEXITSTATUS
== 1.  This is a fatal error, and causes the post-install script to abort,
leaving the package in a half-installed state.

*My Workaround: While the package was installing, I chmod 777'd
/var/tmp/install**

Suggested fix:
With my two work-arounds in place, I was able to successfully install MySQL
from the distribution package. However, these workarounds are pretty
unreasonable, and a proper fix should be a piece of cake.

Let me know if you want help testing.  I also snagged a truss of a busted
install if you're curious.
[15 May 2008 15:44] Valeriy Kravchuk
Item 1 looks like a duplicate of bug #35778 and/or bug #35723.

Item 2 looks like a duplicate of bug #31164.