Bug#396631: NMU uploaded in 48 hours
Hi,
I prepared an NMU of your package, and told at to upload it in 48 hours.
Please see this as help to get the package into a releaseable condition for
etch.
Please find the used diff below (the real patch is from your svn
anyways).
Cheers,
Andi
diff -Nur ../apr-1.2.7~/debian/changelog ../apr-1.2.7/debian/changelog
--- ../apr-1.2.7~/debian/changelog 2006-12-09 20:25:00.000000000 +0000
+++ ../apr-1.2.7/debian/changelog 2006-12-09 20:46:15.000000000 +0000
@@ -1,3 +1,11 @@
+apr (1.2.7-8.1) unstable; urgency=high
+
+ * Non-maintainer upload.
+ * Fix 0-lenght files. Take 015_sendfile_lfs.dpatch from svn for this.
+ Closes: #396631
+
+ -- Andreas Barth <aba@not.so.argh.org> Sat, 9 Dec 2006 20:39:59 +0000
+
apr (1.2.7-8) unstable; urgency=low
[ Peter Samuelson ]
diff -Nur ../apr-1.2.7~/debian/patches/00list ../apr-1.2.7/debian/patches/00list
--- ../apr-1.2.7~/debian/patches/00list 2006-12-09 20:25:00.000000000 +0000
+++ ../apr-1.2.7/debian/patches/00list 2006-12-09 20:45:53.000000000 +0000
@@ -1,7 +1,7 @@
011_fix_apr-config
013_ship_find_apr.m4
014_fix-apr.pc
-015sendfile-amd64
+015_sendfile_lfs.dpatch
016_sendfile_hurd
020_lfs_ino_t
099_config_guess_sub_update
diff -Nur ../apr-1.2.7~/debian/patches/015_sendfile_lfs.dpatch ../apr-1.2.7/debian/patches/015_sendfile_lfs.dpatch
--- ../apr-1.2.7~/debian/patches/015_sendfile_lfs.dpatch 1970-01-01 00:00:00.000000000 +0000
+++ ../apr-1.2.7/debian/patches/015_sendfile_lfs.dpatch 2006-12-09 20:45:01.000000000 +0000
@@ -0,0 +1,133 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 015_sendfile_lfs.dpatch by <thom@debian.org> <peter@p12n.org>
+##
+## DP: Fix up sendfile:
+## DP: - Detect sendfile64() at runtime (not present on 2.4 kernels.)
+## DP: - Ensure that we only send 2GB chunks on 64bit platforms thanks
+## DP: to extreme linux kernel bustage.
+
+@DPATCH@
+Index: network_io/unix/sendrecv.c
+--- a/network_io/unix/sendrecv.c
++++ b/network_io/unix/sendrecv.c
+@@ -240,31 +240,74 @@
+
+ #if defined(__linux__) && defined(HAVE_WRITEV)
+
++/* Helper function for apr_socket_sendfile.
++ * Takes care of sendfile vs. sendfile64 (must be detected at runtime),
++ * EINTR restarting, and other details. NOTE: does not necessarily
++ * update 'off', as callers don't need this.
++ */
++static
++ssize_t do_sendfile(int out, int in, apr_off_t *off, apr_size_t len)
++{
++#if !APR_HAS_LARGE_FILES
++ ssize_t ret;
++ do
++ ret = sendfile(out, in, off, len);
++ while (ret == -1 && errno == EINTR);
++ return ret;
++#else
++
++#ifdef HAVE_SENDFILE64
++ static int sendfile64_enosys; /* sendfile64() syscall not found */
++#endif
++ off_t offtmp;
++ ssize_t ret;
++
++ /* Multiple reports have shown sendfile failing with EINVAL if
++ * passed a >=2Gb count value on some 64-bit kernels. It won't
++ * noticably hurt performance to limit each call to <2Gb at a time,
++ * so avoid that issue here. (Round down to a common page size.) */
++ if (sizeof(off_t) == 8 && len > INT_MAX)
++ len = INT_MAX - 8191;
++
++ /* The simple and common case: we don't cross the LFS barrier */
++ if (sizeof(off_t) == 8 || (apr_int64_t)*off + len <= INT_MAX) {
++ offtmp = *off;
++ do
++ ret = sendfile(out, in, &offtmp, len);
++ while (ret == -1 && errno == EINTR);
++ return ret;
++ }
++
++ /* From here down we know it's a 32-bit runtime */
++#ifdef HAVE_SENDFILE64
++ if (!sendfile64_enosys) {
++ do
++ ret = sendfile64(out, in, off, len);
++ while (ret == -1 && errno == EINTR);
++
++ if (ret == -1 && errno == ENOSYS) {
++ sendfile64_enosys = 1;
++ errno = EINVAL;
++ }
++ return ret;
++ }
++#endif
++ offtmp = *off;
++ do
++ ret = sendfile(out, in, &offtmp, len);
++ while (ret == -1 && errno == EINTR);
++ return ret;
++#endif /* APR_HAS_LARGE_FILES */
++}
++
++
+ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
+ apr_hdtr_t *hdtr, apr_off_t *offset,
+ apr_size_t *len, apr_int32_t flags)
+ {
+ int rv, nbytes = 0, total_hdrbytes, i;
+ apr_status_t arv;
+-
+-#if APR_HAS_LARGE_FILES && defined(HAVE_SENDFILE64)
+ apr_off_t off = *offset;
+-#define sendfile sendfile64
+-
+-#elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4
+- /* 64-bit apr_off_t but no sendfile64(): fail if trying to send
+- * past the 2Gb limit. */
+- off_t off;
+-
+- if ((apr_int64_t)*offset + *len > INT_MAX) {
+- return EINVAL;
+- }
+-
+- off = *offset;
+-
+-#else
+- off_t off = *offset;
+-#endif
+
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+@@ -310,12 +353,10 @@
+ goto do_select;
+ }
+
+- do {
+- rv = sendfile(sock->socketdes, /* socket */
++ rv = do_sendfile(sock->socketdes, /* socket */
+ file->filedes, /* open file descriptor of the file to be sent */
+ &off, /* where in the file to start */
+ *len); /* number of bytes to send */
+- } while (rv == -1 && errno == EINTR);
+
+ while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK)
+ && (sock->timeout > 0)) {
+@@ -326,12 +367,10 @@
+ return arv;
+ }
+ else {
+- do {
+- rv = sendfile(sock->socketdes, /* socket */
++ rv = do_sendfile(sock->socketdes, /* socket */
+ file->filedes, /* open file descriptor of the file to be sent */
+ &off, /* where in the file to start */
+ *len); /* number of bytes to send */
+- } while (rv == -1 && errno == EINTR);
+ }
+ }
+
--
http://home.arcor.de/andreas-barth/
Reply to: