Source: qt6-base
Version: 6.10.2+dfsg-7
Severity: important
Tags: upstream patch fixed-upstream
Forwarded: https://qt-project.atlassian.net/browse/QTBUG-144142

Hello,

As reported upstream, copying file fails with some container
cases (or very old Linux kernels), and it also fails on
hurd-any, because copy_file_range() properly returns ENOSYS, but
QFileSystemEngine::cloneFile takes this as a failure, leading to various
package build failures such as:

Error copying qtpass to 
/build/reproducible-path/qtpass-1.6.0/debian/qtpass/usr/bin/qtpass: Could not 
copy to /build/reproducible-path/qtpass-1.6.0/debian/qtpass/usr/bin/qtpass: 
Function not implemented

Could you backport the attached upstream patch to fix this?

Thanks,
Samuel

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-security'), (500, 'stable-debug'), (500, 
'proposed-updates'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, 
'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 6.19.10+deb14-amd64 (SMP w/22 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
commit b1b45ca4441db9e880e3a7fc7f4e8aa3af870eb6
Author: Thiago Macieira <[email protected]>
Date:   Thu Feb 12 18:02:02 2026 -0800

    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 <[email protected]>
    Reviewed-by: Ahmad Samir <[email protected]>

diff --git a/src/corelib/global/minimum-linux_p.h 
b/src/corelib/global/minimum-linux_p.h
index 86226326fe5..b2c74c5c37c 100644
--- a/src/corelib/global/minimum-linux_p.h
+++ b/src/corelib/global/minimum-linux_p.h
@@ -41,7 +41,6 @@ QT_BEGIN_NAMESPACE
  * - accept4                    2.6.28
  * - renameat2                  3.16                    QT_CONFIG(renameat2)
  * - getrandom                  3.17                    QT_CONFIG(getentropy)
- * - copy_file_range            4.5                     
QT_CONFIG(copy_file_range)
  * - statx                      4.11                    STATX_BASIC_STATS
  */
 
@@ -51,10 +50,6 @@ QT_BEGIN_NAMESPACE
 #  define QT_ELF_NOTE_OS_MAJOR      4
 #  define QT_ELF_NOTE_OS_MINOR      11
 #  define QT_ELF_NOTE_OS_PATCH      0
-#elif QT_CONFIG(copy_file_range)
-#  define QT_ELF_NOTE_OS_MAJOR      4
-#  define QT_ELF_NOTE_OS_MINOR      5
-#  define QT_ELF_NOTE_OS_PATCH      0
 #elif QT_CONFIG(getentropy)
 #  define QT_ELF_NOTE_OS_MAJOR      3
 #  define QT_ELF_NOTE_OS_MINOR      17
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp 
b/src/corelib/io/qfilesystemengine_unix.cpp
index b1cda806552..74a30c63e6a 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1204,6 +1204,7 @@ auto QFileSystemEngine::cloneFile(int srcfd, int dstfd, 
const QFileSystemMetaDat
     switch (errno) {
     case EINVAL: // observed with some obscure filesystem combinations
     case EXDEV: // Linux can't do xdev file copies (FreeBSD can)
+    case ENOSYS: // caused by some containers wrongly filtering the system call
         break;
 
     default:

Reply via email to