[MDEV-26870] skip-symbolic-links does not prevent the use of symbolic links. Created: 2021-10-20 Updated: 2023-10-04 Resolved: 2022-01-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6 |
| Fix Version/s: | 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2, 10.8.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Edward Stoever | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I can disable the the ability to use symbolic links for files by setting skip-symbolic-links I can test that this condition is on with the following query:
This setting does not prevent the use of symbolic links. I have tested symbolic links for subdirectories of datadir and for individual files. I have tested the following versions:
|
| Comments |
| Comment by Sergei Golubchik [ 2021-10-25 ] | |||||||||||||||||||||||||||||||||
|
What do you mean, "does not prevent the use of symbolic links"? What exactly did you try to do? | |||||||||||||||||||||||||||||||||
| Comment by Edward Stoever [ 2021-10-25 ] | |||||||||||||||||||||||||||||||||
|
Just try it, like this:
| |||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-10-25 ] | |||||||||||||||||||||||||||||||||
|
This is not what skip-symbolic-links affects. It disables DATA/INDEX DIRECTORY support. You won't be able to create tables with DATA DIRECTORY or INDEX DIRECTORY attributes. In other words, the server won't create symlinks. But you can, and the server will access symlinked files all right. | |||||||||||||||||||||||||||||||||
| Comment by Edward Stoever [ 2021-11-17 ] | |||||||||||||||||||||||||||||||||
|
Can you take a look? serg | |||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-11-17 ] | |||||||||||||||||||||||||||||||||
|
Innodb is not using real symbolic links, it uses home-grown symbolic links instead. These are text files with extension .isl, that contain the destination path. Why are they doing it, I do not really know. Perhaps, because on Windows, creation of symbolic links required special privilege. Or maybe because resolving path of a dangling symbolic link on Windows required some non-trivial coding (nowadays, std::filesystem::read_symlink() provides this functionality) | |||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-11-18 ] | |||||||||||||||||||||||||||||||||
|
Indeed. But, I think, users expect skip-symbolic-links to affect isl files too. Shall we treat it as a bug? marko? | |||||||||||||||||||||||||||||||||
| Comment by Edward Stoever [ 2021-12-24 ] | |||||||||||||||||||||||||||||||||
|
I think it is fine that skip-symbolic-links refers to skipping the use of .isl files. This should be added in our documentation so that everyone understands what it means. Thanks! --Edward | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-01-14 ] | |||||||||||||||||||||||||||||||||
|
The implementation of the DATA DIRECTORY attribute for InnoDB in MySQL 5.6 included at least the following questionable changes:
I wish MariaDB had not copied this from MySQL. I fully agree that it is a good idea for administrators to be able to disable the use of the DATA DIRECTORY attribute for InnoDB tables. serg, wlad, how should InnoDB implement this check? By referring to the variable my_disable_symlinks? Or have_symlink? No storage engine is checking this option directly. I suppose that we may enforce the check on CREATE TABLE and on ALTER TABLE that explicitly mentions DATA DIRECTORY. Would we also want to refuse all table-rebuilding operations (OPTIMIZE, TRUNCATE, ALTER) if the table has been defined with a DATA DIRECTORY attribute? | |||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-01-14 ] | |||||||||||||||||||||||||||||||||
|
marko, it's my_use_symdir and ha_myisam.cc and ha_archive.cc test it. And if you want to switch to real symlinks, you'll need to keep supporting isl files for a while still. At least support reading of them. | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-01-20 ] | |||||||||||||||||||||||||||||||||
|
I think that using proper symbolic links and removing the mkdir calls would be a separate task and not something that can be done in a GA release, because it would change the file format and therefore break downgrade to earlier versions. | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-01-20 ] | |||||||||||||||||||||||||||||||||
|
I would implement this as follows:
It turns out that ALTER TABLE t1 FORCE, DATA DIRECTORY '…' will not add a DATA DIRECTORY attribute, even when the FORCE clause is present. | |||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-01-21 ] | |||||||||||||||||||||||||||||||||
|
c1d7b4575e6 is ok to push |