> Yes, I know it is impossible to follow them, but it is VERY unhandy.
> Since shfs used to have an opiton allowing limlinks to be followed I
> hope, you will find a way soon.
Does this patch do, what you were thinking of?
Miklos
Index: cache.c
===================================================================
RCS file: /cvsroot/fuse/sshfs/cache.c,v
retrieving revision 1.17
diff -u -r1.17 cache.c
--- cache.c 16 Feb 2006 17:02:25 -0000 1.17
+++ cache.c 16 Aug 2006 08:52:47 -0000
@@ -250,7 +250,7 @@
const struct stat *stbuf)
{
int err = ch->filler(ch->h, name, 0, 0);
- if (!err) {
+ if (!err && (stbuf->st_mode & S_IFMT)) {
char *fullpath;
g_ptr_array_add(ch->dir, g_strdup(name));
fullpath = g_strdup_printf("%s/%s", !ch->path[1] ? "" : ch->path, name);
Index: sshfs.c
===================================================================
RCS file: /cvsroot/fuse/sshfs/sshfs.c,v
retrieving revision 1.76
diff -u -r1.76 sshfs.c
--- sshfs.c 13 Apr 2006 07:44:30 -0000 1.76
+++ sshfs.c 16 Aug 2006 08:52:50 -0000
@@ -159,6 +159,7 @@
int nodelay_workaround;
int truncate_workaround;
int transform_symlinks;
+ int follow_symlinks;
int detect_uid;
unsigned max_read;
unsigned ssh_ver;
@@ -253,6 +254,7 @@
SSHFS_OPT("sshfs_debug", debug, 1),
SSHFS_OPT("reconnect", reconnect, 1),
SSHFS_OPT("transform_symlinks", transform_symlinks, 1),
+ SSHFS_OPT("follow_symlinks", follow_symlinks, 1),
FUSE_OPT_KEY("-p ", KEY_PORT),
FUSE_OPT_KEY("-C", KEY_COMPRESS),
@@ -605,6 +607,8 @@
if (buf_get_string(buf, &longname) != -1) {
free(longname);
if (buf_get_attrs(buf, &stbuf, NULL) != -1) {
+ if (sshfs.follow_symlinks && S_ISLNK(stbuf.st_mode))
+ stbuf.st_mode = 0;
filler(h, name, &stbuf);
err = 0;
}
@@ -1275,7 +1279,8 @@
struct buffer outbuf;
buf_init(&buf, 0);
buf_add_path(&buf, path);
- err = sftp_request(SSH_FXP_LSTAT, &buf, SSH_FXP_ATTRS, &outbuf);
+ err = sftp_request(sshfs.follow_symlinks ? SSH_FXP_STAT : SSH_FXP_LSTAT,
+ &buf, SSH_FXP_ATTRS, &outbuf);
if (!err) {
if (buf_get_attrs(&outbuf, stbuf, NULL) == -1)
err = -EIO;
@@ -1657,7 +1662,8 @@
sftp_request_send(SSH_FXP_OPEN, &iov, 1, NULL, NULL, 1, NULL, &open_req);
buf_clear(&buf);
buf_add_path(&buf, path);
- err2 = sftp_request(SSH_FXP_LSTAT, &buf, SSH_FXP_ATTRS, &outbuf);
+ err2 = sftp_request(sshfs.follow_symlinks ? SSH_FXP_STAT : SSH_FXP_LSTAT,
+ &buf, SSH_FXP_ATTRS, &outbuf);
if (!err2 && buf_get_attrs(&outbuf, &stbuf, NULL) == -1)
err2 = -EIO;
err = sftp_request_wait(open_req, SSH_FXP_OPEN, SSH_FXP_HANDLE,
@@ -2285,6 +2291,7 @@
" -o sftp_server=SERV path to sftp server or subsystem (default: sftp)\n"
" -o directport=PORT directly connect to PORT bypassing ssh\n"
" -o transform_symlinks transform absolute symlinks to relative\n"
+" -o follow_symlinks follow symlinks on the server\n"
" -o SSHOPT=VAL ssh options (see man ssh_config)\n"
"\n", progname);
}
|