New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
empty blocklist generated #5966
Comments
@hgy59 looks reasonable to me. Would you like to open a PR that adds the new |
meanwhile I have modified the patch to disable the use of sendfile64 at all.
The new patch avoids the definition of --- libtransmission/file-posix.cc.orig 2023-08-23 22:56:00.000000000 +0000
+++ libtransmission/file-posix.cc 2023-09-02 20:11:04.227014716 +0000
@@ -28,15 +28,12 @@
#include <xfs/xfs.h>
#endif
-/* OS-specific file copy (copy_file_range, sendfile64, or copyfile). */
+/* OS-specific file copy (copy_file_range or copyfile). */
#if defined(__linux__)
#include <linux/version.h>
/* Linux's copy_file_range(2) is buggy prior to 5.3. */
#if defined(HAVE_COPY_FILE_RANGE) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
#define USE_COPY_FILE_RANGE
-#elif defined(HAVE_SENDFILE64)
-#include <sys/sendfile.h>
-#define USE_SENDFILE64
#endif
#elif defined(__APPLE__) && defined(HAVE_COPYFILE)
#include <copyfile.h> With this in mind, a general solution would require an adjustment of the build process. In a classical autoconf scenario I would say that At least I would expect an option in And there is another "invalid argument" Warning in the log file on 32-bit arm.
As far as I can tell, this comes from the call of With this warning in the logs, I don't know, whether the session-id file gets locked or not. Shall I create another issue for this? |
@hgy59 Sounds to me all you need is avoid setting the diff --git a/libtransmission/file-posix.cc b/libtransmission/file-posix.cc
index db40e36a1..d9daea5ab 100644
--- a/libtransmission/file-posix.cc
+++ b/libtransmission/file-posix.cc
@@ -439,7 +439,10 @@ bool tr_sys_path_copy(char const* src_path, char const* dst_path, tr_error** err
if (copied == -1)
{
errno_cpy = errno; /* remember me for later */
- tr_error_set_from_errno(error, errno);
+ if (errno != EINVAL)
+ {
+ tr_error_set_from_errno(error, errno);
+ }
if (file_size > 0U)
{
file_size = info->size; /* restore file_size for next fallback */ A similar thing is already in place for transmission/libtransmission/file-posix.cc Lines 390 to 393 in de889c9
What variants of |
@tearfur Thank you for this solution (I should have figured it out myself). This are the declarations in /* Send up to COUNT bytes from file associated with IN_FD starting at
*OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position
following the read bytes. If OFFSET is a null pointer, use the normal
file position instead. Return the number of written bytes, or -1 in
case of error. */
#ifndef __USE_FILE_OFFSET64
extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset,
size_t __count) __THROW;
#else
# ifdef __REDIRECT_NTH
extern ssize_t __REDIRECT_NTH (sendfile,
(int __out_fd, int __in_fd, __off64_t *__offset,
size_t __count), sendfile64);
# else
# define sendfile sendfile64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset,
size_t __count) __THROW;
#endif I supposed an issue with USE_FILE_OFFSET64 but didn't get it working. BTW the manpages document error EINVAL for sendfile64 like this:
could there be a permission issue with the blocklist file that applies to sendfile64 but not to user-space file copy implementation? |
I have found a solution for this: The error above was not created by I fixed this in SynoCommunity transmission package by a patch for 32-bit arm archs, that enforces the use of |
…smission#5966) - fallback to user-space copy for EINVAL of sendfile64 - without this fix, empty blocklist files are created on such devices
PR created, is waiting for approval. |
@hgy59 https://elixir.bootlin.com/linux/latest/source/fs/fcntl.c#L343 |
…smission#5966) - fallback to user-space copy for EINVAL of sendfile64 - without this fix, empty blocklist files are created on such devices
What is the issue?
In SynoCommunity, we are building transmission packages for Synology NAS.
There is an issue that the downloaded blocklist file is not correctly processed and results in an empty blocklist file.
see: SynoCommunity/spksrc#5685
The result of the analysis of the source code (in
libtransmission/file-posix.cc
) is:The
tr_sys_path_copy
does not work here.It is related to the fallback from sendfile64 to user-space copy.
When reaching the fallback code (after trying sendfile64), the
errno_cpy
variable is 22 (EINVAL), but only 18 (EXDEV) and 0 are accepted to continue with use-space copy.This results in an empty blocklist file and an entry in the log file:
For the failing targets, the configure of build logs
I have not a clue, whether this error is related to large file support or sendfile64 compatibility, but for SynoCommunity Transmission package it could be fixed with this patch:
I provide this information here, so this can be probably fixed upstream.
Which application of Transmission?
None
Which version of Transmission?
4.0.x
The text was updated successfully, but these errors were encountered: