Bug 14503 - s3 configure script fails to detect fcntl hint support for linux
Summary: s3 configure script fails to detect fcntl hint support for linux
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Ralph Böhme
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-20 21:45 UTC by Pierre Langlois
Modified: 2020-09-21 07:27 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Langlois 2020-09-20 21:45:07 UTC
Hi there,

Building the samba package on AArch64 for the Guix distribution fails because the configure script leaves a stale "hinttest.fcntl" file behind, and the package recipe doesn't like it.

Digging into it, it looks like the C program that checks if the feature is available crashes on AArch64 while it runs OK on x86_64. The test code is as follows:

```
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>

#define DATA "hinttest.fcntl"

int main(void)
{
        uint64_t *hint, get_hint;
        int fd;

        fd = open(DATA, O_RDONLY | O_CREAT | O_EXCL);
        if (fd == -1) {
            goto err;
        }

        *hint = RWH_WRITE_LIFE_SHORT;
        int ret = fcntl(fd, F_SET_RW_HINT, hint);
        if (ret == -1) {
            goto err;
        }
...
...
}
```

It seems we're just lucky on x86 and the `hint` pointer just happens to be initialised with a valid address.  It should be quite trivial to fix this by keeping `hint` on the stack and get its address when calling `fcntl`.

This test was introduced with https://gitlab.com/samba-team/samba/-/commit/5084a69de14f24e9d804998580eefcba773fdd5a#e8f66f9cd3a87b4632d92dff7ac45138d5a832d2_1122_1180, and I could find another commit that tries to fix leaving a stale file behind, presumably because of a crash: https://gitlab.com/samba-team/samba/-/merge_requests/1253.

Thanks! Hopefully I'm filing this bug under the correct component, apologies if not! I'm not very familiar with samba itself.

Pierre
Comment 1 Samba QA Contact 2020-09-21 07:27:10 UTC
This bug was referenced in samba master:

454ccd986b61799908a6898a55d0480911f15306