Add patch to fall back if copy_file_range fails with EINVAL
authorSimon McVittie <smcv@debian.org>
Mon, 7 Mar 2022 23:13:55 +0000 (23:13 +0000)
committerSimon McVittie <smcv@debian.org>
Mon, 7 Mar 2022 23:13:55 +0000 (23:13 +0000)
This fixes an incompatibility with eCryptFS, in particular when using
Flatpak in an eCryptFS home directory.

Closes: #1004467
debian/patches/Fall-back-if-copy_file_range-fails-with-EINVAL.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/Fall-back-if-copy_file_range-fails-with-EINVAL.patch b/debian/patches/Fall-back-if-copy_file_range-fails-with-EINVAL.patch
new file mode 100644 (file)
index 0000000..e9705c3
--- /dev/null
@@ -0,0 +1,31 @@
+From: Olaf Leidinger <oleid@mescharet.de>
+Date: Mon, 24 Jan 2022 16:12:57 +0100
+Subject: Fall back if copy_file_range fails with EINVAL
+
+Although EINVAL usually indicates a programming error, ecryptfs (and
+possibly other stacked filesystems) returns EINVAL for attempts to
+copy_file_range() or sendfile() between files on that filesystem.
+
+Bug: https://gitlab.gnome.org/GNOME/libglnx/-/issues/3
+Bug: https://github.com/ostreedev/ostree/issues/2525
+Bug: https://github.com/flatpak/flatpak/issues/4673
+Bug-Debian: https://bugs.debian.org/1004467
+Applied-upstream: libglnx commit:24231a956a4b849087fbf01173cdebb53e1bd60b
+Applied-upstream: libostree 2022.2, commit:0ebf9d9f64647d0b8b95cda112c7854be6f58ed3
+---
+ libglnx/glnx-fdio.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libglnx/glnx-fdio.c b/libglnx/glnx-fdio.c
+index 422bc2d..0bb26f4 100644
+--- a/libglnx/glnx-fdio.c
++++ b/libglnx/glnx-fdio.c
+@@ -829,7 +829,7 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
+                   have_cfr = 0;
+                   try_cfr = false;
+                 }
+-              else if (G_IN_SET (errno, EXDEV, EOPNOTSUPP))
++              else if (G_IN_SET (errno, EXDEV, EINVAL, EOPNOTSUPP))
+                 /* We won't try cfr again for this run, but let's be
+                  * conservative and not mark it as available/unavailable until
+                  * we know for sure.
index 0070b994764f39eb9cf2f7320de18e3cc5a39cd5..d9d2246ade29811188b8824206c745aa743f6632 100644 (file)
@@ -1,2 +1,3 @@
 test-pull-summary-sigs-Set-timestamps-to-serve-expected-f.patch
+Fall-back-if-copy_file_range-fails-with-EINVAL.patch
 debian/Skip-test-pull-repeated-during-CI.patch