Bug #25226 configure's --program-suffix does not do a complete job
Submitted: 20 Dec 2006 23:08 Modified: 16 Mar 2009 11:27
Reporter: Joshua Kugler (Basic Quality Contributor) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S4 (Feature request)
Version:5.0.34-BK, 5.0.27 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[20 Dec 2006 23:08] Joshua Kugler
Description:
MySQL's configure command has a command line option called --program-suffix by which you can append an arbitrary string to the names of the binaries that are compiled.  This seems like an ideal feature for installing multiple versions along side one another, as you can append strings like '4', '41', '5', and the like.  However, many of the names of binaries are hard coded in the auxiliary scripts, rendering this feature unusable.

Examples, from mysql_install_db.sh:

line 95: looks for the bindir by looking for $basedir/libexec/mysqld
line 126: set mysqld to $execdir/mysqld

This can especially bite you when you run the mysql_install_db.sh expecting it to find your new version, but instead it finds your existing version, connects to it, and updates your 4.1 'mysql' tables with 5.0 schemata!

This error is not confined to mysql_install_db.sh.  There are hardcoded binary names in:

mysqlaccess.sh
mysqlbug.sh
mysqld_safe.sh

And possibly others, those are just the ones I found in a brief search.

How to repeat:
Compile a new copy, and specify a custom suffix
Try to install it via the included scripts, and try running some of the other support scripts.

Suggested fix:
Everywhere a binary is referenced, a @program-suffix@ (or similar) needs to be placed so make's "search and replace" will put the proper suffix in the scripts.
[21 Dec 2006 14:10] Valeriy Kravchuk
Thank you for a problem report. It sounds like a reasonable (for some cases, like those you described) feature request to me, but it is not a bug. Suffix is for version name only, and nobody knows in advance what datadir and basedir you'll want to use. We never reference to particular version suffixes in the manual (http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html and others).
[21 Dec 2006 23:33] Joshua Kugler
That is not correct.  "suffix" is not for version name only.  From the configure help:

  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --with-server-suffix    Append value to the version string.

--with-server-suffix changes the version string

--program-suffix appends that string on to the name of the binaries.  Try it and see. :)  Trust me, if I run configure with --program-suffix=5, I end up with mysql5, mysqld5, mysqldump5, etc.

BUT!  The original bug report still stands: if I use a custom suffix, none of the prepackaged scripts work.

I was never saying to modify the basedir and datadir in advance.  All I was saying is that lines such as:

$basedir/libexec/mysqld

should be replace by:

$basedir/libexec/mysqld@program-suffix@ so when make does the substitution to create those files, the correct program suffix is added to the names of the binaries that are called.

I hope that clears things up.

Please reopen this as a bug.
[22 Dec 2006 7:37] Valeriy Kravchuk
OK, let me check again. I do not see the point in having SUFFIX added to program names, but, if it really done, these binaries, with suffix, should be referenced in all the scripts. Or, at least, symlinks should be created that are pointing to them.
[22 Dec 2006 7:58] Joshua Kugler
The main point, I would think, would be for parallel installations of MySQL.  For example, you could have /usr/bin/mysqld and /usr/bin/mysqld5.  So, when you run the binaries, there is no doubt which version you are running, instead of trying to remember if you put mysql 5 in /usr/local/bin, or some such.  No, symlinks shouldn't be created because you might already have /usr/bin/mysqld due to another version being installed.

If this was fully functional, it would allow someone to easily install and test several versions in parallel.  Imagine compiling all the 5.0.x tar balls and installing them at once.  Using --program-suffix would let you do that.

While several versions at once is the extreme, I would like this to work simply so I can easily manage our MySQL 4.x to 5.x upgrade. :)
[22 Dec 2006 8:22] Valeriy Kravchuk
Verified just as described with 5.0.34-BK on Linux. I used the following steps:

./configure --prefix=/home/openxs/dbs/5.0 --with-extra-charsets=all --with-readline --program-suffix=5
make
make install

Then:

openxs@suse:~/work/mysql-5.0> cd ~/dbs/5.0
openxs@suse:~/dbs/5.0> find . -name mysqld* -print
./bin/mysqldumpslow5
./bin/mysqld_multi
./bin/mysqld_safe5
./bin/mysqldump5
./bin/mysqld_multi5
./bin/mysqld_safe
./bin/mysqldumpslow
./bin/mysqldump
./libexec/mysqld
./libexec/mysqld5
./mysql-test/r/mysqldump-max.result
./mysql-test/r/mysqldump.result
./mysql-test/t/mysqldump-max.test
./mysql-test/t/mysqldump.test
./include/mysql/mysqld_ername.h
./include/mysql/mysqld_error.h

So, yes, mysql5 and mysqld_safe5 are created, among other binaries, but:

openxs@suse:~/dbs/5.0> bin/mysqld_safe5 &
[1] 5475
openxs@suse:~/dbs/5.0> Starting mysqld daemon with databases from /home/openxs/d
bs/5.0/var

openxs@suse:~/dbs/5.0> ps
  PID TTY          TIME CMD
 6357 pts/2    00:00:00 bash
 5475 pts/2    00:00:00 mysqld_safe5
 5488 pts/2    00:00:00 mysqld
 5498 pts/2    00:00:00 ps

mysqld5 is not used in mysqld_safe5, see also:

openxs@suse:~/dbs/5.0> grep mysqld5 bin/mysqld_safe5

I suspect many other shell scripts are also affected. So, this is a bug.
[13 Jun 2007 16:20] Gert Haubrich
Still exists in MySQL 5.0.41

I had the same idea and used --program-suffix=5 but e.g. mysql_install_db fails because ist still has hardcoded references to other programm components. First it looks for libexec/mysqld and after work around with a hard link it fails again with bin/resolveip.
I havn't testet other tools, but I think there will be more pitfalls. Now I recompiled without --program-suffix, too bad.
[25 Mar 2008 12:45] Jonathan Craig
Curious that this is referenced as a "feature request" as its an existing build feature that is not properly implemented.  Regardless, this same problem exists with the --program-prefix configure option.  Script files in [BASE BUILD]/scripts directory do not properly account for program prefix/suffix/version number.  The [script].sh needs to be updated so that the program name is updated with the "transform" program name from the makefile.
[16 Mar 2009 11:27] Daniel Fischer
It is a feature request because --program-suffix and --program-prefix are features of automake, and not of MySQL. We can't currently support these options.