On Thu, Aug 21, 2008 at 09:45:02AM +0200, Marc 'HE' Brockschmidt wrote:
> Sebastien Delafond <[EMAIL PROTECTED]> writes:
> > The changelog for 2.1[1] lists the following changes:
> [...]
> 
> Generally OK, but please send the full diff between the current version
> and the version you intend to upload (for example, I have no idea how
> invasive the build fixes for totally unrelated OS are)

attached is the debdiff for what would be 2.1-1.1.

A close review did not reveal anything worrisome, at least to me. Just
what the changelog from 2.0 to 2.1 mentions.

Cheers,

--Seb
diff -Nru sshfs-fuse-2.0/cache.c sshfs-fuse-2.1/cache.c
--- sshfs-fuse-2.0/cache.c      2007-12-11 14:23:24.000000000 -0800
+++ sshfs-fuse-2.1/cache.c      2008-07-11 04:00:33.000000000 -0700
@@ -28,6 +28,7 @@
        GHashTable *table;
        pthread_mutex_t lock;
        time_t last_cleaned;
+       uint64_t write_ctr;
 };
 
 static struct cache cache;
@@ -47,6 +48,7 @@
        fuse_dirh_t h;
        fuse_dirfil_t filler;
        GPtrArray *dir;
+       uint64_t wrctr;
 };
 
 static void free_node(gpointer node_)
@@ -108,6 +110,14 @@
        pthread_mutex_unlock(&cache.lock);
 }
 
+void cache_invalidate_write(const char *path)
+{
+       pthread_mutex_lock(&cache.lock);
+       cache_purge(path);
+       cache.write_ctr++;
+       pthread_mutex_unlock(&cache.lock);
+}
+
 static void cache_invalidate_dir(const char *path)
 {
        pthread_mutex_lock(&cache.lock);
@@ -148,19 +158,21 @@
        return node;
 }
 
-void cache_add_attr(const char *path, const struct stat *stbuf)
+void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
 {
        struct node *node;
        time_t now;
 
        pthread_mutex_lock(&cache.lock);
-       node = cache_get(path);
-       now = time(NULL);
-       node->stat = *stbuf;
-       node->stat_valid = time(NULL) + cache.stat_timeout;
-       if (node->stat_valid > node->valid)
-               node->valid = node->stat_valid;
-       cache_clean();
+       if (wrctr == cache.write_ctr) {
+               node = cache_get(path);
+               now = time(NULL);
+               node->stat = *stbuf;
+               node->stat_valid = time(NULL) + cache.stat_timeout;
+               if (node->stat_valid > node->valid)
+                       node->valid = node->stat_valid;
+               cache_clean();
+       }
        pthread_mutex_unlock(&cache.lock);
 }
 
@@ -222,13 +234,25 @@
        return err;
 }
 
+uint64_t cache_get_write_ctr(void)
+{
+       uint64_t res;
+
+       pthread_mutex_lock(&cache.lock);
+       res = cache.write_ctr;
+       pthread_mutex_unlock(&cache.lock);
+
+       return res;
+}
+
 static int cache_getattr(const char *path, struct stat *stbuf)
 {
        int err = cache_get_attr(path, stbuf);
        if (err) {
+               uint64_t wrctr = cache_get_write_ctr();
                err = cache.next_oper->oper.getattr(path, stbuf);
                if (!err)
-                       cache_add_attr(path, stbuf);
+                       cache_add_attr(path, stbuf, wrctr);
        }
        return err;
 }
@@ -268,7 +292,7 @@
                        const char *basepath = !ch->path[1] ? "" : ch->path;
 
                        fullpath = g_strdup_printf("%s/%s", basepath, name);
-                       cache_add_attr(fullpath, stbuf);
+                       cache_add_attr(fullpath, stbuf, ch->wrctr);
                        g_free(fullpath);
                }
        }
@@ -299,6 +323,7 @@
        ch.h = h;
        ch.filler = filler;
        ch.dir = g_ptr_array_new();
+       ch.wrctr = cache_get_write_ctr();
        err = cache.next_oper->cache_getdir(path, &ch, cache_dirfill);
        g_ptr_array_add(ch.dir, NULL);
        dir = (char **) ch.dir->pdata;
@@ -421,7 +446,7 @@
 {
        int res = cache.next_oper->oper.write(path, buf, size, offset, fi);
        if (res >= 0)
-               cache_invalidate(path);
+               cache_invalidate_write(path);
        return res;
 }
 
@@ -449,9 +474,10 @@
 {
        int err = cache_get_attr(path, stbuf);
        if (err) {
+               uint64_t wrctr = cache_get_write_ctr();
                err = cache.next_oper->oper.fgetattr(path, stbuf, fi);
                if (!err)
-                       cache_add_attr(path, stbuf);
+                       cache_add_attr(path, stbuf, wrctr);
        }
        return err;
 }
diff -Nru sshfs-fuse-2.0/cache.h sshfs-fuse-2.1/cache.h
--- sshfs-fuse-2.0/cache.h      2006-02-20 03:43:23.000000000 -0800
+++ sshfs-fuse-2.1/cache.h      2008-07-11 04:00:33.000000000 -0700
@@ -24,5 +24,6 @@
 
 struct fuse_operations *cache_init(struct fuse_cache_operations *oper);
 int cache_parse_options(struct fuse_args *args);
-void cache_add_attr(const char *path, const struct stat *stbuf);
+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);
diff -Nru sshfs-fuse-2.0/ChangeLog sshfs-fuse-2.1/ChangeLog
--- sshfs-fuse-2.0/ChangeLog    2008-04-23 05:07:58.000000000 -0700
+++ sshfs-fuse-2.1/ChangeLog    2008-07-11 04:00:33.000000000 -0700
@@ -1,3 +1,31 @@
+2008-07-11  Miklos Szeredi <[EMAIL PROTECTED]>
+
+       * Released 2.1
+
+2008-07-11  Miklos Szeredi <[EMAIL PROTECTED]>
+
+       * Fix statvfs extension to match the current protocol in
+       opensshfs
+
+       * Check version numbers of extensions, so such changes wouldn't
+       cause stupid behavior
+
+2008-06-24  Miklos Szeredi <[EMAIL PROTECTED]>
+
+       * Add '-F' option to specify the ssh config file.  Patch by Pat
+       Pascal.
+
+2008-05-06  Miklos Szeredi <[EMAIL PROTECTED]>
+
+       * Fix bug in caching which could cause file corruption for append
+       mode writes.  Reported by Jose Alonso
+
+2008-05-05  Miklos Szeredi <[EMAIL PROTECTED]>
+
+       * Fix compile on OS X.  Original patch from Michael G Schwern
+
+       * Fix compile on Solaris.  Reported by Jean-Jacques Sarton
+
 2008-04-23  Miklos Szeredi <[EMAIL PROTECTED]>
 
        * Released 2.0
diff -Nru sshfs-fuse-2.0/configure sshfs-fuse-2.1/configure
--- sshfs-fuse-2.0/configure    2008-04-22 09:05:27.000000000 -0700
+++ sshfs-fuse-2.1/configure    2008-07-11 04:04:07.000000000 -0700
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for sshfs-fuse 2.0.
+# Generated by GNU Autoconf 2.61 for sshfs-fuse 2.1.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@
 # Identity of this package.
 PACKAGE_NAME='sshfs-fuse'
 PACKAGE_TARNAME='sshfs-fuse'
-PACKAGE_VERSION='2.0'
-PACKAGE_STRING='sshfs-fuse 2.0'
+PACKAGE_VERSION='2.1'
+PACKAGE_STRING='sshfs-fuse 2.1'
 PACKAGE_BUGREPORT=''
 
 ac_subst_vars='SHELL
@@ -1174,7 +1174,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures sshfs-fuse 2.0 to adapt to many kinds of systems.
+\`configure' configures sshfs-fuse 2.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1240,7 +1240,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sshfs-fuse 2.0:";;
+     short | recursive ) echo "Configuration of sshfs-fuse 2.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1327,7 +1327,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sshfs-fuse configure 2.0
+sshfs-fuse configure 2.1
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1341,7 +1341,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by sshfs-fuse $as_me 2.0, which was
+It was created by sshfs-fuse $as_me 2.1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2011,7 +2011,7 @@
 
 # Define the identity of the package.
  PACKAGE='sshfs-fuse'
- VERSION='2.0'
+ VERSION='2.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4274,7 +4274,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by sshfs-fuse $as_me 2.0, which was
+This file was extended by sshfs-fuse $as_me 2.1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4327,7 +4327,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-sshfs-fuse config.status 2.0
+sshfs-fuse config.status 2.1
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -Nru sshfs-fuse-2.0/configure.ac sshfs-fuse-2.1/configure.ac
--- sshfs-fuse-2.0/configure.ac 2008-04-22 09:02:41.000000000 -0700
+++ sshfs-fuse-2.1/configure.ac 2008-07-11 04:00:33.000000000 -0700
@@ -1,4 +1,4 @@
-AC_INIT(sshfs-fuse, 2.0)
+AC_INIT(sshfs-fuse, 2.1)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
 
diff -Nru sshfs-fuse-2.0/debian/changelog sshfs-fuse-2.1/debian/changelog
--- sshfs-fuse-2.0/debian/changelog     2008-08-21 09:42:01.000000000 -0700
+++ sshfs-fuse-2.1/debian/changelog     2008-08-21 09:42:01.000000000 -0700
@@ -1,3 +1,10 @@
+sshfs-fuse (2.1-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * New upstream release (Closes: #494140).
+
+ -- Sebastien Delafond <[EMAIL PROTECTED]>  Thu, 21 Aug 2008 09:38:59 -0700
+
 sshfs-fuse (2.0-2) unstable; urgency=low
 
   * Depends only on ssh client. (Closes: #477731)
diff -Nru sshfs-fuse-2.0/sshfs.1 sshfs-fuse-2.1/sshfs.1
--- sshfs-fuse-2.0/sshfs.1      2008-08-21 09:42:01.000000000 -0700
+++ sshfs-fuse-2.1/sshfs.1      2008-07-11 04:00:33.000000000 -0700
@@ -37,6 +37,9 @@
 \fB\-C\fR
 equivalent to '\-o compression=yes'
 .TP
+\fB\-F\fR ssh_configfile
+specifies alternative ssh configuration file
+.TP
 \fB\-1\fR
 equivalent to '\-o ssh_protocol=1'
 .TP
@@ -240,3 +243,4 @@
 This man page was written by Bartosz Fenski <[EMAIL PROTECTED]> for the
 Debian GNU/Linux distribution (but it may be used by others).
 
+
diff -Nru sshfs-fuse-2.0/sshfs.c sshfs-fuse-2.1/sshfs.c
--- sshfs-fuse-2.0/sshfs.c      2008-04-22 09:02:42.000000000 -0700
+++ sshfs-fuse-2.1/sshfs.c      2008-07-11 04:00:33.000000000 -0700
@@ -24,6 +24,7 @@
 #include <netdb.h>
 #include <signal.h>
 #include <sys/uio.h>
+#include <sys/types.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
@@ -36,6 +37,15 @@
 
 #include "cache.h"
 
+#ifndef MAP_LOCKED
+#define MAP_LOCKED 0
+#endif
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+
 #if FUSE_VERSION >= 23
 #define SSHFS_USE_INIT
 #endif
@@ -278,6 +288,7 @@
        KEY_HELP,
        KEY_VERSION,
        KEY_FOREGROUND,
+       KEY_CONFIGFILE,
 };
 
 #define SSHFS_OPT(t, p, v) { t, offsetof(struct sshfs, p), v }
@@ -311,6 +322,7 @@
        FUSE_OPT_KEY("debug",          KEY_FOREGROUND),
        FUSE_OPT_KEY("-d",             KEY_FOREGROUND),
        FUSE_OPT_KEY("-f",             KEY_FOREGROUND),
+       FUSE_OPT_KEY("-F ",            KEY_CONFIGFILE),
        FUSE_OPT_END
 };
 
@@ -650,29 +662,29 @@
 
 static int buf_get_statvfs(struct buffer *buf, struct statvfs *stbuf)
 {
-       uint32_t bsize;
-       uint32_t frsize;
+       uint64_t bsize;
+       uint64_t frsize;
        uint64_t blocks;
        uint64_t bfree;
        uint64_t bavail;
        uint64_t files;
        uint64_t ffree;
        uint64_t favail;
-       uint32_t fsid;
-       uint32_t flag;
-       uint32_t namemax;
+       uint64_t fsid;
+       uint64_t flag;
+       uint64_t namemax;
 
-       if (buf_get_uint32(buf, &bsize) == -1 ||
-           buf_get_uint32(buf, &frsize) == -1 ||
+       if (buf_get_uint64(buf, &bsize) == -1 ||
+           buf_get_uint64(buf, &frsize) == -1 ||
            buf_get_uint64(buf, &blocks) == -1 ||
            buf_get_uint64(buf, &bfree) == -1 ||
            buf_get_uint64(buf, &bavail) == -1 ||
            buf_get_uint64(buf, &files) == -1 ||
            buf_get_uint64(buf, &ffree) == -1 ||
            buf_get_uint64(buf, &favail) == -1 ||
-           buf_get_uint32(buf, &fsid) == -1 ||
-           buf_get_uint32(buf, &flag) == -1 ||
-           buf_get_uint32(buf, &namemax) == -1) {
+           buf_get_uint64(buf, &fsid) == -1 ||
+           buf_get_uint64(buf, &flag) == -1 ||
+           buf_get_uint64(buf, &namemax) == -1) {
                return -1;
        }
 
@@ -1338,11 +1350,13 @@
 
                        DEBUG("Extension: %s <%s>\n", ext, extdata);
 
-                       if (strcmp(ext, SFTP_EXT_POSIX_RENAME) == 0) {
+                       if (strcmp(ext, SFTP_EXT_POSIX_RENAME) == 0 &&
+                           strcmp(extdata, "1") == 0) {
                                sshfs.ext_posix_rename = 1;
                                sshfs.rename_workaround = 0;
                        }
-                       if (strcmp(ext, SFTP_EXT_STATVFS) == 0)
+                       if (strcmp(ext, SFTP_EXT_STATVFS) == 0 &&
+                           strcmp(extdata, "2") == 0)
                                sshfs.ext_statvfs = 1;
                } while (buf2.len < buf2.size);
        }
@@ -2116,6 +2130,7 @@
        uint32_t pflags = 0;
        struct iovec iov;
        uint8_t type;
+       uint64_t wrctr = cache_get_write_ctr();
 
        if ((fi->flags & O_ACCMODE) == O_RDONLY)
                pflags = SSH_FXF_READ;
@@ -2171,7 +2186,7 @@
        }
 
        if (!err) {
-               cache_add_attr(path, &stbuf);
+               cache_add_attr(path, &stbuf, wrctr);
                buf_finish(&sf->handle);
                fi->fh = (unsigned long) sf;
        } else {
@@ -2823,6 +2838,7 @@
 "SSHFS options:\n"
 "    -p PORT                equivalent to '-o port=PORT'\n"
 "    -C                     equivalent to '-o compression=yes'\n"
+"    -F ssh_configfile      specifies alternative ssh configuration file\n"
 "    -1                     equivalent to '-o ssh_protocol=1'\n"
 "    -o reconnect           reconnect to server\n"
 "    -o sshfs_sync          synchronous writes\n"
@@ -2913,6 +2929,12 @@
                ssh_add_arg("-oCompression=yes");
                return 0;
 
+       case KEY_CONFIGFILE:
+               tmp = g_strdup_printf("-F%s", arg + 2);
+               ssh_add_arg(tmp);
+               g_free(tmp);
+               return 0;
+
        case KEY_HELP:
                usage(outargs->argv[0]);
                fuse_opt_add_arg(outargs, "-ho");

Attachment: signature.asc
Description: Digital signature

Reply via email to