pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/filesystems/fuse-sshfs



Module Name:    pkgsrc
Committed By:   pho
Date:           Sat Jan 22 18:48:04 UTC 2022

Modified Files:
        pkgsrc/filesystems/fuse-sshfs: Makefile distinfo
        pkgsrc/filesystems/fuse-sshfs/patches: patch-cache.c patch-sshfs.c
Removed Files:
        pkgsrc/filesystems/fuse-sshfs/patches: patch-meson.build

Log Message:
Conditionalise workarounds for old NetBSD librefuse


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 pkgsrc/filesystems/fuse-sshfs/Makefile
cvs rdiff -u -r1.5 -r1.6 pkgsrc/filesystems/fuse-sshfs/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c \
    pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c
cvs rdiff -u -r1.1 -r0 \
    pkgsrc/filesystems/fuse-sshfs/patches/patch-meson.build

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/filesystems/fuse-sshfs/Makefile
diff -u pkgsrc/filesystems/fuse-sshfs/Makefile:1.6 pkgsrc/filesystems/fuse-sshfs/Makefile:1.7
--- pkgsrc/filesystems/fuse-sshfs/Makefile:1.6  Mon Dec 20 07:09:07 2021
+++ pkgsrc/filesystems/fuse-sshfs/Makefile      Sat Jan 22 18:48:04 2022
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.6 2021/12/20 07:09:07 nia Exp $
+# $NetBSD: Makefile,v 1.7 2022/01/22 18:48:04 pho Exp $
 #
 
 DISTNAME=      sshfs-3.7.2
 PKGNAME=       fuse-${DISTNAME}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    filesystems
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=libfuse/}
 GITHUB_PROJECT=        sshfs

Index: pkgsrc/filesystems/fuse-sshfs/distinfo
diff -u pkgsrc/filesystems/fuse-sshfs/distinfo:1.5 pkgsrc/filesystems/fuse-sshfs/distinfo:1.6
--- pkgsrc/filesystems/fuse-sshfs/distinfo:1.5  Thu Dec  2 07:28:40 2021
+++ pkgsrc/filesystems/fuse-sshfs/distinfo      Sat Jan 22 18:48:04 2022
@@ -1,9 +1,8 @@
-$NetBSD: distinfo,v 1.5 2021/12/02 07:28:40 pho Exp $
+$NetBSD: distinfo,v 1.6 2022/01/22 18:48:04 pho Exp $
 
 BLAKE2s (sshfs-3.7.2.tar.xz) = a770780be6c0d5b26ebb9b7b43c35c8a689e226a619f03cdaee847598c81d025
 SHA512 (sshfs-3.7.2.tar.xz) = 1612d515869a8b38c0bc3d79eaf80e8b4da1a9710c9668e6ec23e6b77313063ae0bee66ab9e9e0f70d98eaa1334425b2087dd93cc4618af3ac6ac191acf7f838
 Size (sshfs-3.7.2.tar.xz) = 53160 bytes
-SHA1 (patch-cache.c) = 9a089852ab3ad77d2b77c4323c5d65ed9f05036a
-SHA1 (patch-meson.build) = dd9549c3d099a4137089757bd743c8c0bbb63b35
-SHA1 (patch-sshfs.c) = 4f06a3c945de2f4b3b8e5935b28c6fca0d50a355
+SHA1 (patch-cache.c) = 570525d7cae09055537b00e3eeadb639c6f1fa5b
+SHA1 (patch-sshfs.c) = 95e0b5bf01c36b803d1ea0c3b71b8740be98506b
 SHA1 (patch-utils_install__helper.sh) = 7e31f031ecf40731acb4a96b0c23543b7015c290

Index: pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c
diff -u pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c:1.1 pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c:1.2
--- pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c:1.1     Thu Dec  2 07:28:40 2021
+++ pkgsrc/filesystems/fuse-sshfs/patches/patch-cache.c Sat Jan 22 18:48:04 2022
@@ -1,10 +1,8 @@
-$NetBSD: patch-cache.c,v 1.1 2021/12/02 07:28:40 pho Exp $
+$NetBSD: patch-cache.c,v 1.2 2022/01/22 18:48:04 pho Exp $
 
-Impedance adjustment with librefuse. Never send this to the
-upstream. It's our code that needs to be fixed, not theirs!
-
-TODO: This patch should *really* be gone, except for one thing (see
-comments). Update librefuse.
+Impedance adjustment with librefuse which used to provide an old API
+incompatible with FUSE 3.1. This patch can go away when NetBSD 9
+reaches its EOL, except for one thing (see comments).
 
 --- cache.c.orig       2021-06-08 08:52:08.000000000 +0000
 +++ cache.c
@@ -12,7 +10,7 @@ comments). Update librefuse.
        return res;
  }
  
-+#if defined(__NetBSD__) && FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static void *cache_init(struct fuse_conn_info *conn __attribute__((__unused__)))
 +{
 +      return cache.next_oper->init(NULL);
@@ -27,7 +25,7 @@ comments). Update librefuse.
  }
 +#endif
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_getattr(const char *path, struct stat *stbuf)
 +#else
  static int cache_getattr(const char *path, struct stat *stbuf,
@@ -37,7 +35,7 @@ comments). Update librefuse.
        int err = cache_get_attr(path, stbuf);
        if (err) {
                uint64_t wrctr = cache_get_write_ctr();
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              err = cache.next_oper->getattr(path, stbuf);
 +#else
                err = cache.next_oper->getattr(path, stbuf, fi);
@@ -49,7 +47,7 @@ comments). Update librefuse.
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_dirfill (void *buf, const char *name,
 +                        const struct stat *stbuf, off_t off)
 +#else
@@ -62,7 +60,7 @@ comments). Update librefuse.
        struct readdir_handle *ch;
  
        ch = (struct readdir_handle*) buf;
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +      err = ch->filler(ch->buf, name, stbuf, off);
 +#else
        err = ch->filler(ch->buf, name, stbuf, off, flags);
@@ -74,7 +72,7 @@ comments). Update librefuse.
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
 +                       off_t offset, struct fuse_file_info *fi)
 +#else
@@ -89,7 +87,7 @@ comments). Update librefuse.
                if (node->dir_valid - now >= 0) {
                        for(dir = node->dir; *dir != NULL; dir++)
                                // FIXME: What about st_mode?
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +                              filler(buf, *dir, NULL, 0);
 +#else
                                filler(buf, *dir, NULL, 0, 0);
@@ -101,7 +99,7 @@ comments). Update librefuse.
        ch.filler = filler;
        ch.dir = g_ptr_array_new();
        ch.wrctr = cache_get_write_ctr();
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +      err = cache.next_oper->readdir(path, &ch, cache_dirfill, offset, fi);
 +#else
        err = cache.next_oper->readdir(path, &ch, cache_dirfill, offset, fi, flags);
@@ -121,7 +119,7 @@ comments). Update librefuse.
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_rename(const char *from, const char *to)
 +{
 +      int err = cache.next_oper->rename(from, to);
@@ -145,7 +143,7 @@ comments). Update librefuse.
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_chmod(const char *path, mode_t mode)
 +{
 +      int err = cache.next_oper->chmod(path, mode);
@@ -163,7 +161,7 @@ comments). Update librefuse.
  }
 +#endif
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_chown(const char *path, uid_t uid, gid_t gid)
 +{
 +      int err = cache.next_oper->chown(path, uid, gid);
@@ -181,7 +179,7 @@ comments). Update librefuse.
  }
 +#endif
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_utimens(const char *path, const struct timespec tv[2])
 +{
 +      int err = cache.next_oper->utimens(path, tv);
@@ -205,7 +203,7 @@ comments). Update librefuse.
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int cache_truncate(const char *path, off_t size)
 +{
 +      int err = cache.next_oper->truncate(path, size);
Index: pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c
diff -u pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c:1.1 pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c:1.2
--- pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c:1.1     Thu Dec  2 07:28:40 2021
+++ pkgsrc/filesystems/fuse-sshfs/patches/patch-sshfs.c Sat Jan 22 18:48:04 2022
@@ -1,9 +1,8 @@
-$NetBSD: patch-sshfs.c,v 1.1 2021/12/02 07:28:40 pho Exp $
+$NetBSD: patch-sshfs.c,v 1.2 2022/01/22 18:48:04 pho Exp $
 
-Impedance adjustment with librefuse. Never send this to the
-upstream. It's our code that needs to be fixed, not theirs!
-
-TODO: This patch should *really* be gone. Update librefuse.
+Impedance adjustment with librefuse which used to provide an old API
+incompatible with FUSE 3.1. This patch can go away when NetBSD 9
+reaches its EOL.
 
 --- sshfs.c.orig       2021-06-08 08:52:08.000000000 +0000
 +++ sshfs.c
@@ -11,7 +10,7 @@ TODO: This patch should *really* be gone
                                    S_ISLNK(stbuf.st_mode)) {
                                        stbuf.st_mode = 0;
                                }
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +                              filler(dbuf, name, &stbuf, 0);
 +#else
                                filler(dbuf, name, &stbuf, 0, 0);
@@ -23,7 +22,7 @@ TODO: This patch should *really* be gone
        return 0;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static void *sshfs_init(struct fuse_conn_info *conn __attribute__((__unused__)))
 +{
 +      sshfs.sync_read = 1;
@@ -53,7 +52,7 @@ TODO: This patch should *really* be gone
        int err = 0;
  
        if (mask & X_OK) {
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              err = sshfs.op->getattr(path, &stbuf);
 +#else
                err = sshfs.op->getattr(path, &stbuf, NULL);
@@ -66,7 +65,7 @@ TODO: This patch should *really* be gone
  }
  
 -static int sshfs_readdir(const char *path, void *dbuf, fuse_fill_dir_t filler,
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_readdir(const char *path __attribute__((__unused__)), void *dbuf, fuse_fill_dir_t filler,
 +                       off_t offset, struct fuse_file_info *fi)
 +#else
@@ -84,7 +83,7 @@ TODO: This patch should *really* be gone
        *str = '\0';
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_rename(const char *from, const char *to)
 +#else
  static int sshfs_rename(const char *from, const char *to, unsigned int flags)
@@ -93,7 +92,7 @@ TODO: This patch should *really* be gone
        int err;
        struct conntab_entry *ce;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if(flags != 0)
                return -EINVAL;
 +#endif
@@ -104,7 +103,7 @@ TODO: This patch should *really* be gone
        return (struct sshfs_file *) (uintptr_t) fi->fh;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_chmod(const char *path, mode_t mode)
 +#else
  static int sshfs_chmod(const char *path, mode_t mode,
@@ -116,7 +115,7 @@ TODO: This patch should *really* be gone
        struct buffer buf;
        struct sshfs_file *sf = NULL;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (fi != NULL) {
                sf = get_sshfs_file(fi);
                if (!sshfs_file_is_conn(sf))
@@ -130,7 +129,7 @@ TODO: This patch should *really* be gone
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_chown(const char *path, uid_t uid, gid_t gid)
 +#else
  static int sshfs_chown(const char *path, uid_t uid, gid_t gid,
@@ -142,7 +141,7 @@ TODO: This patch should *really* be gone
        struct buffer buf;
        struct sshfs_file *sf = NULL;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (fi != NULL) {
                sf = get_sshfs_file(fi);
                if (!sshfs_file_is_conn(sf))
@@ -156,7 +155,7 @@ TODO: This patch should *really* be gone
        return err;
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_truncate_workaround(const char *path, off_t size);
 +#else
  static int sshfs_truncate_workaround(const char *path, off_t size,
@@ -169,7 +168,7 @@ TODO: This patch should *really* be gone
        pthread_mutex_unlock(&sshfs.lock);
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_utimens(const char *path, const struct timespec tv[2])
 +#else
  static int sshfs_utimens(const char *path, const struct timespec tv[2],
@@ -184,7 +183,7 @@ TODO: This patch should *really* be gone
        if (msec == 0)
                msec = now.tv_sec;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (fi != NULL) {
                sf = get_sshfs_file(fi);
                if (!sshfs_file_is_conn(sf))
@@ -198,7 +197,7 @@ TODO: This patch should *really* be gone
        return sshfs_open_common(path, mode, fi);
  }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_truncate(const char *path, off_t size)
 +#else
  static int sshfs_truncate(const char *path, off_t size,
@@ -209,7 +208,7 @@ TODO: This patch should *really* be gone
        struct buffer buf;
        struct sshfs_file *sf = NULL;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (fi != NULL) {
                sf = get_sshfs_file(fi);
                if (!sshfs_file_is_conn(sf))
@@ -219,7 +218,7 @@ TODO: This patch should *really* be gone
  
        sshfs_inc_modifver();
        if (sshfs.truncate_workaround)
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              return sshfs_truncate_workaround(path, size);
 +#else
                return sshfs_truncate_workaround(path, size, fi);
@@ -227,19 +226,18 @@ TODO: This patch should *really* be gone
        
        buf_init(&buf, 0);
  
-@@ -3372,19 +3435,38 @@ static int sshfs_truncate(const char *pa
+@@ -3372,19 +3435,37 @@ static int sshfs_truncate(const char *pa
        return err;
  }
  
-+#if defined(__NetBSD__) && FUSE_MAJOR_VERSION < 3
-+/* Workaround for a librefuse issue. fuse_mount() calls
-+ * fuse_operations::getattr() before we are ready for that. The
-+ * resulting struct stat isn't even used apparently. librefuse really
-+ * shouldn't do that. */
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
++/* Workaround for an issue in the past versions of
++ * librefuse. fuse_mount() used to call fuse_operations::getattr()
++ * before we were ready for that. */
 +static int sshfs_initialized = 0;
 +#endif
 +
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_getattr(const char *path, struct stat *stbuf)
 +#else
  static int sshfs_getattr(const char *path, struct stat *stbuf,
@@ -251,12 +249,12 @@ TODO: This patch should *really* be gone
        struct buffer outbuf;
        struct sshfs_file *sf = NULL;
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +      if (!sshfs_initialized)
 +              return -EIO;
 +#endif
 +
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (fi != NULL && !sshfs.fstat_workaround) {
                sf = get_sshfs_file(fi);
                if (!sshfs_file_is_conn(sf))
@@ -266,11 +264,11 @@ TODO: This patch should *really* be gone
  
        buf_init(&buf, 0);
        if(sf == NULL) {
-@@ -3508,15 +3590,23 @@ static int sshfs_truncate_extend(const c
+@@ -3508,15 +3589,23 @@ static int sshfs_truncate_extend(const c
   * If new size is greater than current size, then write a zero byte to
   * the new end of the file.
   */
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +static int sshfs_truncate_workaround(const char *path, off_t size)
 +#else
  static int sshfs_truncate_workaround(const char *path, off_t size,
@@ -282,7 +280,7 @@ TODO: This patch should *really* be gone
        else {
                struct stat stbuf;
                int err;
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              err = sshfs_getattr(path, &stbuf);
 +#else
                err = sshfs_getattr(path, &stbuf, fi);
@@ -290,11 +288,11 @@ TODO: This patch should *really* be gone
                if (err)
                        return err;
                if (stbuf.st_size == size)
-@@ -3524,7 +3614,11 @@ static int sshfs_truncate_workaround(con
+@@ -3524,7 +3613,11 @@ static int sshfs_truncate_workaround(con
                else if (stbuf.st_size > size)
                        return sshfs_truncate_shrink(path, size);
                else
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +                      return sshfs_truncate_extend(path, size, NULL);
 +#else
                        return sshfs_truncate_extend(path, size, fi);
@@ -302,21 +300,21 @@ TODO: This patch should *really* be gone
        }
  }
  
-@@ -4156,7 +4250,9 @@ int main(int argc, char *argv[])
+@@ -4156,7 +4249,9 @@ int main(int argc, char *argv[])
        char *fsname;
        const char *sftp_server;
        struct fuse *fuse;
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        struct fuse_session *se;
 +#endif
        int i;
  
  #ifdef __APPLE__
-@@ -4216,7 +4312,11 @@ int main(int argc, char *argv[])
+@@ -4216,7 +4311,11 @@ int main(int argc, char *argv[])
  
        if (sshfs.show_version) {
                printf("SSHFS version %s\n", PACKAGE_VERSION);
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              printf("FUSE library version %d\n", fuse_version());
 +#else
                printf("FUSE library version %s\n", fuse_pkgversion());
@@ -324,11 +322,11 @@ TODO: This patch should *really* be gone
  #if !defined(__CYGWIN__)
                fuse_lowlevel_version();
  #endif
-@@ -4225,7 +4325,11 @@ int main(int argc, char *argv[])
+@@ -4225,7 +4324,11 @@ int main(int argc, char *argv[])
  
        if (sshfs.show_help) {
                usage(args.argv[0]);
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +              fuse_cmdline_help();
 +#else
                fuse_lib_help(&args);
@@ -336,11 +334,11 @@ TODO: This patch should *really* be gone
                exit(0);
        } else if (!sshfs.host) {
                fprintf(stderr, "missing host\n");
-@@ -4359,20 +4463,16 @@ int main(int argc, char *argv[])
+@@ -4359,20 +4462,16 @@ int main(int argc, char *argv[])
                        sizeof(struct fuse_operations), NULL);
        if(fuse == NULL)
                exit(1);
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        se = fuse_get_session(fuse);
        res = fuse_set_signal_handlers(se);
        if (res != 0) {
@@ -356,11 +354,11 @@ TODO: This patch should *really* be gone
 -      }
 -
 -#if !defined(__CYGWIN__)
-+#if !defined(__CYGWIN__) && FUSE_MAJOR_VERSION >= 3
++#if !defined(__CYGWIN__) && (!defined(__NetBSD__) || FUSE_H_ >= 20211204)
        res = fcntl(fuse_session_fd(se), F_SETFD, FD_CLOEXEC);
        if (res == -1)
                perror("WARNING: failed to set FD_CLOEXEC on fuse device");
-@@ -4384,29 +4484,55 @@ int main(int argc, char *argv[])
+@@ -4384,29 +4483,58 @@ int main(int argc, char *argv[])
         */
        res = ssh_connect();
        if (res == -1) {
@@ -369,7 +367,7 @@ TODO: This patch should *really* be gone
                exit(1);
        }
  
-+#if FUSE_MAJOR_VERSION < 3
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +      if (!sshfs.foreground)
 +              res = fuse_daemonize(fuse);
 +#else
@@ -381,24 +379,27 @@ TODO: This patch should *really* be gone
                exit(1);
        }
  
-+      /* NetBSD librefuse (actually libpuffs) requires that
-+       * applications call fuse_daemonize() before calling
-+       * fuse_mount(), otherwise the daemonizing parent process will
-+       * deadlock. FUSE on the other hand defines no specific order
-+       * of calling these two functions. pho@ thinks puffs_daemon()
-+       * waiting for the completion of fuse_mount() is actually
-+       * helpful and not a bug to be fixed, but it should at least
-+       * not deadlock. That is, fuse_daemonize() should immediately
-+       * kill the parent if the filesystem is already mounted. Until
-+       * the change is made, we reorder function calls here. */
++      /* NetBSD librefuse (actually libpuffs) used to require that user
++       * code calls fuse_daemonize() before calling fuse_mount(),
++       * otherwise the daemonizing parent process would deadlock. FUSE
++       * on the other hand defines no specific order of calling these
++       * two functions. pho@ thought puffs_daemon() waiting for the
++       * completion of fuse_mount() was actually helpful and not a bug
++       * to be fixed, but it should at least not deadlock. That is,
++       * fuse_daemonize() should immediately kill the parent if the
++       * filesystem is already mounted. The change has already been made
++       * in HEAD. */
 +      res = fuse_mount(fuse, sshfs.mountpoint);
 +      if (res != 0) {
 +              fuse_destroy(fuse);
 +              exit(1);
 +      }
 +
++#if defined(__NetBSD__) && FUSE_H_ < 20211204
 +      sshfs_initialized = 1;
-+#if FUSE_MAJOR_VERSION >= 3
++#endif
++
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        if (sshfs.singlethread)
                res = fuse_loop(fuse);
        else
@@ -412,7 +413,7 @@ TODO: This patch should *really* be gone
        else
                res = 0;
  
-+#if FUSE_MAJOR_VERSION >= 3
++#if !defined(__NetBSD__) || FUSE_H_ >= 20211204
        fuse_remove_signal_handlers(se);
 +#endif
        fuse_unmount(fuse);



Home | Main Index | Thread Index | Old Index