Bug #13843 installation scripts do not create @localstatedir@ if it does not exist
Submitted: 7 Oct 2005 14:16 Modified: 16 Mar 2009 9:41
Reporter: Philip Stoev Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S4 (Feature request)
Version:4.1.14 OS:FreeBSD (FreeBSD 5.4-RELEASE)
Assigned to: CPU Architecture:Any

[7 Oct 2005 14:16] Philip Stoev
Description:
On FreeBSD, @prefix@ appears to be /usr/local, therefore the configure script sets @localstatedir@ to be /usr/local/var. However, this directory does not exist by default on FreeBSD and does not appear to be created. Therefore, checking if the filesystem is case sensitive on mysqld startup produces the following error:

Can't create test file /usr/local/var/.lower-test

and so on.

How to repeat:
1. On a fresh FreeBSD system, do

configure --with-embedded-library && make && make install

2. run libmysqld/examples/mysql_client_test_embedded

and you get 

051007 17:15:45 [Warning] Can't create test file /usr/local/var/.lower-test
051007 17:15:46  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name /usr/local/var/ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

Suggested fix:
create every folder referenced by the configure script if it does not exist.
[7 Oct 2005 14:43] Valeriy Kravchuk
For me it sounda like a feature request. Moreover, if you configure with --prefix option, and then (after make install) perform scripts/mysql_install_db (as described in the manual), the directory will surely be created.

Are you agree with me?
[7 Oct 2005 14:51] Philip Stoev
Yes thanks I see now the relevant line in mysql_install_db that creates the directory in question.

Thanks for the feedback, let's leave this as a feature request. The purpose of this bug and a few others that I have filed is to get libmysqld to run without warnings and errors right out of the box without relying on any directories, files or tables that may or may not be there.

I do believe though that "make install" should create the /var dir, since it is being used for other purposes than storing just databases. Or mysql_install_db must be executed by default by make install by executing the init-db target in the Makefile?
[16 Mar 2009 9:41] Daniel Fischer
We could create @localstatedir@ in one of the install hooks, but installation is not complete until mysql_install_db has been run, which will create the directory anyway.