Compare commits

..

20 Commits

Author SHA1 Message Date
Nikolaus Rath c91eb9a9a9 Released 3.7.3 2022-05-26 14:23:35 +01:00
Peter Wienemann 103c6ba68b Fix typo: occured -> occurred (#280) 2022-03-07 19:41:43 +00:00
Matthew Berginski a2054a2b73 Typo Fix (#274) 2021-12-27 11:27:40 +00:00
Kim Brose fd02499b4c add missing backtick (#270) 2021-10-30 13:04:15 +01:00
Antonio Rojas c2715f7453 Fix typo in ssh_opts (#269)
Add a missing comma that prevents using the PubkeyAcceptedKeyTypes option
2021-10-06 08:19:22 +01:00
Nikolaus Rath 1abde6e779 Clarify the need for libfuse3. 2021-09-24 13:36:56 +01:00
Cam Cope a181b9b60b add .git-blame-ignore-revs (#261) 2021-08-30 18:08:07 +01:00
Cam Cope d54c7ecbd6 Fixup whitespace and configure CI to keep it that way 2021-08-30 15:35:33 +01:00
a1346054 803e0e65cf Fix script issues identified through shellcheck (#258)
* Fix spelling

* Fix shellcheck-identified warnings in shell scripts
2021-08-25 14:45:42 +02:00
Nikolaus Rath 9700b35370 Released 3.7.2 2021-06-08 09:52:08 +01:00
Andrew Stone 6c1b92df81 Fix deadlock in conn cleanup (#244)
Calling through to request_free() from clean_req() causes deadlock since
sshfs.lock is already held by the caller of clean_req().
2021-02-25 12:13:30 +00:00
Nikolaus Rath d18869a307 Update to newer CI environment.
The current one causes build failures since recent pytest versions are incompatble with
Python 3.5.
2021-01-19 10:17:10 +00:00
Peter Belm dfd4cba385 Workaround for mkdir on existing directory (#242)
Added a secondary check so if a mkdir request fails with EPERM an access request will be tried - returning EEXIST if the access was successful. This matches the correct behaviour expected by applications such as git.

Co-authored-by: Peter Belm <peter.belm@dataalchemist.co.uk>
2021-01-19 10:13:09 +00:00
Nikolaus Rath 8059e2ce63 Released 3.7.1 2020-11-09 09:52:00 +00:00
Junichi Uekawa 9e01ffd161 Rename option to 'passive' and add some example in manual. (#232) 2020-11-02 10:51:48 +00:00
Fabrice Fontaine de0504e45b sshfs.c: fix build with gcc 4.8 (#233)
Fix the following build failure with gcc 4.8:

../sshfs.c:1092:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < sshfs.max_conns; i++) {
  ^

This build failure has been added with
https://github.com/libfuse/sshfs/commit/8822b60d9dbd9907065e7999f616b11ddce6d584

Fixes:
 - http://autobuild.buildroot.org/results/2dbdc579c55543175716d5f739cabe2ad0864ed6

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-11-02 09:31:23 +00:00
Junichi Uekawa 6625146af9 Update sshfs.rst (#220)
This / is probably meant to be a .
2020-09-04 12:06:30 +01:00
Simon Arlott 76ffb37444 Unset OLDPWD environment variable (#227)
If ssh is configured to use "Match exec" and the previous working
directory is the mount point, then the shell (bash) hangs calling
stat() on OLDPWD.

Unset OLDPWD so that this doesn't happen.

Fixes #206.
2020-09-03 08:13:24 +01:00
Nikolaus Rath a96e521474 Remove pointer to professional consulting offers
I do not want to offer this actively anymore.
2020-08-10 19:57:05 +01:00
bjoe2k4 11df8874dc Fix typo in docs (#213) 2020-05-17 10:30:59 +01:00
20 changed files with 225 additions and 143 deletions
+1
View File
@@ -0,0 +1 @@
d54c7ecbd618afb4df524e0d96dec7fe7cc2935d
+1 -1
View File
@@ -11,7 +11,7 @@ PLEASE READ BEFORE REPORTING AN ISSUE
SSHFS does not have any active, regular contributors or developers. The current maintainer continues to apply pull requests and tries to make regular releases, but unfortunately has no capacity to do any development beyond addressing high-impact issues. When reporting bugs, please understand that unless you are including a pull request or are reporting a critical issue, you will probably not get a response.
To prevent the issue tracker from being flooded with issues that no-one is intending to work on, and to give more visibilty to critical issues that users should be aware of and that most urgently need attention, I will also close most bug reports once they've been inactive for a while.
To prevent the issue tracker from being flooded with issues that no-one is intending to work on, and to give more visibility to critical issues that users should be aware of and that most urgently need attention, I will also close most bug reports once they've been inactive for a while.
Please note that this isn't meant to imply that you haven't found a bug - you most likely have and I'm grateful that you took the time to report it. Unfortunately, SSHFS is a purely volunteer driven project,
and at the moment there simply aren't any volunteers.
+14
View File
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
hooks:
- id: shellcheck
+20 -10
View File
@@ -1,21 +1,31 @@
sudo: required
dist: xenial
dist: focal
language: c
cache:
- pip
language:
- c
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- shellcheck
- valgrind
- clang
- gcc
- gcc-6
- clang
- python-docutils
- python3-pip
- python3-setuptools
- ninja-build
install: test/travis-install.sh
script: test/travis-build.sh
- meson
- python3-pytest
- libglib2.0-dev
install: test/travis-install.sh
jobs:
include:
- name: Lint
script: ./test/lint.sh
install: skip
- name: Build + Test
script: test/travis-build.sh
+15 -1
View File
@@ -1,30 +1,37 @@
Current Maintainer
------------------
Nikolaus Rath <Nikolaus@rath.org>
None.
Past Maintainers
----------------
Nikolaus Rath <Nikolaus@rath.org> (until 05/2022)
Miklos Szeredi <miklos@szeredi.hu> (until 12/2015)
Contributors (autogenerated list)
---------------------------------
a1346054 <36859588+a1346054@users.noreply.github.com>
Alan Jenkins <alan.christopher.jenkins@gmail.com>
Alexander Neumann <alexander@bumpern.de>
Anatol Pomozov <anatol.pomozov@gmail.com>
Andrew Stone <a@stne.dev>
Antonio Rojas <arojas@archlinux.org>
Benjamin Fleischer <fleiben@gmail.com>
Berserker <berserker.troll@yandex.com>
Bill Zissimopoulos <billziss@navimatics.com>
bjoe2k4 <bjoe2k4@users.noreply.github.com>
Brandon Carter <b-carter@users.noreply.github.com>
Cam Cope <github@camcope.me>
Chris Wolfe <cwolfe@chromium.org>
Clayton G. Hobbs <clay@lakeserv.net>
Daniel Lublin <daniel@lublin.se>
Dominique Martinet <asmadeus@codewreck.org>
DrDaveD <2129743+DrDaveD@users.noreply.github.com>
Fabrice Fontaine <fontaine.fabrice@gmail.com>
gala <gala132@users.noreply.github.com>
Galen Getsov <4815620+ggetsov@users.noreply.github.com>
George Vlahavas <vlahavas@gmail.com>
@@ -35,7 +42,11 @@ jeg139 <54814784+jeg139@users.noreply.github.com>
Josh Triplett <josh@joshtriplett.org>
Julio Merino <jmmv@google.com>
Julio Merino <jmmv@meroh.net>
Junichi Uekawa <dancerj@gmail.com>
Junichi Uekawa <dancer@netfort.gr.jp>
kalvdans <github@kalvdans.no-ip.org>
Kim Brose <kim.brose@rwth-aachen.de>
Matthew Berginski <matthew.berginski@gmail.com>
Michael Forney <mforney@mforney.org>
Mike Kelly <mike@pair.com>
Mike Salvatore <mike.s.salvatore@gmail.com>
@@ -44,6 +55,8 @@ Miklos Szeredi <mszeredi@suse.cz>
mssalvatore <mike.s.salvatore@gmail.com>
Nikolaus Rath <Nikolaus@rath.org>
Percy Jahn <email@percyjahn.de>
Peter Belm <peterbelm@gmail.com>
Peter Wienemann <peter.wienemann@uni-bonn.de>
Qais Patankar <qaisjp@gmail.com>
Quentin Rameau <quinq@fifth.space>
Reid Wagner <wagnerreid@gmail.com>
@@ -51,6 +64,7 @@ Rian Hunter <rian@alum.mit.edu>
Rian Hunter <rianhunter@users.noreply.github.com>
Samuel Murray <samuel.murray@outlook.com>
S. D. Cloudt <s.d.cloudt@student.tue.nl>
Simon Arlott <70171+nomis@users.noreply.github.com>
smheidrich <smheidrich@weltenfunktion.de>
sunwire <50745572+sunwire@users.noreply.github.com>
Tim Harder <radhermit@gmail.com>
+36 -7
View File
@@ -1,3 +1,32 @@
Release 3.7.3 (2022-05-26)
--------------------------
* Minor bugfixes.
* This is the last release from the current maintainer. SSHFS is now no longer maintained
or developed. Github issue tracking and pull requests have therefore been disabled. The
mailing list (see below) is still available for use.
If you would like to take over this project, you are welcome to do so. Please fork it
and develop the fork for a while. Once there has been 6 months of reasonable activity,
please contact Nikolaus@rath.org and I'll be happy to give you ownership of this
repository or replace with a pointer to the fork.
Release 3.7.2 (2021-06-08)
--------------------------
* Added a secondary check so if a mkdir request fails with EPERM an access request will be
tried - returning EEXIST if the access was successful.
Fixes: https://github.com/libfuse/sshfs/issues/243
Release 3.7.1 (2020-11-09)
--------------------------
* Minor bugfixes.
Release 3.7.0 (2020-01-03)
--------------------------
@@ -11,7 +40,7 @@ Release 3.7.0 (2020-01-03)
needed anymore. If you depend on this workaround, please let the SSHFS maintainers know,
otherwise support for the workaround will be removed completely in a future version.
Release 3.6.0 (2019-11-03)
--------------------------
@@ -94,13 +123,13 @@ Release 3.1.0 (2017-08-04)
* For improved backwards compatibility, SSHFS now also silently
accepts the old ``-o cache_*`` options.
Release 3.0.0 (2017-07-08)
--------------------------
* sshfs now requires libfuse 3.1.0 or newer.
* When supported by the kernel, sshfs now uses writeback caching.
* The `cache` option has been renamed to `dir_cache` for clarity.
* The `cache` option has been renamed to `dir_cache` for clarity.
* Added unit tests
* --debug now behaves like -o debug_sshfs, i.e. it enables sshfs
debugging messages rather than libfuse debugging messages.
@@ -115,7 +144,7 @@ Release 3.0.0 (2017-07-08)
* Removed support for `-o workaround=all`. Workarounds should always
enabled explicitly and only when needed. There is no point in always
enabling a potentially changing set of workarounds.
Release 2.9 (2017-04-17)
------------------------
@@ -154,14 +183,14 @@ Release 2.4 (2012-03-08)
------------------------
* New `slave` option.
* New `idmap`, `uidmap` and `gidmap` options.
* New `idmap`, `uidmap` and `gidmap` options.
* Various small bugfixes.
Release 2.3 (2011-07-01)
------------------------
* Support hard link creation if server is OpenSSH 5.7 or later
* Small improvements and bug fixes
* Small improvements and bug fixes
* Check mount point and options before connecting to ssh server
* New 'delay_connect' option
@@ -174,7 +203,7 @@ Release 2.2 (2008-10-20)
Release 2.1 (2008-07-11)
------------------------
* Small improvements and bug fixes
* Small improvements and bug fixes
Release 2.0 (2008-04-23)
------------------------
+18 -16
View File
@@ -1,3 +1,15 @@
This Project is Orphaned
========================
This project is no longer maintained or developed. Github issue tracking and pull requests have
therefore been disabled. The mailing list (see below) is still available for use.
If you would like to take over this project, you are welcome to do so. Please fork it and
develop the fork for a while. Once there has been 6 months of reasonable activity, please
contact Nikolaus@rath.org and I'll be happy to give you ownership of this repository or
replace with a pointer to the fork.
SSHFS
=====
@@ -36,7 +48,7 @@ this to work the mountpoint must be owned by the user. If username is
omitted SSHFS will use the local username. If the directory is
omitted, SSHFS will mount the (remote) home directory. If you need to
enter a password sshfs will ask for it (actually it just runs ssh
which ask for the password if needed).
which asks for the password if needed).
Also many ssh options can be specified (see the manual pages for
*sftp(1)* and *ssh_config(5)*), including the remote port number
@@ -55,11 +67,10 @@ 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 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).
https://github.com/libfuse/sshfs/releases. You also need libfuse_ 3.1.0 or newer (or a
similar library that provides a libfuse3 compatible interface for your operating
system). Finally, you need the Glib_ library with development headers (which should be
available from your operating system's package manager).
To build and install, we recommend to use Meson_ (version 0.38 or
newer) and Ninja_. After extracting the sshfs tarball, create a
@@ -72,7 +83,7 @@ Normally, the default build options will work fine. If you
nevertheless want to adjust them, you can do so with the *mesonconf*
command::
$ mesonconf # list options
$ mesonconf # list options
$ mesonconf -D strip=true # set an option
To build, test and install SSHFS, you then use Ninja (running the
@@ -83,7 +94,6 @@ tests requires the `py.test`_ Python module)::
$ sudo ninja install
.. _libfuse: http://github.com/libfuse/libfuse
.. _OSXFUSE: https://osxfuse.github.io/
.. _Glib: https://developer.gnome.org/glib/stable/
.. _Meson: http://mesonbuild.com/
.. _Ninja: https://ninja-build.org/
@@ -98,11 +108,3 @@ 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 offered via `Rath Consulting`_.
.. _`Rath Consulting`: http://www.rath-consulting.biz
+6 -6
View File
@@ -256,7 +256,7 @@ static void *cache_init(struct fuse_conn_info *conn,
{
void *res;
res = cache.next_oper->init(conn, cfg);
// Cache requires a path for each request
cfg->nullpath_ok = 0;
@@ -318,9 +318,9 @@ static int cache_releasedir(const char *path, struct fuse_file_info *fi)
{
int err;
struct file_handle *cfi;
cfi = (struct file_handle*) fi->fh;
if(cfi->is_open) {
fi->fh = cfi->fs_fh;
err = cache.next_oper->releasedir(path, fi);
@@ -365,7 +365,7 @@ static int cache_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
struct node *node;
assert(offset == 0);
pthread_mutex_lock(&cache.lock);
node = cache_lookup(path);
if (node != NULL && node->dir != NULL) {
@@ -391,8 +391,8 @@ static int cache_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
}
cfi->is_open = 1;
cfi->fs_fh = fi->fh;
}
}
ch.path = path;
ch.buf = buf;
ch.filler = filler;
+1 -1
View File
@@ -18,7 +18,7 @@ extern "C" {
/**
* Option description
*
* This structure describes a single option, and and action associated
* This structure describes a single option, and an action associated
* with it, in case it matches.
*
* More than one such match may occur, in which case the action for
-1
View File
@@ -27,4 +27,3 @@ gpg --armor --detach-sign "${TAG}.tar.xz"
PREV_TAG="$(git tag --list 'sshfs-3*' --sort=-taggerdate --merged "${TAG}^"| head -1)"
echo "Contributors from ${PREV_TAG} to ${TAG}:"
git log --pretty="format:%an <%aE>" "${PREV_TAG}..${TAG}" | sort -u
+2 -3
View File
@@ -1,4 +1,4 @@
project('sshfs', 'c', version: '3.7.0',
project('sshfs', 'c', version: '3.7.3',
meson_version: '>= 0.40',
default_options: [ 'buildtype=debugoptimized' ])
@@ -26,7 +26,7 @@ endif
rst2man = find_program('rst2man', 'rst2man.py', required: false)
cfg = configuration_data()
cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
@@ -69,4 +69,3 @@ meson.add_install_script('utils/install_helper.sh',
subdir('test')
+65 -56
View File
@@ -141,7 +141,7 @@
/*
Handling of multiple SFTP connections
--------------------------------------
An SFTP server is free to return responses to outstanding requests in arbitrary
order. However, execution of requests may only be re-ordered and parallelized as long
as "the results in the responses will be the same as if [the client] had sent the
@@ -158,11 +158,11 @@
involved) wait for the other requests to complete. This means that e.g. a readdir
request would have to block on most other activity in the same directory, eliminating a
major advantage of using multiple connections.
In practice, we can luckily take advantage of the knowledge that most FUSE requests are
the result of (synchronous) syscalls from userspace that will block until the
corresponding FUSE response has been sent.
If -o sshfs_sync is used, SSHFS always waits for the SFTP server response before
returning a FUSE response to userspace. If userspace makes concurrent system calls,
there is no ordering guarantee in the first place, so we do not have to worry about
@@ -341,7 +341,7 @@ struct sshfs {
int foreground;
int reconnect;
int delay_connect;
int slave;
int passive;
char *host;
char *base_path;
GHashTable *reqtab;
@@ -351,7 +351,7 @@ struct sshfs {
int max_conns;
struct conn *conns;
int ptyfd;
int ptyslavefd;
int ptypassivefd;
int connvers;
int server_version;
unsigned remote_uid;
@@ -432,7 +432,7 @@ static const char *ssh_opts[] = {
"ProxyCommand",
"ProxyJump",
"ProxyUseFdpass",
"PubkeyAcceptedKeyTypes"
"PubkeyAcceptedKeyTypes",
"PubkeyAuthentication",
"RekeyLimit",
"RevokedHostKeys",
@@ -497,7 +497,8 @@ static struct fuse_opt sshfs_opts[] = {
SSHFS_OPT("no_check_root", no_check_root, 1),
SSHFS_OPT("password_stdin", password_stdin, 1),
SSHFS_OPT("delay_connect", delay_connect, 1),
SSHFS_OPT("slave", slave, 1),
SSHFS_OPT("slave", passive, 1),
SSHFS_OPT("passive", passive, 1),
SSHFS_OPT("disable_hardlink", disable_hardlink, 1),
SSHFS_OPT("dir_cache=yes", dir_cache, 1),
SSHFS_OPT("dir_cache=no", dir_cache, 0),
@@ -522,7 +523,7 @@ static struct fuse_opt sshfs_opts[] = {
/* For backwards compatibility */
SSHFS_OPT("cache=yes", dir_cache, 1),
SSHFS_OPT("cache=no", dir_cache, 0),
FUSE_OPT_KEY("writeback_cache=no", FUSE_OPT_KEY_DISCARD),
FUSE_OPT_KEY("unreliable_append", FUSE_OPT_KEY_DISCARD),
@@ -1068,10 +1069,11 @@ static struct conn* get_conn(const struct sshfs_file *sf,
const char *path)
{
struct conntab_entry *ce;
int i;
if (sshfs.max_conns == 1)
return &sshfs.conns[0];
if (sf != NULL)
return sf->conn;
@@ -1089,7 +1091,7 @@ static struct conn* get_conn(const struct sshfs_file *sf,
int best_index = 0;
uint64_t best_score = ~0ULL; /* smaller is better */
for (int i = 0; i < sshfs.max_conns; i++) {
for (i = 0; i < sshfs.max_conns; i++) {
uint64_t score = ((uint64_t) sshfs.conns[i].req_count << 43) +
((uint64_t) sshfs.conns[i].dir_count << 22) +
((uint64_t) sshfs.conns[i].file_count << 1) +
@@ -1146,8 +1148,8 @@ static int start_ssh(struct conn *conn)
if (sshfs.ptyfd == -1)
return -1;
sshfs.ptyslavefd = open(ptyname, O_RDWR | O_NOCTTY);
if (sshfs.ptyslavefd == -1)
sshfs.ptypassivefd = open(ptyname, O_RDWR | O_NOCTTY);
if (sshfs.ptypassivefd == -1)
return -1;
}
@@ -1189,6 +1191,12 @@ static int start_ssh(struct conn *conn)
_exit(0);
}
chdir("/");
/*
* Avoid processes hanging trying to stat() OLDPWD if it is in
* the mount point. This can be removed if sshfs opens the
* mount point after establishing the ssh connection.
*/
unsetenv("OLDPWD");
if (sshfs.password_stdin) {
int sfd;
@@ -1200,7 +1208,7 @@ static int start_ssh(struct conn *conn)
_exit(1);
}
close(sfd);
close(sshfs.ptyslavefd);
close(sshfs.ptypassivefd);
close(sshfs.ptyfd);
}
@@ -1224,7 +1232,7 @@ static int start_ssh(struct conn *conn)
return 0;
}
static int connect_slave(struct conn *conn)
static int connect_passive(struct conn *conn)
{
conn->rfd = STDIN_FILENO;
conn->wfd = STDOUT_FILENO;
@@ -1393,9 +1401,11 @@ static int sftp_read(struct conn *conn, uint8_t *type, struct buffer *buf)
static void request_free(struct request *req)
{
pthread_mutex_lock(&sshfs.lock);
if (req->end_func)
req->end_func(req);
req->conn->req_count--;
pthread_mutex_unlock(&sshfs.lock);
buf_free(&req->reply);
sem_destroy(&req->ready);
g_free(req);
@@ -1441,11 +1451,9 @@ static int clean_req(void *key, struct request *req, gpointer user_data)
req->error = -EIO;
if (req->want_reply)
sem_post(&req->ready);
else {
if (req->end_func)
req->end_func(req);
else
request_free(req);
}
return TRUE;
}
@@ -1507,12 +1515,9 @@ static int process_one_request(struct conn *conn)
if (req->want_reply)
sem_post(&req->ready);
else {
if (req->end_func) {
pthread_mutex_lock(&sshfs.lock);
req->end_func(req);
pthread_mutex_unlock(&sshfs.lock);
}
pthread_mutex_lock(&sshfs.lock);
request_free(req);
pthread_mutex_unlock(&sshfs.lock);
}
} else
buf_free(&buf);
@@ -1531,9 +1536,9 @@ static void close_conn(struct conn *conn)
close(sshfs.ptyfd);
sshfs.ptyfd = -1;
}
if (sshfs.ptyslavefd != -1) {
close(sshfs.ptyslavefd);
sshfs.ptyslavefd = -1;
if (sshfs.ptypassivefd != -1) {
close(sshfs.ptypassivefd);
sshfs.ptypassivefd = -1;
}
}
@@ -1824,8 +1829,8 @@ static int connect_remote(struct conn *conn)
{
int err;
if (sshfs.slave)
err = connect_slave(conn);
if (sshfs.passive)
err = connect_passive(conn);
else if (sshfs.directport)
err = connect_to(conn, sshfs.host, sshfs.directport);
else
@@ -1901,7 +1906,7 @@ static void *sshfs_init(struct fuse_conn_info *conn,
// SFTP only supports 1-second time resolution
conn->time_gran = 1000000000;
return NULL;
}
@@ -1962,12 +1967,9 @@ static int sftp_request_wait(struct request *req, uint8_t type,
}
out:
if (req->end_func) {
pthread_mutex_lock(&sshfs.lock);
req->end_func(req);
pthread_mutex_unlock(&sshfs.lock);
}
pthread_mutex_lock(&sshfs.lock);
request_free(req);
pthread_mutex_unlock(&sshfs.lock);
return err;
}
@@ -2369,6 +2371,13 @@ static int sshfs_mkdir(const char *path, mode_t mode)
// Commutes with pending write(), so we can use any connection
err = sftp_request(get_conn(NULL, NULL), SSH_FXP_MKDIR, &buf, SSH_FXP_STATUS, NULL);
buf_free(&buf);
if (err == -EPERM) {
if (sshfs.op->access(path, R_OK) == 0) {
return -EEXIST;
}
}
return err;
}
@@ -2385,7 +2394,7 @@ static int sshfs_mknod(const char *path, mode_t mode, dev_t rdev)
// Commutes with pending write(), so we can use any connection
conn = get_conn(NULL, NULL);
buf_init(&buf, 0);
buf_add_path(&buf, path);
buf_add_uint32(&buf, SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_EXCL);
@@ -2523,7 +2532,7 @@ static int sshfs_rename(const char *from, const char *to, unsigned int flags)
}
pthread_mutex_unlock(&sshfs.lock);
}
return err;
}
@@ -2580,12 +2589,12 @@ static int sshfs_chmod(const char *path, mode_t mode,
buf_init(&buf, 0);
if (sf == NULL)
buf_add_path(&buf, path);
else
else
buf_add_buf(&buf, &sf->handle);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_PERMISSIONS);
buf_add_uint32(&buf, mode);
/* FIXME: really needs LSETSTAT extension (debian Bug#640038) */
// Commutes with pending write(), so we can use any connection
// if the file is not open.
@@ -2609,7 +2618,7 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid,
if (!sshfs_file_is_conn(sf))
return -EIO;
}
if (sshfs.remote_uid_detected) {
if (uid == sshfs.local_uid)
uid = sshfs.remote_uid;
@@ -2626,7 +2635,7 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid,
buf_init(&buf, 0);
if (sf == NULL)
buf_add_path(&buf, path);
else
else
buf_add_buf(&buf, &sf->handle);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_UIDGID);
buf_add_uint32(&buf, uid);
@@ -2676,7 +2685,7 @@ static int sshfs_utimens(const char *path, const struct timespec tv[2],
buf_init(&buf, 0);
if (sf == NULL)
buf_add_path(&buf, path);
else
else
buf_add_buf(&buf, &sf->handle);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_ACMODTIME);
buf_add_uint32(&buf, asec);
@@ -2731,7 +2740,7 @@ static int sshfs_open_common(const char *path, mode_t mode,
if (fi->flags & O_APPEND)
pflags |= SSH_FXF_APPEND;
sf = g_new0(struct sshfs_file, 1);
list_init(&sf->write_reqs);
pthread_cond_init(&sf->write_finished, NULL);
@@ -2741,7 +2750,7 @@ static int sshfs_open_common(const char *path, mode_t mode,
pthread_mutex_lock(&sshfs.lock);
sf->modifver= sshfs.modifver;
if (sshfs.max_conns > 1) {
ce = g_hash_table_lookup(sshfs.conntab, path);
ce = g_hash_table_lookup(sshfs.conntab, path);
if (!ce) {
ce = g_malloc(sizeof(struct conntab_entry));
ce->refcount = 0;
@@ -3345,7 +3354,7 @@ static int sshfs_truncate(const char *path, off_t size,
sshfs_inc_modifver();
if (sshfs.truncate_workaround)
return sshfs_truncate_workaround(path, size, fi);
buf_init(&buf, 0);
if (sf != NULL)
@@ -3388,7 +3397,7 @@ static int sshfs_getattr(const char *path, struct stat *stbuf,
buf_add_buf(&buf, &sf->handle);
err = sftp_request(sf->conn, SSH_FXP_FSTAT, &buf,
SSH_FXP_ATTRS, &outbuf);
}
}
if (!err) {
err = buf_get_attrs(&outbuf, stbuf, NULL);
#ifdef __APPLE__
@@ -3629,7 +3638,7 @@ static void usage(const char *progname)
" -o ssh_protocol=N ssh protocol to use (default: 2)\n"
" -o sftp_server=SERV path to sftp server or subsystem (default: sftp)\n"
" -o directport=PORT directly connect to PORT bypassing ssh\n"
" -o slave communicate over stdin and stdout bypassing network\n"
" -o passive communicate over stdin and stdout bypassing network\n"
" -o disable_hardlink link(2) will return with errno set to ENOSYS\n"
" -o transform_symlinks transform absolute symlinks to relative\n"
" -o follow_symlinks follow symlinks on the server\n"
@@ -4182,9 +4191,9 @@ int main(int argc, char *argv[])
sshfs.show_version = 0;
sshfs.singlethread = 0;
sshfs.foreground = 0;
sshfs.ptyslavefd = -1;
sshfs.ptypassivefd = -1;
sshfs.delay_connect = 0;
sshfs.slave = 0;
sshfs.passive = 0;
sshfs.detect_uid = 0;
if (strcmp(IDMAP_DEFAULT, "none") == 0) {
sshfs.idmap = IDMAP_NONE;
@@ -4250,12 +4259,12 @@ int main(int argc, char *argv[])
DEBUG("SSHFS version %s\n", PACKAGE_VERSION);
/* Force sshfs to the foreground when using stdin+stdout */
if (sshfs.slave)
if (sshfs.passive)
sshfs.foreground = 1;
if (sshfs.slave && sshfs.password_stdin) {
fprintf(stderr, "the password_stdin and slave options cannot both be specified\n");
if (sshfs.passive && sshfs.password_stdin) {
fprintf(stderr, "the password_stdin and passive options cannot both be specified\n");
exit(1);
}
@@ -4287,8 +4296,8 @@ int main(int argc, char *argv[])
exit(1);
}
if (sshfs.slave) {
fprintf(stderr, "slave option cannot be specified with parallel connections\n");
if (sshfs.passive) {
fprintf(stderr, "passive option cannot be specified with parallel connections\n");
exit(1);
}
} else if (sshfs.max_conns <= 0) {
+18 -15
View File
@@ -37,7 +37,7 @@ credentials that were used to connect to the server. If this is undesired, local
permission checking can be enabled with ``-o default_permissions``.
By default, only the mounting user will be able to access the filesystem. Access for other
users can be enabled by passing ``-o allow_others``. In this case you most likely also
users can be enabled by passing ``-o allow_other``. In this case you most likely also
want to use ``-o default_permissions``.
It is recommended to run SSHFS as regular user (not as root). For this to work the
@@ -156,8 +156,11 @@ Options
-o directport=PORT
directly connect to PORT bypassing ssh
-o slave
communicate over stdin and stdout bypassing network
-o passive
communicate over stdin and stdout bypassing network. Useful for
mounting local filesystem on the remote side. An example using
dpipe command would be ``dpipe /usr/lib/openssh/sftp-server = ssh
RemoteHostname sshfs :/directory/to/be/shared ~/mnt/src -o passive``
-o disable_hardlink
With this option set, attempts to call `link(2)` will fail with
@@ -187,17 +190,17 @@ Options
directory cache holds the names of directory entries. Enabling it
allows `readdir(3)` system calls to be processed without network
access.
-o dcache_max_size=N
sets the maximum size of the directory cache.
-o dcache_timeout=N
sets timeout for directory cache in seconds.
-o dcache_{stat,link,dir}_timeout=N
sets separate timeout for {attributes, symlinks, names} in the
directory cache.
-o dcache_clean_interval=N
sets the interval for automatic cleaning of the directory cache.
@@ -206,25 +209,25 @@ Options
when full.
-o direct_io
This option disables the use of page cache (file content cache) in
This option disables the use of page cache (file content cache) in
the kernel for this filesystem.
This has several affects:
1. Each read() or write() system call will initiate one or more read or
write operations, data will not be cached in the kernel.
2. The return value of the read() and write() system calls will correspond
to the return values of the read and write operations. This is useful
2. The return value of the read() and write() system calls will correspond
to the return values of the read and write operations. This is useful
for example if the file size is not known in advance (before reading it).
e.g. /proc filesystem
e.g. /proc filesystem
-o max_conns=N
sets the maximum number of simultaneous SSH connections
to use. Each connection is established with a separate SSH process.
The primary purpose of this feature is to improve the responsiveness of the
file system during large file transfers. When using more than once
connection, the *password_stdin* and *slave* options can not be
used, and the *buflimit* workaround is not supported/
connection, the *password_stdin* and *passive* options can not be
used, and the *buflimit* workaround is not supported.
In addition, SSHFS accepts several options common to all FUSE file
systems. These are described in the `mount.fuse` manpage (look
@@ -271,7 +274,7 @@ SSHFS hangs for no apparent reason
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In some cases, attempts to access the SSHFS mountpoint may freeze if
no filesystem activity has occured for some time. This is typically
no filesystem activity has occurred for some time. This is typically
caused by the SSH connection being dropped because of inactivity
without SSHFS being informed about that. As a workaround, you can try
to mount with ``-o ServerAliveInterval=15``. This will force the SSH
@@ -308,7 +311,7 @@ interrupted.
Mounting from /etc/fstab
========================
To mount an SSHFS filesystem from ``/etc/fstab``, simply use ``sshfs`
To mount an SSHFS filesystem from ``/etc/fstab``, simply use ``sshfs``
as the file system type. (For backwards compatibility, you may also
use ``fuse.sshfs``).
+3 -2
View File
@@ -1,7 +1,8 @@
#!/bin/bash
set -e
machine=$(uname -m)
mkdir build-$machine
cd build-$machine
mkdir "build-$machine"
cd "build-$machine"
meson ..
ninja
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
pip3 install --user pre-commit
pre-commit run --all-files --show-diff-on-failure
+1 -1
View File
@@ -2,7 +2,7 @@ test_scripts = [ 'conftest.py', 'pytest.ini', 'test_sshfs.py',
'util.py' ]
custom_target('test_scripts', input: test_scripts,
output: test_scripts, build_by_default: true,
command: ['cp', '-fPp',
command: ['cp', '-fPp',
'@INPUT@', meson.current_build_dir() ])
# Provide something helpful when running 'ninja test'
+6 -6
View File
@@ -35,15 +35,15 @@ def name_generator(__ctr=[0]):
@pytest.mark.parametrize("sync_rd", (True, False))
@pytest.mark.parametrize("multiconn", (True,False))
def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd):
# Avoid false positives from debug messages
#if debug:
# capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$',
# count=0)
# Avoid false positives from storing key for localhost
# Avoid false positives from storing key for localhost
capfd.register_output(r"^Warning: Permanently added 'localhost' .+", count=0)
# Test if we can ssh into localhost without password
try:
res = subprocess.call(['ssh', '-o', 'KbdInteractiveAuthentication=no',
@@ -80,12 +80,12 @@ def test_sshfs(tmpdir, debug, cache_timeout, sync_rd, multiconn, capfd):
if multiconn:
cmdline += [ '-o', 'max_conns=3' ]
new_env = dict(os.environ) # copy, don't modify
# Abort on warnings from glib
new_env['G_DEBUG'] = 'fatal-warnings'
mount_process = subprocess.Popen(cmdline, env=new_env)
try:
wait_for_mount(mount_process, mnt_dir)
@@ -299,7 +299,7 @@ def tst_link(mnt_dir, cache_timeout):
# we need to wait until the cached value has expired.
if cache_timeout:
safe_sleep(cache_timeout)
fstat1 = os.lstat(name1)
fstat2 = os.lstat(name2)
for attr in ('st_mode', 'st_dev', 'st_uid', 'st_gid',
+12 -8
View File
@@ -6,36 +6,40 @@ set -e
# that we still need to fix
export ASAN_OPTIONS="detect_leaks=0"
export LSAN_OPTIONS="suppressions=$(pwd)/test/lsan_suppress.txt"
export LSAN_OPTIONS="suppressions=${PWD}/test/lsan_suppress.txt"
export CC
TEST_CMD="python3 -m pytest --maxfail=99 test/"
# Standard build with Valgrind
for CC in gcc gcc-6 clang; do
mkdir build-${CC}; cd build-${CC}
if [ ${CC} == 'gcc-6' ]; then
for CC in gcc clang; do
(
mkdir "build-${CC}"; cd "build-${CC}"
if [ "${CC}" == 'gcc-6' ]; then
build_opts='-D b_lundef=false'
else
build_opts=''
fi
# shellcheck disable=SC2086
meson -D werror=true ${build_opts} ../
ninja
TEST_WITH_VALGRIND=true ${TEST_CMD}
cd ..
)
done
(cd build-$CC; sudo ninja install)
(cd "build-${CC}"; sudo ninja install)
# Sanitized build
CC=clang
for san in undefined address; do
mkdir build-${san}; cd build-${san}
(
mkdir "build-${san}"
cd "build-${san}"
# b_lundef=false is required to work around clang
# bug, cf. https://groups.google.com/forum/#!topic/mesonbuild/tgEdAXIIdC4
meson -D b_sanitize=${san} -D b_lundef=false -D werror=true ..
ninja
${TEST_CMD}
sudo ninja install
cd ..
)
done
+1 -8
View File
@@ -2,25 +2,18 @@
set -e
# Meson 0.45 requires Python 3.5 or newer
sudo python3 -m pip install pytest meson==0.44
valgrind --version
ninja --version
meson --version
# Install fuse
wget https://github.com/libfuse/libfuse/archive/master.zip
unzip master.zip
cd libfuse-master
mkdir build
cd build
export CC=gcc-6
meson ..
ninja
sudo ninja install
test -e /usr/local/lib/pkgconfig || sudo mkdir /usr/local/lib/pkgconfig
sudo mv /usr/local/lib/*/pkgconfig/* /usr/local/lib/pkgconfig/
ls -d1 /usr/local/lib/*-linux-gnu | sudo tee /etc/ld.so.conf.d/usrlocal.conf
printf '%s\n' /usr/local/lib/*-linux-gnu | sudo tee /etc/ld.so.conf.d/usrlocal.conf
sudo ldconfig
# Setup ssh
+1 -1
View File
@@ -29,7 +29,7 @@ def cleanup(mount_process, mnt_dir):
mount_process.wait(1)
except subprocess.TimeoutExpired:
mount_process.kill()
def umount(mount_process, mnt_dir):
subprocess.check_call(['fusermount3', '-z', '-u', mnt_dir ])