Skip to content

Commit b1b45ca

Browse files
QFileSystemEngine: handle copy_file_range() returning ENOSYS error
This shouldn't have happened, because minimum-linux_p.h would have declared our need for a Linux kernel 4.5 or higher. I think the issue is not the kernel, but a container wrapping the Qt application and filtering system calls for security. If this container hasn't been updated to know about the system call, it may cause an ENOSYS error. Because we now handle the condition, this commit removes the 4.5 minimum Linux version requirement from minimum-linux_p.h. [ChangeLog][QtCore][QFile] Added a workaround to a compatibility issue of the copy() implementation in some containerized Linux environments, which could cause the file copy to fail with a "Function not implemented" error. This is believed to be a bug in the container runtime, not Qt, in that the container wrongly filtered the copy_file_range(2) system call that the Linux kernel supports. Fixes: QTBUG-144142 Pick-to: 6.11 6.10 Change-Id: Iedbf805486ad79e7127dfffd22043889359563fd Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
1 parent 8647b90 commit b1b45ca

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/corelib/global/minimum-linux_p.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ QT_BEGIN_NAMESPACE
4141
* - accept4 2.6.28
4242
* - renameat2 3.16 QT_CONFIG(renameat2)
4343
* - getrandom 3.17 QT_CONFIG(getentropy)
44-
* - copy_file_range 4.5 QT_CONFIG(copy_file_range)
4544
* - statx 4.11 STATX_BASIC_STATS
4645
*/
4746

@@ -51,10 +50,6 @@ QT_BEGIN_NAMESPACE
5150
# define QT_ELF_NOTE_OS_MAJOR 4
5251
# define QT_ELF_NOTE_OS_MINOR 11
5352
# define QT_ELF_NOTE_OS_PATCH 0
54-
#elif QT_CONFIG(copy_file_range)
55-
# define QT_ELF_NOTE_OS_MAJOR 4
56-
# define QT_ELF_NOTE_OS_MINOR 5
57-
# define QT_ELF_NOTE_OS_PATCH 0
5853
#elif QT_CONFIG(getentropy)
5954
# define QT_ELF_NOTE_OS_MAJOR 3
6055
# define QT_ELF_NOTE_OS_MINOR 17

src/corelib/io/qfilesystemengine_unix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ auto QFileSystemEngine::cloneFile(int srcfd, int dstfd, const QFileSystemMetaDat
12041204
switch (errno) {
12051205
case EINVAL: // observed with some obscure filesystem combinations
12061206
case EXDEV: // Linux can't do xdev file copies (FreeBSD can)
1207+
case ENOSYS: // caused by some containers wrongly filtering the system call
12071208
break;
12081209

12091210
default:

0 commit comments

Comments
 (0)