Bug 15132 - Samba fails to build with glibc 2.36 caused by including <sys/mount.h> in libreplace
Summary: Samba fails to build with glibc 2.36 caused by including <sys/mount.h> in lib...
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.16.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-29 08:13 UTC by Andreas Schneider
Modified: 2022-08-08 14:36 UTC (History)
3 users (show)

See Also:


Attachments
patch for 4.16 and 4.15 (1.68 KB, patch)
2022-08-02 11:56 UTC, Andreas Schneider
asn: review? (slow)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2022-07-29 08:13:11 UTC
You need to be careful if you include <sys/mount.h> or <linux/mount.h> at least since glibc 2.36.
    
Details at:
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E

Patch will follow, need bug number.
Comment 1 Andreas Schneider 2022-07-29 08:14:47 UTC
In file included from /usr/include/linux/fs.h:19,
                 from /usr/include/xfs/linux.h:36,
                 from /usr/include/xfs/xfs.h:9,
                 from /usr/include/xfs/xqm.h:9,
                 from ../../source3/lib/sysquotas_xfs.c:36:
/usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
   95 | enum fsconfig_command {
      |      ^~~~~~~~~~~~~~~~
In file included from ../../lib/replace/system/filesys.h:40,
                 from ../../libcli/smb/smb_util.h:23,
                 from ../../libcli/smb/smb_common.h:31,
                 from ../../source3/include/smb.h:29,
                 from ../../source3/include/includes.h:275,
                 from ../../source3/lib/sysquotas_xfs.c:21:
/usr/include/sys/mount.h:189:6: note: originally defined here
Comment 2 Samba QA Contact 2022-07-29 13:09:03 UTC
This bug was referenced in samba master:

7a6bd2279897ed389d10f09e5b315a7bca96e7d4
Comment 3 Björn Jacke 2022-07-29 21:41:21 UTC
Did you make sure that sys/mount.h isn't required for and the include removal does not break the other non-Linux systems like *BSD, AIX vor Solaris?
Comment 4 Andreas Schneider 2022-07-30 17:25:08 UTC
I didn't as I don't have those systems available. I also do not see them in bootstrap that you could run them e.g. easily with VirtualBox ...

Also I already provide a FreeBSD runner for https://gitlab.com/cwrap

You have Azure credits with your MSDN account, install a FreeBSD runner and we can test regularly ...
Comment 5 Ralph Böhme 2022-08-01 14:23:23 UTC
(In reply to Andreas Schneider from comment #4)
This change breaks the build on FreeBSD.
Comment 6 Björn Jacke 2022-08-01 18:34:35 UTC
(In reply to Andreas Schneider from comment #4)
if you make a change like *this* you should at least request reviews from people who are able to test on other OSes, which are obviously in danger to be broken by your change. Just requesting a review from a colleague, who also just runs Linux is not a good idea then.
Comment 7 Andrew Bartlett 2022-08-01 21:57:12 UTC
This isn't really the place to discuss this, but I need to make clear that there is much more involved than 'just' offering a gitlab runner.  For security, they need to be on a VM that is destroyed after each run for example.

Portability-relevant changes really do need to be manually tested at this time.
Comment 8 Andrew Bartlett 2022-08-01 22:03:22 UTC
We might get somewhere via efforts like https://chimera-linux.org/ (but this is on musl libc, not FreeBSD libc) or a full FreeBSD in qemu or such.
Comment 9 Samba QA Contact 2022-08-02 11:06:03 UTC
This bug was referenced in samba master:

9459f85511a11d9a159fc8c7bb3c2d781555f87d
766151bf5b7ef95ae4c8c98b8994e5c21c5bbec0
Comment 10 Andreas Schneider 2022-08-02 11:56:05 UTC
Created attachment 17454 [details]
patch for 4.16 and 4.15
Comment 11 Samba QA Contact 2022-08-08 14:32:24 UTC
This bug was referenced in samba v4-17-test:

7a6bd2279897ed389d10f09e5b315a7bca96e7d4
9459f85511a11d9a159fc8c7bb3c2d781555f87d
766151bf5b7ef95ae4c8c98b8994e5c21c5bbec0
Comment 12 Samba QA Contact 2022-08-08 14:36:36 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.0rc1):

7a6bd2279897ed389d10f09e5b315a7bca96e7d4
9459f85511a11d9a159fc8c7bb3c2d781555f87d
766151bf5b7ef95ae4c8c98b8994e5c21c5bbec0