[150503] trunk/dports/fuse/sshfs
aronnax at macports.org
aronnax at macports.org
Wed Jul 20 09:53:47 PDT 2016
Revision: 150503
https://trac.macports.org/changeset/150503
Author: aronnax at macports.org
Date: 2016-07-20 09:53:47 -0700 (Wed, 20 Jul 2016)
Log Message:
-----------
sshfs: update to 2.8 (now on github)
Modified Paths:
--------------
trunk/dports/fuse/sshfs/Portfile
trunk/dports/fuse/sshfs/files/patch-configure.ac.diff
Removed Paths:
-------------
trunk/dports/fuse/sshfs/files/patch-from-fuse4x.diff
trunk/dports/fuse/sshfs/files/patch-sshfs.1.diff
Modified: trunk/dports/fuse/sshfs/Portfile
===================================================================
--- trunk/dports/fuse/sshfs/Portfile 2016-07-20 16:40:55 UTC (rev 150502)
+++ trunk/dports/fuse/sshfs/Portfile 2016-07-20 16:53:47 UTC (rev 150503)
@@ -1,10 +1,10 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
-PortSystem 1.0
+PortSystem 1.0
+PortGroup github 1.0
-name sshfs
-version 2.5
+github.setup libfuse sshfs 2.8 sshfs_
categories fuse
platforms darwin
@@ -18,17 +18,11 @@
mounting the filesystem is as easy as logging \
into the server with ssh.
-homepage http://fuse.sourceforge.net/sshfs.html
-
-distname sshfs-fuse-${version}
-master_sites sourceforge:fuse
license GPL-2
-checksums rmd160 055b4d39de5836fa6638eaca642b55b3cd939d02 \
- sha256 e9171452e5d0150b9c6a2158fd2e2dcefb5d5d03ba4d208949e00a3a46c6e63e
+checksums rmd160 85425d3198f5c0d8ae0d5a456a37b6294744f7c2 \
+ sha256 2cafba9ff65a3e97a7a9aba4a7b83e683b598ffdac317c802bb8d166b1c4715a
-livecheck.distname sshfs-fuse
-
depends_build path:bin/pkg-config:pkgconfig
depends_lib port:gettext \
path:lib/pkgconfig/glib-2.0.pc:glib2 \
@@ -36,17 +30,9 @@
port:libiconv \
bin:ssh:openssh
-patchfiles patch-from-fuse4x.diff \
- patch-configure.ac.diff \
- patch-sshfs.1.diff
-patch.pre_args -p1
+patchfiles patch-configure.ac.diff
# osxfuse is -universal
universal_variant no
-post-patch {
- # automake 1.13 compatibility (see #37513)
- reinplace "s|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|" ${worksrcpath}/configure.ac
-}
-
use_autoreconf yes
Modified: trunk/dports/fuse/sshfs/files/patch-configure.ac.diff
===================================================================
--- trunk/dports/fuse/sshfs/files/patch-configure.ac.diff 2016-07-20 16:40:55 UTC (rev 150502)
+++ trunk/dports/fuse/sshfs/files/patch-configure.ac.diff 2016-07-20 16:53:47 UTC (rev 150503)
@@ -1,10 +1,19 @@
---- sshfs-fuse-2.3/configure.ac.orig 2011-08-11 17:47:30.000000000 -0400
-+++ sshfs-fuse-2.3/configure.ac 2011-08-11 17:48:03.000000000 -0400
-@@ -36,7 +36,6 @@
+--- configure.ac.orig 2016-07-20 12:37:24.000000000 -0400
++++ configure.ac 2016-07-20 12:38:27.000000000 -0400
+@@ -1,7 +1,7 @@
+ AC_INIT(sshfs, 2.8)
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE([foreign subdir-objects])
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+ AC_PROG_CC
+ AM_PROG_CC_C_O
+@@ -43,7 +43,6 @@
+
AM_CONDITIONAL(SSH_NODELAY_SO, test "$enable_sshnodelay" = "yes")
-export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
- PKG_CHECK_MODULES(SSHFS, [fuse >= 2.3 glib-2.0 gthread-2.0])
+ PKG_CHECK_MODULES([SSHFS], [fuse >= 2.3 glib-2.0 gthread-2.0])
have_fuse_opt_parse=no
oldlibs="$LIBS"
Deleted: trunk/dports/fuse/sshfs/files/patch-from-fuse4x.diff
===================================================================
--- trunk/dports/fuse/sshfs/files/patch-from-fuse4x.diff 2016-07-20 16:40:55 UTC (rev 150502)
+++ trunk/dports/fuse/sshfs/files/patch-from-fuse4x.diff 2016-07-20 16:53:47 UTC (rev 150503)
@@ -1,706 +0,0 @@
-diff --git a/Makefile.am b/Makefile.am
-index a80788b..99e1dc8 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -2,14 +2,14 @@
-
- bin_PROGRAMS = sshfs
-
--sshfs_SOURCES = sshfs.c cache.c cache.h
-+sshfs_SOURCES = sshfs.c cache.c cache.h compat/darwin_semaphore.h compat/darwin_semaphore.c
- if FUSE_OPT_COMPAT
- sshfs_SOURCES += compat/fuse_opt.c compat/fuse_opt.h
- endif
-
- sshfs_LDADD = $(SSHFS_LIBS)
- sshfs_CFLAGS = $(SSHFS_CFLAGS)
--sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\"
-+sshfs_CPPFLAGS = -D_REENTRANT -DFUSE_USE_VERSION=26 -DLIBDIR=\"$(libdir)\" -Icompat
-
- EXTRA_DIST = sshnodelay.c FAQ.txt
- CLEANFILES = sshnodelay.so
-diff --git a/cache.c b/cache.c
-index 2a06726..ab274bc 100644
---- a/cache.c
-+++ b/cache.c
-@@ -553,6 +553,9 @@ struct fuse_operations *cache_init(struct fuse_cache_operations *oper)
- cache.next_oper = oper;
-
- cache_unity_fill(oper, &cache_oper);
-+#ifdef __APPLE__
-+ cache_enabled = cache.on;
-+#endif
- if (cache.on) {
- cache_fill(oper, &cache_oper);
- pthread_mutex_init(&cache.lock, NULL);
-@@ -587,3 +590,7 @@ int cache_parse_options(struct fuse_args *args)
-
- return fuse_opt_parse(args, &cache, cache_opts, NULL);
- }
-+
-+#ifdef __APPLE__
-+int cache_enabled;
-+#endif
-diff --git a/cache.h b/cache.h
-index cec9ca4..8ca0989 100644
---- a/cache.h
-+++ b/cache.h
-@@ -27,3 +27,7 @@ int cache_parse_options(struct fuse_args *args);
- void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr);
- void cache_invalidate(const char *path);
- uint64_t cache_get_write_ctr(void);
-+
-+#ifdef __APPLE__
-+extern int cache_enabled;
-+#endif
-diff --git a/compat/darwin_semaphore.c b/compat/darwin_semaphore.c
-new file mode 100644
-index 0000000..e45fd9a
---- /dev/null
-+++ b/compat/darwin_semaphore.c
-@@ -0,0 +1,229 @@
-+/*
-+ * Copyright (C) 2000,02 Free Software Foundation, Inc.
-+ * This file is part of the GNU C Library.
-+ * Written by Ga<EB>l Le Mignot <address at hidden>
-+ *
-+ * The GNU C Library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public License as
-+ * published by the Free Software Foundation; either version 2 of the
-+ * License, or (at your option) any later version.
-+ *
-+ * The GNU C Library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with the GNU C Library; see the file COPYING.LIB. If not,
-+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ * Boston, MA 02111-1307, USA.
-+ */
-+
-+#include "darwin_semaphore.h"
-+
-+#include <assert.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+
-+#define __SEM_ID_NONE 0x0
-+#define __SEM_ID_LOCAL 0xcafef00d
-+
-+/* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_init.html */
-+int
-+compat_sem_init(compat_sem_t *sem, int pshared, unsigned int value)
-+{
-+ if (pshared) {
-+ errno = ENOSYS;
-+ return -1;
-+ }
-+
-+ sem->id = __SEM_ID_NONE;
-+
-+ if (pthread_cond_init(&sem->__data.local.count_cond, NULL)) {
-+ goto cond_init_fail;
-+ }
-+
-+ if (pthread_mutex_init(&sem->__data.local.count_lock, NULL)) {
-+ goto mutex_init_fail;
-+ }
-+
-+ sem->__data.local.count = value;
-+ sem->id = __SEM_ID_LOCAL;
-+
-+ return 0;
-+
-+mutex_init_fail:
-+
-+ pthread_cond_destroy(&sem->__data.local.count_cond);
-+
-+cond_init_fail:
-+
-+ return -1;
-+}
-+
-+/* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_destroy.html */
-+int
-+compat_sem_destroy(compat_sem_t *sem)
-+{
-+ int res = 0;
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ sem->id = __SEM_ID_NONE;
-+ pthread_cond_broadcast(&sem->__data.local.count_cond);
-+
-+ if (pthread_cond_destroy(&sem->__data.local.count_cond)) {
-+ res = -1;
-+ }
-+
-+ pthread_mutex_unlock(&sem->__data.local.count_lock);
-+
-+ if (pthread_mutex_destroy(&sem->__data.local.count_lock)) {
-+ res = -1;
-+ }
-+
-+ return res;
-+}
-+
-+int
-+compat_sem_getvalue(compat_sem_t *sem, unsigned int *sval)
-+{
-+ int res = 0;
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ res = -1;
-+ errno = EINVAL;
-+ } else {
-+ *sval = sem->__data.local.count;
-+ }
-+
-+ pthread_mutex_unlock(&sem->__data.local.count_lock);
-+
-+ return res;
-+}
-+
-+/* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_post.html */
-+int
-+compat_sem_post(compat_sem_t *sem)
-+{
-+ int res = 0;
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ res = -1;
-+ errno = EINVAL;
-+ } else if (sem->__data.local.count < COMPAT_SEM_VALUE_MAX) {
-+ sem->__data.local.count++;
-+ if (sem->__data.local.count == 1) {
-+ pthread_cond_signal(&sem->__data.local.count_cond);
-+ }
-+ } else {
-+ errno = ERANGE;
-+ res = -1;
-+ }
-+
-+ pthread_mutex_unlock(&sem->__data.local.count_lock);
-+
-+ return res;
-+}
-+
-+/* http://www.opengroup.org/onlinepubs/009695399/functions/sem_timedwait.html */
-+int
-+compat_sem_timedwait(compat_sem_t *sem, const struct timespec *abs_timeout)
-+{
-+ int res = 0;
-+
-+ if (abs_timeout &&
-+ (abs_timeout->tv_nsec < 0 || abs_timeout->tv_nsec >= 1000000000)) {
-+ errno = EINVAL;
-+ return -1;
-+ }
-+
-+ pthread_cleanup_push((void(*)(void*))&pthread_mutex_unlock,
-+ &sem->__data.local.count_lock);
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ errno = EINVAL;
-+ res = -1;
-+ } else {
-+ if (!sem->__data.local.count) {
-+ res = pthread_cond_timedwait(&sem->__data.local.count_cond,
-+ &sem->__data.local.count_lock,
-+ abs_timeout);
-+ }
-+ if (res) {
-+ assert(res == ETIMEDOUT);
-+ res = -1;
-+ errno = ETIMEDOUT;
-+ } else if (sem->id != __SEM_ID_LOCAL) {
-+ res = -1;
-+ errno = EINVAL;
-+ } else {
-+ sem->__data.local.count--;
-+ }
-+ }
-+
-+ pthread_cleanup_pop(1);
-+
-+ return res;
-+}
-+
-+/* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_trywait.html */
-+int
-+compat_sem_trywait(compat_sem_t *sem)
-+{
-+ int res = 0;
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ res = -1;
-+ errno = EINVAL;
-+ } else if (sem->__data.local.count) {
-+ sem->__data.local.count--;
-+ } else {
-+ res = -1;
-+ errno = EAGAIN;
-+ }
-+
-+ pthread_mutex_unlock (&sem->__data.local.count_lock);
-+
-+ return res;
-+}
-+
-+/* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_wait.html */
-+int
-+compat_sem_wait(compat_sem_t *sem)
-+{
-+ int res = 0;
-+
-+ pthread_cleanup_push((void(*)(void*))&pthread_mutex_unlock,
-+ &sem->__data.local.count_lock);
-+
-+ pthread_mutex_lock(&sem->__data.local.count_lock);
-+
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ errno = EINVAL;
-+ res = -1;
-+ } else {
-+ while (!sem->__data.local.count) {
-+ pthread_cond_wait(&sem->__data.local.count_cond,
-+ &sem->__data.local.count_lock);
-+ }
-+ if (sem->id != __SEM_ID_LOCAL) {
-+ res = -1;
-+ errno = EINVAL;
-+ } else {
-+ sem->__data.local.count--;
-+ }
-+ }
-+
-+ pthread_cleanup_pop(1);
-+
-+ return res;
-+}
-diff --git a/compat/darwin_semaphore.h b/compat/darwin_semaphore.h
-new file mode 100644
-index 0000000..3f03e41
---- /dev/null
-+++ b/compat/darwin_semaphore.h
-@@ -0,0 +1,69 @@
-+/* Copyright (C) 2000,02 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Gaël Le Mignot <address at hidden>
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Library General Public License as
-+ published by the Free Software Foundation; either version 2 of the
-+ License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Library General Public License for more details.
-+
-+ You should have received a copy of the GNU Library General Public
-+ License along with the GNU C Library; see the file COPYING.LIB. If not,
-+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA. */
-+
-+// This implementation is based on libsem http://lists.debian.org/debian-devel/2004/08/msg00612.html
-+
-+#ifndef _SEMAPHORE_H_
-+#define _SEMAPHORE_H_
-+
-+/* Caller must not include <semaphore.h> */
-+
-+#include <pthread.h>
-+
-+struct __local_sem_t
-+{
-+ unsigned int count;
-+ pthread_mutex_t count_lock;
-+ pthread_cond_t count_cond;
-+};
-+
-+typedef struct compat_sem {
-+ unsigned int id;
-+ union {
-+ struct __local_sem_t local;
-+ } __data;
-+} compat_sem_t;
-+
-+#define COMPAT_SEM_VALUE_MAX ((int32_t)32767)
-+
-+int compat_sem_init(compat_sem_t *sem, int pshared, unsigned int value);
-+int compat_sem_destroy(compat_sem_t *sem);
-+int compat_sem_getvalue(compat_sem_t *sem, unsigned int *value);
-+int compat_sem_post(compat_sem_t *sem);
-+int compat_sem_timedwait(compat_sem_t *sem, const struct timespec *abs_timeout);
-+int compat_sem_trywait(compat_sem_t *sem);
-+int compat_sem_wait(compat_sem_t *sem);
-+
-+
-+/* Redefine semaphores. Caller must not include <semaphore.h> */
-+
-+typedef compat_sem_t sem_t;
-+
-+#define sem_init(s, p, v) compat_sem_init(s, p, v)
-+#define sem_destroy(s) compat_sem_destroy(s)
-+#define sem_getvalue(s, v) compat_sem_getvalue(s, v)
-+#define sem_post(s) compat_sem_post(s)
-+#define sem_timedwait(s, t) compat_sem_timedwait(s, t)
-+#define sem_trywait(s) compat_sem_trywait(s)
-+#define sem_wait(s) compat_sem_wait(s)
-+
-+#define SEM_VALUE_MAX COMPAT_SEM_VALUE_MAX
-+
-+
-+#endif /* semaphore.h */
-diff --git a/sshfs.c b/sshfs.c
-index 7cfa341..39f3286 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -20,7 +20,11 @@
- #include <string.h>
- #include <stdint.h>
- #include <errno.h>
-+#ifdef __APPLE__
-+#include <darwin_semaphore.h>
-+#else
- #include <semaphore.h>
-+#endif
- #include <pthread.h>
- #include <netdb.h>
- #include <signal.h>
-@@ -38,6 +42,10 @@
- #include <pwd.h>
- #include <grp.h>
- #include <limits.h>
-+#ifdef __APPLE__
-+#include <libgen.h>
-+#include <strings.h>
-+#endif
-
- #include "cache.h"
-
-@@ -121,6 +129,16 @@
-
- #define SSHNODELAY_SO "sshnodelay.so"
-
-+#ifdef __APPLE__
-+
-+#ifndef LIBDIR
-+#define LIBDIR "/usr/local/lib"
-+#endif
-+
-+static char sshfs_program_path[PATH_MAX] = { 0 };
-+
-+#endif
-+
- struct buffer {
- uint8_t *p;
- size_t len;
-@@ -183,6 +201,9 @@ struct sshfs_file {
- int connver;
- int modifver;
- int refs;
-+#ifdef __APPLE__
-+ pthread_mutex_t file_lock;
-+#endif
- };
-
- struct sshfs {
-@@ -234,6 +255,10 @@ struct sshfs {
- int server_version;
- unsigned remote_uid;
- unsigned local_uid;
-+#ifdef __APPLE__
-+ unsigned remote_gid;
-+ unsigned local_gid;
-+#endif
- int remote_uid_detected;
- unsigned blksize;
- char *progname;
-@@ -727,8 +752,17 @@ static int buf_get_attrs(struct buffer *buf, struct stat *stbuf, int *flagsp)
- }
- }
-
-+#ifdef __APPLE__
-+ if (sshfs.remote_uid_detected) {
-+ if (uid == sshfs.remote_uid)
-+ uid = sshfs.local_uid;
-+ if (gid == sshfs.remote_gid)
-+ gid = sshfs.local_gid;
-+ }
-+#else
- if (sshfs.remote_uid_detected && uid == sshfs.remote_uid)
- uid = sshfs.local_uid;
-+#endif
- if (sshfs.idmap == IDMAP_FILE && sshfs.uid_map)
- if (translate_id(&uid, sshfs.uid_map) == -1)
- return -EPERM;
-@@ -837,11 +871,33 @@ static void ssh_add_arg(const char *arg)
- #ifdef SSH_NODELAY_WORKAROUND
- static int do_ssh_nodelay_workaround(void)
- {
-+#ifdef __APPLE__
-+ char *oldpreload = getenv("DYLD_INSERT_LIBRARIES");
-+#else
- char *oldpreload = getenv("LD_PRELOAD");
-+#endif
- char *newpreload;
- char sopath[PATH_MAX];
- int res;
-
-+#ifdef __APPLE__
-+ char *sshfs_program_path_base = NULL;
-+ if (!sshfs_program_path[0]) {
-+ goto nobundle;
-+ }
-+ sshfs_program_path_base = dirname(sshfs_program_path);
-+ if (!sshfs_program_path_base) {
-+ goto nobundle;
-+ }
-+ snprintf(sopath, sizeof(sopath), "%s/%s", sshfs_program_path_base,
-+ SSHNODELAY_SO);
-+ res = access(sopath, R_OK);
-+ if (res == -1) {
-+ goto nobundle;
-+ }
-+ goto pathok;
-+nobundle:
-+#endif
- snprintf(sopath, sizeof(sopath), "%s/%s", LIBDIR, SSHNODELAY_SO);
- res = access(sopath, R_OK);
- if (res == -1) {
-@@ -866,16 +922,24 @@ static int do_ssh_nodelay_workaround(void)
- return -1;
- }
- }
-+#ifdef __APPLE__
-+pathok:
-+#endif
-
- newpreload = g_strdup_printf("%s%s%s",
- oldpreload ? oldpreload : "",
- oldpreload ? " " : "",
- sopath);
-
-+#ifdef __APPLE__
-+ if (!newpreload || setenv("DYLD_INSERT_LIBRARIES", newpreload, 1) == -1)
-+ fprintf(stderr, "warning: failed set DYLD_INSERT_LIBRARIES for ssh nodelay workaround\n");
-+#else
- if (!newpreload || setenv("LD_PRELOAD", newpreload, 1) == -1) {
- fprintf(stderr, "warning: failed set LD_PRELOAD "
- "for ssh nodelay workaround\n");
- }
-+#endif
- g_free(newpreload);
- return 0;
- }
-@@ -1595,6 +1659,10 @@ static void sftp_detect_uid()
-
- sshfs.remote_uid = stbuf.st_uid;
- sshfs.local_uid = getuid();
-+#ifdef __APPLE__
-+ sshfs.remote_gid = stbuf.st_gid;
-+ sshfs.local_gid = getgid();
-+#endif
- sshfs.remote_uid_detected = 1;
- DEBUG("remote_uid = %i\n", sshfs.remote_uid);
-
-@@ -2238,6 +2306,14 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid)
- buf_init(&buf, 0);
- buf_add_path(&buf, path);
- buf_add_uint32(&buf, SSH_FILEXFER_ATTR_UIDGID);
-+#ifdef __APPLE__
-+ if (sshfs.remote_uid_detected) {
-+ if (uid == sshfs.local_uid)
-+ uid = sshfs.remote_uid;
-+ if (gid == sshfs.local_gid)
-+ gid = sshfs.remote_gid;
-+ }
-+#endif
- buf_add_uint32(&buf, uid);
- buf_add_uint32(&buf, gid);
- err = sftp_request(SSH_FXP_SETSTAT, &buf, SSH_FXP_STATUS, NULL);
-@@ -2334,6 +2410,9 @@ static int sshfs_open_common(const char *path, mode_t mode,
- sf = g_new0(struct sshfs_file, 1);
- list_init(&sf->write_reqs);
- pthread_cond_init(&sf->write_finished, NULL);
-+#ifdef __APPLE__
-+ pthread_mutex_init(&sf->file_lock, NULL);
-+#endif
- /* Assume random read after open */
- sf->is_seq = 0;
- sf->refs = 1;
-@@ -2368,11 +2447,21 @@ static int sshfs_open_common(const char *path, mode_t mode,
- }
-
- if (!err) {
-+#ifdef __APPLE__
-+ if (cache_enabled)
-+ cache_add_attr(path, &stbuf, wrctr);
-+#else
- cache_add_attr(path, &stbuf, wrctr);
-+#endif
- buf_finish(&sf->handle);
- fi->fh = (unsigned long) sf;
- } else {
-+#ifdef __APPLE__
-+ if (cache_enabled)
-+ cache_invalidate(path);
-+#else
- cache_invalidate(path);
-+#endif
- g_free(sf);
- }
- buf_free(&buf);
-@@ -2427,14 +2516,32 @@ static int sshfs_fsync(const char *path, int isdatasync,
-
- static void sshfs_file_put(struct sshfs_file *sf)
- {
-+#ifdef __APPLE__
-+ pthread_mutex_lock(&sf->file_lock);
-+#endif
- sf->refs--;
-+#ifdef __APPLE__
-+ if (!sf->refs) {
-+ pthread_mutex_unlock(&sf->file_lock);
-+ g_free(sf);
-+ } else {
-+ pthread_mutex_unlock(&sf->file_lock);
-+ }
-+#else
- if (!sf->refs)
- g_free(sf);
-+#endif
- }
-
- static void sshfs_file_get(struct sshfs_file *sf)
- {
-+#ifdef __APPLE__
-+ pthread_mutex_lock(&sf->file_lock);
-+#endif
- sf->refs++;
-+#ifdef __APPLE__
-+ pthread_mutex_unlock(&sf->file_lock);
-+#endif
- }
-
- static int sshfs_release(const char *path, struct fuse_file_info *fi)
-@@ -3352,6 +3459,15 @@ static int read_password(void)
- perror("Failed to allocate locked page for password");
- return -1;
- }
-+#ifdef __APPLE__
-+ if (mlock(sshfs.password, size) != 0) {
-+ memset(sshfs.password, 0, size);
-+ munmap(sshfs.password, size);
-+ sshfs.password = NULL;
-+ perror("Failed to allocate locked page for password");
-+ return -1;
-+ }
-+#endif /* __APPLE__ */
-
- /* Don't use fgets() because password might stay in memory */
- for (n = 0; n < max_password; n++) {
-@@ -3677,8 +3793,13 @@ static inline void load_gid_map(void)
- read_id_map(sshfs.gid_file, &groupname_to_gid, "gid", &sshfs.gid_map, &sshfs.r_gid_map);
- }
-
--int main(int argc, char *argv[])
-+int main(int argc, char *argv[], __unused char *envp[], char **exec_path)
- {
-+#ifdef __APPLE__
-+ if (!realpath(*exec_path, sshfs_program_path)) {
-+ memset(sshfs_program_path, 0, PATH_MAX);
-+ }
-+#endif
- int res;
- struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
- char *tmp;
-@@ -3686,6 +3807,10 @@ int main(int argc, char *argv[])
- const char *sftp_server;
- int libver;
-
-+#ifdef __APPLE__
-+ /* Until this gets fixed somewhere else. */
-+ g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
-+#endif /* __APPLE__ */
- g_thread_init(NULL);
-
- sshfs.blksize = 4096;
-@@ -3694,7 +3819,11 @@ int main(int argc, char *argv[])
- sshfs.max_write = 32768;
- sshfs.nodelay_workaround = 1;
- sshfs.nodelaysrv_workaround = 0;
-+#ifdef __APPLE__
-+ sshfs.rename_workaround = 1;
-+#else
- sshfs.rename_workaround = 0;
-+#endif /* __APPLE__ */
- sshfs.truncate_workaround = 0;
- sshfs.buflimit_workaround = 1;
- sshfs.ssh_ver = 2;
-@@ -3713,6 +3842,10 @@ int main(int argc, char *argv[])
- ssh_add_arg("-a");
- ssh_add_arg("-oClearAllForwardings=yes");
-
-+#ifdef __APPLE__
-+ sshfs.detect_uid = 1;
-+#endif
-+
- if (fuse_opt_parse(&args, &sshfs, sshfs_opts, sshfs_opt_proc) == -1 ||
- parse_workarounds() == -1)
- exit(1);
-diff --git a/sshnodelay.c b/sshnodelay.c
-index 7518089..efe393c 100644
---- a/sshnodelay.c
-+++ b/sshnodelay.c
-@@ -5,6 +5,32 @@
- #include <netinet/in.h>
- #include <netinet/tcp.h>
-
-+#ifdef __APPLE__
-+
-+int custom_connect(int sock, const struct sockaddr *addr, socklen_t addrlen);
-+
-+typedef struct interpose_s {
-+ void *new_func;
-+ void *orig_func;
-+} interpose_t;
-+
-+static const interpose_t interposers[] \
-+ __attribute__ ((section("__DATA, __interpose"))) = {
-+ { (void *)custom_connect, (void *)connect },
-+};
-+
-+int custom_connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
-+{
-+ int res = connect(sock, addr, addrlen);
-+ if (!res && addr->sa_family == AF_INET) {
-+ int opt = 1;
-+ setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
-+ }
-+ return res;
-+}
-+
-+#else
-+
- int connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
- {
- int (*next_connect)(int, const struct sockaddr *, socklen_t) =
-@@ -16,3 +42,5 @@ int connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
- }
- return res;
- }
-+
-+#endif
Deleted: trunk/dports/fuse/sshfs/files/patch-sshfs.1.diff
===================================================================
--- trunk/dports/fuse/sshfs/files/patch-sshfs.1.diff 2016-07-20 16:40:55 UTC (rev 150502)
+++ trunk/dports/fuse/sshfs/files/patch-sshfs.1.diff 2016-07-20 16:53:47 UTC (rev 150503)
@@ -1,11 +0,0 @@
---- sshfs-fuse-2.4/sshfs.1.orig 2012-08-23 10:13:26.000000000 +0200
-+++ sshfs-fuse-2.4/sshfs.1 2012-08-23 10:13:51.000000000 +0200
-@@ -7,7 +7,7 @@
- \fBsshfs\fP [\fIuser\fP@]\fBhost\fP:[\fIdir\fP] \fBmountpoint\fP [\fIoptions\fP]
- .SS unmounting
- .TP
--\fBfusermount -u mountpoint\fP
-+\fBumount mountpoint\fP
- .SH DESCRIPTION
- SSHFS (Secure SHell FileSystem) is a file system for Linux (and other
- operating systems with a FUSE implementation, such as Mac OS X or FreeBSD)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160720/f87ca369/attachment-0001.html>
More information about the macports-changes
mailing list