[MDEV-33093] plugin/disks/information_schema_disks.cc doesn't compile on Solaris Created: 2023-12-20  Updated: 2024-01-10  Resolved: 2024-01-08

Status: Closed
Project: MariaDB Server
Component/s: Plugins
Affects Version/s: 10.11.6
Fix Version/s: 10.4.33, 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3

Type: Bug Priority: Major
Reporter: Rainer Orth Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Solaris 11.4/x86 with GCC 13.2.0


Attachments: File MDEV-33093-disks.patch     File isd.patch    

 Description   

`information_schema_disks.cc` doesn't compile on Solaris for two issues:
```
/vol/src/mariadb/mariadb-10.11.6/plugin/disks/information_schema_disks.cc:25:10: fatal error: sys/ucred.h: No such file or directory
25 | #include <sys/ucred.h>

^~~~~~~~~~~~~
```
This header doesn't exist on Solaris, which only has `<ucred.h>`. For now, I've just wrapped the `<sys/ucred.h>` inclusion in a (undefined) `HAVE_SYS_UCRED`, not trying to include `<ucred.h>` at all. The latter apparently wasn't needed, and I have no idea which target has/needs `<sys/ucred.h>`. If there is some such, this will need a corresponding `cmake` check.

The other issue is
```
/vol/src/mariadb/mariadb-10.11.6/plugin/disks/information_schema_disks.cc: In function ‘int Show::disks_fill_table(THD*, TABLE_LIST*, Item*)’:
/vol/src/mariadb/mariadb-10.11.6/plugin/disks/information_schema_disks.cc:229:29: error: ‘MNTOPT_RO’ was not declared in this scope
229 | if (hasmntopt(pEnt, MNTOPT_RO) != NULL)

^~~~~~~~~
```
`MNTOPT_RO` is defined in `<sys/mntent.h>`. Again, I'm including that header in `HAVE_SYS_MNTENT` which of course needs corresponding `cmake` work.


 Comments   
Comment by Rainer Orth [ 2024-01-09 ]

The previous patch is incomplete/wrong. This one (against 11.4) has now been tested on both Solaris 11.4/amd64 and Linux/x86_64. There are two issues:

  • The guard for `getmntinfo (the not NetBSD variants)` is wrong: `HAVE_GETMNTINFO_TAKES_statvfs` is defined on Solaris (or more general all targets that lack `getmntinfo`). Instead, this section should only apply if `getmntinfo` is actually present.
  • `MNTOPT_RO` is only defined in `<sys/mntent.h>` on Solaris. To handle this, the patch checks for that header and includes it if present. MDEV-33093-disks.patch
Generated at Thu Feb 08 10:36:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.