Compare commits

...

15 Commits

Author SHA1 Message Date
Nikolaus Rath b5d1484314 Released 3.5.0 2018-08-28 14:58:39 +01:00
Bill Zissimopoulos d0c5fa3ed6 Add AppVeyor CI for Cygwin 2018-08-11 10:33:42 +01:00
Bill Zissimopoulos eac420791c Port SSHFS to Cygwin 2018-08-01 14:39:23 +01:00
Quentin Rameau 6480b66bd6 Fix error return value from rename()
Fuse operations expect negated errno values.
2018-07-25 11:03:01 +01:00
Nikolaus Rath 30a2668b99 Released 3.4.0 2018-06-29 09:34:57 +01:00
Samuel Murray 4ed15c4c04 Update README.rst
OS-X is now called macOS
2018-06-28 20:08:50 +01:00
Rian Hunter fc7a57f0dc Correct workaround condition for not using handle in sshfs_getattr (#127)
In libfuse<3, when `fstat_workaround` was true, that meant to always
use the `path` argument to resolve fgetattr instead of the supplied
handle.  Before this change, the logic was interpreting
`fstat_workaround` to not use the `path` argument when it was
true. This change reverts to the libfuse<3 behavior.
2018-06-20 20:31:53 +01:00
Daniel Lublin f0452119e0 Make utimens(NULL) work correctly 2018-06-18 19:12:38 +01:00
Josh Triplett fb174704dd Add workaround to always pass a 0 mode when creating a file (#128)
Add workaround to always pass a 0 mode when creating a file

This works around servers that produce an error for any non-zero mode.
2018-06-09 11:28:55 +01:00
Nikolaus Rath 39663c8288 Released 3.3.2 2018-04-29 18:06:03 +01:00
Nikolaus Rath 646a3c417b Fix Travis build environment.
Newest Meson requires Python 3.5.which isn't available in Trusty.
Pip version pin no longer necessary.
2018-03-31 13:26:15 +01:00
G.raud Meyer 303126bad9 New workaround renamexdev to enable moving files across remote filesystems
sshfs.rst: update the documentation.
2018-03-28 19:48:02 +01:00
Nikolaus Rath f0a0cc2b7e Fix rst markup 2017-11-27 19:55:09 +00:00
Brandon Carter 2c7c667576 change make directory command in readme 2017-11-17 18:17:41 +00:00
Nikolaus Rath 1846b685c4 Updated professional support information. 2017-11-13 20:09:54 +00:00
11 changed files with 152 additions and 14 deletions
+19
View File
@@ -0,0 +1,19 @@
version: '{build}'
install:
# install WinFsp
- appveyor DownloadFile https://github.com/billziss-gh/winfsp/releases/download/v1.4B2/winfsp-1.4.18211.msi
- for %%f in ("winfsp-*.msi") do start /wait msiexec /i %%f /qn INSTALLLEVEL=1000
# install FUSE for Cygwin (64-bit and 32-bit)
- C:\cygwin64\bin\env.exe -i PATH=/bin bash "%ProgramFiles(x86)%\WinFsp\opt\cygfuse\install.sh"
- C:\cygwin\bin\env.exe -i PATH=/bin bash "%ProgramFiles(x86)%\WinFsp\opt\cygfuse\install.sh"
# install additional Cygwin packages (64-bit and 32-bit)
- C:\cygwin64\setup-x86_64.exe -qnNdO -R C:\cygwin64 -s http://cygwin.mirror.constant.com -l C:\cygwin64\var\cache\setup -P libglib2.0-devel -P meson
- C:\cygwin\setup-x86.exe -qnNdO -R C:\cygwin -s http://cygwin.mirror.constant.com -l C:\cygwin\var\cache\setup -P libglib2.0-devel -P meson
build_script:
- C:\cygwin64\bin\env.exe -i PATH=/bin bash test\appveyor-build.sh
- C:\cygwin\bin\env.exe -i PATH=/bin bash test\appveyor-build.sh
-2
View File
@@ -14,8 +14,6 @@ addons:
- gcc-6
- python-docutils
- python3-pip
before_install:
- sudo -H python3 -m pip install pip==8.1.1
install: test/travis-install.sh
script: test/travis-build.sh
+7
View File
@@ -19,11 +19,15 @@ Anatol Pomozov <anatol.pomozov@gmail.com>
Benjamin Fleischer <fleiben@gmail.com>
Berserker <berserker.troll@yandex.com>
Bill Zissimopoulos <billziss@navimatics.com>
Brandon Carter <b-carter@users.noreply.github.com>
Chris Wolfe <cwolfe@chromium.org>
Daniel Lublin <daniel@lublin.se>
gala <gala132@users.noreply.github.com>
George Vlahavas <vlahavas@gmail.com>
G.raud Meyer <graud@gmx.com>
harrim4n <git@harrim4n.com>
Jakub Jelen <jjelen@redhat.com>
Josh Triplett <josh@joshtriplett.org>
Julio Merino <jmmv@google.com>
Julio Merino <jmmv@meroh.net>
Mike Kelly <mike@pair.com>
@@ -32,8 +36,11 @@ Miklos Szeredi <mszeredi@suse.cz>
Nikolaus Rath <Nikolaus@rath.org>
Percy Jahn <email@percyjahn.de>
Qais Patankar <qaisjp@gmail.com>
Quentin Rameau <quinq@fifth.space>
Reid Wagner <wagnerreid@gmail.com>
Rian Hunter <rian@alum.mit.edu>
Rian Hunter <rianhunter@users.noreply.github.com>
Samuel Murray <samuel.murray@outlook.com>
Timo Savola <timo.savola@iki.fi>
tpoindessous <thomas@poindessous.com>
Zoltan Kuscsik <zoltan.kuscsik@linaro.org>
+19
View File
@@ -1,3 +1,22 @@
Release 3.5.0 (2018-08-28)
--------------------------
* Fixed error code returned by rename(), allowing proper fallback.
* Port to Cygwin.
Release 3.4.0 (2018-06-29)
--------------------------
* Make utimens(NULL) result in timestamp "now" -- no more touched files
dated 1970-01-01
* New `createmode` workaround.
* Fix `fstat` workaround regression.
Release 3.3.2 (2018-04-29)
--------------------------
* New `renamexdev` workaround.
Release 3.3.1 (2017-10-25)
--------------------------
+7 -5
View File
@@ -32,7 +32,7 @@ To unmount the filesystem::
fusermount -u mountpoint
On BSD and OS-X, to unmount the filesystem::
On BSD and macOS, to unmount the filesystem::
umount mountpoint
@@ -42,7 +42,7 @@ Installation
First, download the latest SSHFS release from
https://github.com/libfuse/sshfs/releases. On Linux and BSD, you will
also need to install libfuse_ 3.1.0 or newer. On OS-X, you need
also need to install libfuse_ 3.1.0 or newer. On macOS, you need
OSXFUSE_ instead. Finally, you need the Glib_ library with development
headers (which should be available from your operating system's
package manager).
@@ -51,7 +51,7 @@ To build and install, we recommend to use Meson_ (version 0.38 or
newer) and Ninja_. After extracting the sshfs tarball, create a
(temporary) build directory and run Meson::
$ md build; cd build
$ mkdir build; cd build
$ meson ..
Normally, the default build options will work fine. If you
@@ -85,8 +85,10 @@ https://lists.sourceforge.net/lists/listinfo/fuse-sshfs).
Please report any bugs on the GitHub issue tracker at
https://github.com/libfuse/libfuse/issues.
Professional Support
--------------------
Professional support is available. Please contact Nikolaus Rath
<Nikolaus@rath.org> for details.
Professional support is offered via `Rath Consulting`_.
.. _`Rath Consulting`: http://www.rath-consulting.biz
+1 -1
View File
@@ -1,4 +1,4 @@
project('sshfs', 'c', version: '3.3.1',
project('sshfs', 'c', version: '3.5.0',
meson_version: '>= 0.38',
default_options: [ 'buildtype=debugoptimized' ])
+62 -5
View File
@@ -12,7 +12,7 @@
#include <fuse.h>
#include <fuse_opt.h>
#if !defined(__CYGWIN__)
#include <fuse_lowlevel.h>
# include <fuse_lowlevel.h>
#endif
#ifdef __APPLE__
# include <fuse_darwin.h>
@@ -214,10 +214,12 @@ struct sshfs {
struct fuse_args ssh_args;
char *workarounds;
int rename_workaround;
int renamexdev_workaround;
int truncate_workaround;
int buflimit_workaround;
int unrel_append;
int fstat_workaround;
int createmode_workaround;
int transform_symlinks;
int follow_symlinks;
int no_check_root;
@@ -446,12 +448,16 @@ static struct fuse_opt workaround_opts[] = {
SSHFS_OPT("none", fstat_workaround, 0),
SSHFS_OPT("rename", rename_workaround, 1),
SSHFS_OPT("norename", rename_workaround, 0),
SSHFS_OPT("renamexdev", renamexdev_workaround, 1),
SSHFS_OPT("norenamexdev", renamexdev_workaround, 0),
SSHFS_OPT("truncate", truncate_workaround, 1),
SSHFS_OPT("notruncate", truncate_workaround, 0),
SSHFS_OPT("buflimit", buflimit_workaround, 1),
SSHFS_OPT("nobuflimit", buflimit_workaround, 0),
SSHFS_OPT("fstat", fstat_workaround, 1),
SSHFS_OPT("nofstat", fstat_workaround, 0),
SSHFS_OPT("createmode", createmode_workaround, 1),
SSHFS_OPT("nocreatemode", createmode_workaround, 0),
FUSE_OPT_END
};
@@ -2310,7 +2316,7 @@ static int sshfs_rename(const char *from, const char *to, unsigned int flags)
int err;
if(flags != 0)
return EINVAL;
return -EINVAL;
if (sshfs.ext_posix_rename)
err = sshfs_ext_posix_rename(from, to);
@@ -2333,6 +2339,8 @@ static int sshfs_rename(const char *from, const char *to, unsigned int flags)
}
}
}
if (err == -EPERM && sshfs.renamexdev_workaround)
err = -EXDEV;
return err;
}
@@ -2465,6 +2473,14 @@ static int sshfs_utimens(const char *path, const struct timespec tv[2],
int err;
struct buffer buf;
struct sshfs_file *sf = NULL;
time_t asec = tv[0].tv_sec, msec = tv[1].tv_sec;
struct timeval now;
gettimeofday(&now, NULL);
if (asec == 0)
asec = now.tv_sec;
if (msec == 0)
msec = now.tv_sec;
if (fi != NULL) {
sf = get_sshfs_file(fi);
@@ -2478,8 +2494,8 @@ static int sshfs_utimens(const char *path, const struct timespec tv[2],
else
buf_add_buf(&buf, &sf->handle);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_ACMODTIME);
buf_add_uint32(&buf, tv[0].tv_sec);
buf_add_uint32(&buf, tv[1].tv_sec);
buf_add_uint32(&buf, asec);
buf_add_uint32(&buf, msec);
err = sftp_request(sf == NULL ? SSH_FXP_SETSTAT : SSH_FXP_FSETSTAT,
&buf, SSH_FXP_STATUS, NULL);
@@ -3095,6 +3111,9 @@ static int sshfs_statfs(const char *path, struct statvfs *buf)
static int sshfs_create(const char *path, mode_t mode,
struct fuse_file_info *fi)
{
if (sshfs.createmode_workaround)
mode = 0;
return sshfs_open_common(path, mode, fi);
}
@@ -3139,7 +3158,7 @@ static int sshfs_getattr(const char *path, struct stat *stbuf,
struct buffer outbuf;
struct sshfs_file *sf = NULL;
if (fi != NULL || sshfs.fstat_workaround) {
if (fi != NULL && !sshfs.fstat_workaround) {
sf = get_sshfs_file(fi);
if (!sshfs_file_is_conn(sf))
return -EIO;
@@ -3365,9 +3384,11 @@ static void usage(const char *progname)
" -o workaround=LIST colon separated list of workarounds\n"
" none no workarounds enabled\n"
" [no]rename fix renaming to existing file (default: off)\n"
" [no]renamexdev fix moving across filesystems (default: off)\n"
" [no]truncate fix truncate for old servers (default: off)\n"
" [no]buflimit fix buffer fillup bug in server (default: on)\n"
" [no]fstat always use stat() instead of fstat() (default: off)\n"
" [no]createmode always pass mode 0 to create (default: off)\n"
" -o idmap=TYPE user/group ID mapping (default: " IDMAP_DEFAULT ")\n"
" none no translation of the ID space\n"
" user only translate UID/GID of connecting user\n"
@@ -3431,7 +3452,39 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
return 0;
}
else if (!sshfs.mountpoint) {
#if defined(__CYGWIN__)
/*
* On FUSE for Cygwin the mountpoint may be a drive or directory.
* Furthermore the mountpoint must NOT exist prior to mounting.
* So we cannot use realpath(3).
*/
if ((('A' <= arg[0] && arg[0] <= 'Z') || ('a' <= arg[0] && arg[0] <= 'z'))
&& ':' == arg[1] && '\0' == arg[2]) {
/* drive: make a copy */
sshfs.mountpoint = strdup(arg);
} else {
/* path: split into dirname, basename and check dirname */
char *dir;
const char *base;
const char *slash = strrchr(arg, '/');
if (slash) {
char *tmp = strndup(arg, slash == arg ? 1 : slash - arg);
dir = tmp ? realpath(tmp, NULL) : 0;
base = slash + 1;
free(tmp);
} else {
dir = realpath(".", NULL);
base = arg;
}
if (dir) {
slash = '/' == dir[0] && '\0' == dir[1] ? "" : "/";
asprintf(&sshfs.mountpoint, "%s%s%s", dir, slash, base);
free(dir);
}
}
#else
sshfs.mountpoint = realpath(arg, NULL);
#endif
if (!sshfs.mountpoint) {
fprintf(stderr, "sshfs: bad mount point `%s': %s\n",
arg, strerror(errno));
@@ -3851,8 +3904,10 @@ int main(int argc, char *argv[])
#else
sshfs.rename_workaround = 0;
#endif
sshfs.renamexdev_workaround = 0;
sshfs.truncate_workaround = 0;
sshfs.buflimit_workaround = 1;
sshfs.createmode_workaround = 0;
sshfs.ssh_ver = 2;
sshfs.progname = argv[0];
sshfs.rfd = -1;
@@ -3889,7 +3944,9 @@ int main(int argc, char *argv[])
if (sshfs.show_version) {
printf("SSHFS version %s\n", PACKAGE_VERSION);
printf("FUSE library version %s\n", fuse_pkgversion());
#if !defined(__CYGWIN__)
fuse_lowlevel_version();
#endif
exit(0);
}
+15
View File
@@ -107,12 +107,16 @@ Options
:rename: Emulate overwriting an existing file by deleting and
renaming.
:renamexdev: Make rename fail with EXDEV instead of the default EPERM
to allow moving files across remote filesystems.
:truncate: Work around servers that don't support truncate by
coping the whole file, truncating it locally, and sending it
back.
:fstat: Work around broken servers that don't support *fstat()* by
using *stat* instead.
:buflimit: Work around OpenSSH "buffer fillup" bug.
:createmode: Work around broken servers that produce an error when passing a
non-zero mode to create, by always passing a mode of 0.
-o idmap=TYPE
How to map remote UID/GIDs to local values. Possible values are:
@@ -228,6 +232,17 @@ removed it, but before SSHFS had the time to rename the old file. In
this case, the rename will still fail.
Permission denied when moving files across remote filesystems
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Most SFTP servers return only a generic "failure" when failing to rename
across filesystem boundaries (EXDEV). sshfs normally converts this generic
failure to a permission denied error (EPERM). If the option ``-o
workaround=renamexdev`` is given, generic failures will be considered EXDEV
errors which will make programs like `mv(1)` attempt to actually move the
file after the failed rename.
SSHFS hangs
~~~~~~~~~~~
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
machine=$(uname -m)
mkdir build-$machine
cd build-$machine
meson ..
ninja
+13
View File
@@ -102,6 +102,7 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, capfd):
# SSHFS only supports one second resolution when setting
# file timestamps.
tst_utimens(mnt_dir, tol=1)
tst_utimens_now(mnt_dir)
tst_link(mnt_dir, cache_timeout)
tst_truncate_path(mnt_dir)
@@ -403,6 +404,18 @@ def tst_utimens(mnt_dir, tol=0):
assert abs(fstat.st_atime_ns - atime_ns) < tol*1e9
assert abs(fstat.st_mtime_ns - mtime_ns) < tol*1e9
def tst_utimens_now(mnt_dir):
fullname = pjoin(mnt_dir, name_generator())
fd = os.open(fullname, os.O_CREAT | os.O_RDWR)
os.close(fd)
os.utime(fullname, None)
fstat = os.lstat(fullname)
# We should get now-timestamps
assert fstat.st_atime != 0
assert fstat.st_mtime != 0
def tst_passthrough(src_dir, mnt_dir, cache_timeout):
name = name_generator()
src_name = pjoin(src_dir, name)
+2 -1
View File
@@ -2,7 +2,8 @@
set -e
sudo python3 -m pip install pytest meson
# Meson 0.45 requires Python 3.5 or newer
sudo python3 -m pip install pytest meson==0.44
wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip
unzip ninja-linux.zip
chmod 755 ninja