Closed percona-ysorokin closed 7 years ago
It looks like the testcase expects fsync to return EBADF for bad fd, but libeatmydata implementation accepts any fd.
Here is a code fragment which can be used to reproduce the issue (compiled and run on CentOS 7 x64)
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
int fd = 42; // non-existing file descriptor
int res = fdatasync(fd);
printf("fdatasync(fd) returned %d, errno = %d\n", res, errno);
return 0;
}
When run without libeatmydata
[yura@localhost host-ws]$ ./libeatmydata_fdatasync_issue
fdatasync(fd) returned -1, errno = 9
When it is enabled
[yura@localhost host-ws]$ LD_PRELOAD=./libeatmydata.so ./libeatmydata_fdatasync_issue
fdatasync(fd) returned 0, errno = 0
Yes, I confirm. This patch fixes the problem.
thanks! Pushed to master
[yura@localhost mysql-build]$ LD_PRELOAD=/home/yura/ws/libeatmydata/.libs/libeatmydata.so ./mysql-test/mtr --debug-server 1st --unit-tests-report --debug-server
A simplified command with the same effect (running ctest directly)
LD_PRELOAD=/home/yura/ws/libeatmydata/.libs/libeatmydata.so ctest -V -R merge_keyring_file_tests
This does not happen without LD_PRELOAD.
Observed with MySQL Server 5.7.17 Debug compiled from source and with the latest version of
libeatmydata
library compiled from source (commit 3cfd8c1)