~alpine/aports

[alpine-aports] [PATCH] testing/curlftpfs: new aport

Milan P. Stanić <mps@arvanta.net>
Details
Message ID
<20181211180800.23452-1-mps@arvanta.net>
Sender timestamp
1544551680
DKIM signature
missing
Download raw message
Patch: +264 -0
---
 testing/curlftpfs/001-uclibc_mod.patch        | 37 ++++++++++++
 .../500-fix-CURLOPT_INFILESIZE.patch          | 11 ++++
 .../510-free_ftpfs_file-memleak-fix.patch     | 13 ++++
 .../curlftpfs/520-nocache-memleak-fix.patch   | 58 ++++++++++++++++++
 .../530-curlftpfs__no_verify_hostname.patch   | 21 +++++++
 .../540-consistent-feature-flag.patch         | 60 +++++++++++++++++++
 testing/curlftpfs/550-getpass-prototype.patch | 20 +++++++
 testing/curlftpfs/APKBUILD                    | 44 ++++++++++++++
 8 files changed, 264 insertions(+)
 create mode 100644 testing/curlftpfs/001-uclibc_mod.patch
 create mode 100644 testing/curlftpfs/500-fix-CURLOPT_INFILESIZE.patch
 create mode 100644 testing/curlftpfs/510-free_ftpfs_file-memleak-fix.patch
 create mode 100644 testing/curlftpfs/520-nocache-memleak-fix.patch
 create mode 100644 testing/curlftpfs/530-curlftpfs__no_verify_hostname.patch
 create mode 100644 testing/curlftpfs/540-consistent-feature-flag.patch
 create mode 100644 testing/curlftpfs/550-getpass-prototype.patch
 create mode 100644 testing/curlftpfs/APKBUILD

diff --git a/testing/curlftpfs/001-uclibc_mod.patch b/testing/curlftpfs/001-uclibc_mod.patch
new file mode 100644
index 0000000000..8eb155618a
--- /dev/null
+++ b/testing/curlftpfs/001-uclibc_mod.patch
@@ -0,0 +1,37 @@
diff -cr curlftpfs-0.9.2/ftpfs-ls.c curlftpfs-0.9.2-1/ftpfs-ls.c
*** curlftpfs-0.9.2/ftpfs-ls.c	2008-04-23 12:55:41.000000000 +0200
--- curlftpfs-0.9.2-1/ftpfs-ls.c	2009-09-24 23:19:03.000000000 +0200
***************
*** 58,64 ****
                 "%5s"  "%*c"
                 "%1023c",
                 mode, &nlink, user, group, &size, month, day, year, file);
!   if (res < 9) {
      res = sscanf(line,
                   "%11s"
                   "%32s" SPACES
--- 58,64 ----
                 "%5s"  "%*c"
                 "%1023c",
                 mode, &nlink, user, group, &size, month, day, year, file);
!   if (res < 8) {
      res = sscanf(line,
                   "%11s"
                   "%32s" SPACES
***************
*** 69,75 ****
                   "%5s"  "%*c"
                   "%1023c",
                   mode, user, group, &size, month, day, year, file);
!     if (res < 8) {
        return 0;
      }
    }
--- 69,75 ----
                   "%5s"  "%*c"
                   "%1023c",
                   mode, user, group, &size, month, day, year, file);
!     if (res < 7) {
        return 0;
      }
    }
diff --git a/testing/curlftpfs/500-fix-CURLOPT_INFILESIZE.patch b/testing/curlftpfs/500-fix-CURLOPT_INFILESIZE.patch
new file mode 100644
index 0000000000..bd14184b0b
--- /dev/null
+++ b/testing/curlftpfs/500-fix-CURLOPT_INFILESIZE.patch
@@ -0,0 +1,11 @@
CURLOPT_INFILESIZE does not support -1 arg. This fix bug #556012.
--- curlftpfs-0.9.2/ftpfs.c.old	2009-12-13 14:12:25.000000000 +0100
+++ curlftpfs-0.9.2/ftpfs.c	2009-12-13 14:12:32.000000000 +0100
@@ -503,7 +503,6 @@
   
   curl_easy_setopt_or_die(fh->write_conn, CURLOPT_URL, fh->full_path);
   curl_easy_setopt_or_die(fh->write_conn, CURLOPT_UPLOAD, 1);
-  curl_easy_setopt_or_die(fh->write_conn, CURLOPT_INFILESIZE, -1);
   curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READFUNCTION, write_data_bg);
   curl_easy_setopt_or_die(fh->write_conn, CURLOPT_READDATA, fh);
   curl_easy_setopt_or_die(fh->write_conn, CURLOPT_LOW_SPEED_LIMIT, 1);
diff --git a/testing/curlftpfs/510-free_ftpfs_file-memleak-fix.patch b/testing/curlftpfs/510-free_ftpfs_file-memleak-fix.patch
new file mode 100644
index 0000000000..38a77ac9a6
--- /dev/null
+++ b/testing/curlftpfs/510-free_ftpfs_file-memleak-fix.patch
@@ -0,0 +1,13 @@
Fix a memory leak. See Bug #587250.

--- a/ftpfs.c	2008-04-30 01:05:47.000000000 +0200
+++ a/ftpfs.c.slesimple	2010-01-01 22:12:10.000000000 +0100
@@ -614,6 +614,8 @@ static void free_ftpfs_file(struct ftpfs
   sem_destroy(&fh->data_need);
   sem_destroy(&fh->data_written);
   sem_destroy(&fh->ready);
+  if (fh->buf.size) { buf_free(&fh->buf); }
+  if (fh->stream_buf.size) { buf_free(&fh->stream_buf); }
   free(fh);
 }
 
diff --git a/testing/curlftpfs/520-nocache-memleak-fix.patch b/testing/curlftpfs/520-nocache-memleak-fix.patch
new file mode 100644
index 0000000000..2c351a42b3
--- /dev/null
+++ b/testing/curlftpfs/520-nocache-memleak-fix.patch
@@ -0,0 +1,58 @@
Fix a memory leak when cache is disabled. Closes: #614347.

diff -ur curlftpfs-0.9.2/cache.c curlftpfs-0.9.2-olexat/cache.c
--- curlftpfs-0.9.2/cache.c	2008-04-30 01:03:09.000000000 +0200
+++ curlftpfs-0.9.2-olexat/cache.c	2011-02-04 16:43:05.000000000 +0100
@@ -25,7 +25,7 @@
     time_t last_cleaned;
 };
 
-static struct cache cache;
+struct cache cache;
 
 struct node {
     struct stat stat;
diff -ur curlftpfs-0.9.2/ftpfs-ls.c curlftpfs-0.9.2-olexat/ftpfs-ls.c
--- curlftpfs-0.9.2/ftpfs-ls.c	2008-04-23 12:55:41.000000000 +0200
+++ curlftpfs-0.9.2-olexat/ftpfs-ls.c	2011-02-07 17:23:37.000000000 +0100
@@ -25,6 +25,13 @@
 #include "charset_utils.h"
 #include "ftpfs-ls.h"
 
+struct cache {
+    int on;
+    char incomplete[];
+};
+
+extern struct cache cache;
+
 static int parse_dir_unix(const char *line,
                           struct stat *sbuf,
                           char *file,
@@ -243,8 +256,10 @@
           reallink = g_strdup(link);
         }
         int linksize = strlen(reallink);
-        cache_add_link(full_path, reallink, linksize+1);
-        DEBUG(1, "cache_add_link: %s %s\n", full_path, reallink);
+        if (cache.on) {
+          cache_add_link(full_path, reallink, linksize+1);
+          DEBUG(1, "cache_add_link: %s %s\n", full_path, reallink);
+        }
         if (linkbuf && linklen) {
           if (linksize > linklen) linksize = linklen - 1;
           strncpy(linkbuf, reallink, linksize);
@@ -257,8 +272,10 @@
         DEBUG(1, "filler: %s\n", file);
         filler(h, file, &stat_buf);
       } else {
-        DEBUG(1, "cache_add_attr: %s\n", full_path);
-        cache_add_attr(full_path, &stat_buf);
+        if (cache.on) {
+          DEBUG(1, "cache_add_attr: %s\n", full_path);
+          cache_add_attr(full_path, &stat_buf);
+        }
       }
 
       DEBUG(2, "comparing %s %s\n", name, file);

diff --git a/testing/curlftpfs/530-curlftpfs__no_verify_hostname.patch b/testing/curlftpfs/530-curlftpfs__no_verify_hostname.patch
new file mode 100644
index 0000000000..578eaa7b96
--- /dev/null
+++ b/testing/curlftpfs/530-curlftpfs__no_verify_hostname.patch
@@ -0,0 +1,21 @@
Author: Georg Oechsler
Subject: Fix no_verify_hostname option with recent versions of curl

Index: curlftpfs-0.9.2/ftpfs.c
===================================================================
--- curlftpfs-0.9.2.orig/ftpfs.c
+++ curlftpfs-0.9.2/ftpfs.c
@@ -1626,9 +1626,10 @@ static void set_common_curl_stuff(CURL*
   }
 
   if (ftpfs.no_verify_hostname) {
-    /* The default is 2 which verifies even the host string. This sets to 1
-     * which means verify the host but not the string. */
-    curl_easy_setopt_or_die(easy, CURLOPT_SSL_VERIFYHOST, 1);
+    /* The default is 2 which verifies even the host string. This sets
+     * to 0 which means the connection succeeds regardless of the names
+     * in the certificate. */
+    curl_easy_setopt_or_die(easy, CURLOPT_SSL_VERIFYHOST, 0);
   }
 
   curl_easy_setopt_or_die(easy, CURLOPT_INTERFACE, ftpfs.interface);
diff --git a/testing/curlftpfs/540-consistent-feature-flag.patch b/testing/curlftpfs/540-consistent-feature-flag.patch
new file mode 100644
index 0000000000..71a37fecd0
--- /dev/null
+++ b/testing/curlftpfs/540-consistent-feature-flag.patch
@@ -0,0 +1,60 @@
Author: Vincent Bernat
Subject: ensure consistent use of _XOPEN_SOURCE

See bug #748143

Index: curlftpfs-0.9.2/Makefile.am
===================================================================
--- curlftpfs-0.9.2.orig/Makefile.am
+++ curlftpfs-0.9.2/Makefile.am
@@ -5,7 +5,7 @@ DIST_SUBDIRS = $(SUBDIRS) tests
 
 LIBICONV = @LIBICONV@
 
-AM_CPPFLAGS = -DFUSE_USE_VERSION=26
+AM_CPPFLAGS = -DFUSE_USE_VERSION=26 -D_XOPEN_SOURCE=600
 AM_LDFLAGS = $(LIBICONV)
 
 bin_PROGRAMS = curlftpfs
Index: curlftpfs-0.9.2/ftpfs-ls.c
===================================================================
--- curlftpfs-0.9.2.orig/ftpfs-ls.c
+++ curlftpfs-0.9.2/ftpfs-ls.c
@@ -6,12 +6,6 @@
     See the file COPYING.
 */
 
-#ifndef __FreeBSD__
-#define _XOPEN_SOURCE 600
-#else
-#define _XOPEN_SOURCE
-#endif
-
 #include <time.h>
 #include <string.h>
 #include <sys/types.h>
Index: curlftpfs-0.9.2/tests/Makefile.am
===================================================================
--- curlftpfs-0.9.2.orig/tests/Makefile.am
+++ curlftpfs-0.9.2/tests/Makefile.am
@@ -2,7 +2,7 @@ EXTRA_DIST = run_tests.sh
 
 noinst_PROGRAMS = ftpfs-ls_unittest
 
-AM_CPPFLAGS = -DFUSE_USE_VERSION=25
+AM_CPPFLAGS = -DFUSE_USE_VERSION=25 -D_XOPEN_SOURCE=600
 
 ftpfs_ls_unittest_SOURCES = ftpfs-ls_unittest.c
 if FUSE_OPT_COMPAT
Index: curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c
===================================================================
--- curlftpfs-0.9.2.orig/tests/ftpfs-ls_unittest.c
+++ curlftpfs-0.9.2/tests/ftpfs-ls_unittest.c
@@ -6,7 +6,6 @@
     See the file COPYING.
 */
 
-#define _XOPEN_SOURCE 600  /* glibc2 needs this */
 #include <time.h>                                                        
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/testing/curlftpfs/550-getpass-prototype.patch b/testing/curlftpfs/550-getpass-prototype.patch
new file mode 100644
index 0000000000..6ec55eff58
--- /dev/null
+++ b/testing/curlftpfs/550-getpass-prototype.patch
@@ -0,0 +1,20 @@
Description: add getpass() prototype
 This function has been deprecated and is not declared with
 _XOPEN_SOURCE>=600. To avoid fiddling too much with feature flags, we
 just add its prototype to ensure a correct declaration.
Forwarded: no (dead upstream)
Bug: #795879

Index: curlftpfs-0.9.2/ftpfs.c
===================================================================
--- curlftpfs-0.9.2.orig/ftpfs.c
+++ curlftpfs-0.9.2/ftpfs.c
@@ -36,6 +36,8 @@
 
 #define MAX_BUFFER_LEN (300*1024)
 
+extern char *getpass(const char *prompt);
+
 struct ftpfs ftpfs;
 static char error_buf[CURL_ERROR_SIZE];
 
diff --git a/testing/curlftpfs/APKBUILD b/testing/curlftpfs/APKBUILD
new file mode 100644
index 0000000000..516071e6e2
--- /dev/null
+++ b/testing/curlftpfs/APKBUILD
@@ -0,0 +1,44 @@
# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=curlftpfs
pkgver=0.9.2
pkgrel=0
pkgdesc="Fuse mount FTP server"
url="https://sourceforge.net/projects/curlftpfs/"
arch="all"
license="GPL-2.0-only"
depends="libcurl glib"
makedepends="curl-dev glib-dev fuse-dev"
install=""
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/project/curlftpfs/curlftpfs/0.9.2/curlftpfs-0.9.2.tar.gz
	001-uclibc_mod.patch
	500-fix-CURLOPT_INFILESIZE.patch
	510-free_ftpfs_file-memleak-fix.patch
	520-nocache-memleak-fix.patch
	530-curlftpfs__no_verify_hostname.patch
	540-consistent-feature-flag.patch
	550-getpass-prototype.patch
	"
builddir="$srcdir/${pkgname}-${pkgver}"
patch_args="-p1"

build() {
	cd "$builddir"
  ./configure --prefix=/usr
  make CFLAGS="-I/usr/include/fuse -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D__off_t=off_t -D_FILE_OFFSET_BITS=64"
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

sha512sums="df07c418d175f766c89525017fc56e79726061eee0c3a6607ded0e1bf24f64f1475ba0e546157b65892194e3c4414c120822bf8fb175437e68366f82de216067  curlftpfs-0.9.2.tar.gz
a5705945c04382db2f82b6f8c34e9367b6ee3d442d11744403c78f7a9236d5117fbb0a94824dc5c5572bcda701104f2769264764ab4b5d24017ff58f6a3fa3d1  001-uclibc_mod.patch
ee0055cb2271da9ed5251800a4d0a7bc64b68482d6f221127d1dbe3df6bdda22a45a9e9ea7f0c938d1eac484a86920c9a76dbd160deb87f78da1515373309f57  500-fix-CURLOPT_INFILESIZE.patch
e37011cfcb60004d68a4cb76da3a811349166063057e7af5d75d9f982ffab6093cda648f07ee1dfc30abfc8ef19894ae7cb6f90b3d3ca4b1a4affe3a19a95f08  510-free_ftpfs_file-memleak-fix.patch
ffef57586e2023c3257bfa1d48c5dd318c17e80867b2c467ee99a538813d459568260daf23caf84a751a7d1c18fd05b54d967a5d8e740adbd1bac1af1effe74c  520-nocache-memleak-fix.patch
f3478952ef8667ac808d0a1c97c7211da8a091ef27fe2fc87cb2a685060c479af1422e2a8cfaea6d3cd3014758cbb4cc25a3dbec4d9b50da03195cd294efb296  530-curlftpfs__no_verify_hostname.patch
4448ee5ebb79e404cc0eb37ef39c510015ef9b8901724c396ffee52bc45ba8c2636f6f3e6ec2dc4390b37c5662b54c72a13df32807dabfc523a0f65f484a8540  540-consistent-feature-flag.patch
5657e2261012b81fda02488a0aa083d88c3d9ea2b435b38a46dc1e04afc34824aa452dd903f1ac956a37c9c2fa19f65c4021d531450abbe47e074dbad5819a63  550-getpass-prototype.patch"
-- 
2.18.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)