Bug #84605 `innodb_data_home_dir` has inconsistent handling, or documentation
Submitted: 23 Jan 2017 8:36 Modified: 7 Feb 2017 20:31
Reporter: Saverio Miroddi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[23 Jan 2017 8:36] Saverio Miroddi
Description:
In bug http://bugs.mysql.com/bug.php?id=84488, support answers, as part of the solution to the issue reported, that `You are supposed to add slash, that is how directories are differentiated from the files`.

There is a problem with this; the necessity of appending a slash is either an inconsistency in the code, or is at least an omission in the documentation. Also, regardless, there is a mistake in the documentation.

The rationale for first case (inconsistency in the code), is that such behavior is different from all the other directory parameters; even `innodb_log_group_home_dir` is a directory, but doesn't need a trailing slash.

If we instead assume that this behavior is proper, then the documentation is lacking, and has one mistake:

- the parameter documentation (https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_data_home_dir) doesn't mention it
- the innodb configuration documentation (https://dev.mysql.com/doc/refman/5.7/en/innodb-init-startup-configuration.html) doesn't mention it either
- the innodb configuration documentation also mentions that `InnoDB forms the directory path for each data file by textually concatenating the value of innodb_data_home_dir to the data file name, adding a path name separator (slash or backslash) between values if necessary`; this implicitly suggests that the parameter doesn't need a trailing slash
- the error message has no evident connection to the actual cause
- an example provided in the innodb configuration documentation is mistaken, and causes the error: `innodb_data_home_dir = /myibdata`

How to repeat:
Set `innodb_data_home_dir` without trailing slash.

Suggested fix:
Either make the parameter handling code consistent with the other parameters, by supporting values without trailing slash, or extend+correct the documentation.

I think making the code consistent is the proper solution.
[23 Jan 2017 14:56] MySQL Verification Team
Hi!

I was involved when this parameter was introduced and there is no doubt in my mind that it should have a slash. However, it is true that this is not properly documented. Hence, this is a verified documentation bug.
[7 Feb 2017 20:31] Daniel Price
Posted by developer:
 
The following content was updated to indicate that a trailing slash is required when specifying a value for innodb_data_home_dir. 

https://dev.mysql.com/doc/refman/5.7/en/innodb-init-startup-configuration.html
https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_data_home_dir

The change should appear online within 24 hours.

Thank you for the bug report.
[29 Aug 2019 14:15] Iwo P
Hello,

I do not agree the statements here and in bug https://bugs.mysql.com/bug.php?id=84488 are correct.

Pathname (3.271)
In the context of POSIX.1-2017 (...) It has optional beginning <slash> characters followed by zero or more filenames separated by <slash> characters. A pathname can *optionally* contain one or more trailing <slash> characters.

(Reference: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html)

Moreover, the proper way of checking if a path is a directory would be to stat it and then use `S_ISDIR' marco on `st_mode'.