Fix mounting FUSE fs into current working directory
See rhbz #622255 for additional details: https://bugzilla.redhat.com/show_bug.cgi?id=622255 Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
This commit is contained in:
parent
8357eb9357
commit
a353eb8e76
20
fuse-0001-Fix-udev-rules-Fedora-specific.patch
Normal file
20
fuse-0001-Fix-udev-rules-Fedora-specific.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
From ba47031f3557b81e732d41593c95e7b984b54b78 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
|
Date: Mon, 9 Aug 2010 12:09:00 +0400
|
||||||
|
Subject: [PATCH 1/3] Fix udev rules (Fedora-specific)
|
||||||
|
|
||||||
|
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
|
---
|
||||||
|
util/udev.rules | 2 +-
|
||||||
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/util/udev.rules b/util/udev.rules
|
||||||
|
index 9585111..bb8033f 100644
|
||||||
|
--- a/util/udev.rules
|
||||||
|
+++ b/util/udev.rules
|
||||||
|
@@ -1 +1 @@
|
||||||
|
-KERNEL=="fuse", MODE="0666"
|
||||||
|
+KERNEL=="fuse", MODE="0666",OWNER="root",GROUP="root"
|
||||||
|
--
|
||||||
|
1.7.3.1
|
||||||
|
|
@ -1,7 +1,19 @@
|
|||||||
diff -up fuse-2.7.2/lib/fuse.c.BAD fuse-2.7.2/lib/fuse.c
|
From 459c84a3e5fda1ef7f7060d44903b31215857e70 Mon Sep 17 00:00:00 2001
|
||||||
--- lib/fuse.c 2008-01-21 09:55:42.000000000 -0500
|
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
+++ lib/fuse.c 2008-01-21 09:57:20.000000000 -0500
|
Date: Mon, 9 Aug 2010 12:10:40 +0400
|
||||||
@@ -633,17 +633,15 @@ static int fuse_compat_open(struct fuse_
|
Subject: [PATCH 2/3] More parentheses
|
||||||
|
|
||||||
|
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
|
---
|
||||||
|
lib/fuse.c | 8 +++-----
|
||||||
|
lib/fuse_lowlevel.c | 2 +-
|
||||||
|
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/fuse.c b/lib/fuse.c
|
||||||
|
index 95cf50b..76c2681 100644
|
||||||
|
--- a/lib/fuse.c
|
||||||
|
+++ b/lib/fuse.c
|
||||||
|
@@ -961,17 +961,15 @@ static int fuse_compat_open(struct fuse_fs *fs, const char *path,
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
if (!fs->compat || fs->compat >= 25)
|
if (!fs->compat || fs->compat >= 25)
|
||||||
@ -22,10 +34,11 @@ diff -up fuse-2.7.2/lib/fuse.c.BAD fuse-2.7.2/lib/fuse.c
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff -up fuse-2.7.2/lib/fuse_lowlevel.c.BAD fuse-2.7.2/lib/fuse_lowlevel.c
|
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
|
||||||
--- lib/fuse_lowlevel.c 2008-01-21 09:57:52.000000000 -0500
|
index c519bfb..d6275b5 100644
|
||||||
+++ lib/fuse_lowlevel.c 2008-01-21 09:58:15.000000000 -0500
|
--- a/lib/fuse_lowlevel.c
|
||||||
@@ -605,7 +605,7 @@ static void do_open(fuse_req_t req, fuse
|
+++ b/lib/fuse_lowlevel.c
|
||||||
|
@@ -716,7 +716,7 @@ static void do_open(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
|
||||||
fi.flags = arg->flags;
|
fi.flags = arg->flags;
|
||||||
|
|
||||||
if (req->f->op.open)
|
if (req->f->op.open)
|
||||||
@ -34,3 +47,6 @@ diff -up fuse-2.7.2/lib/fuse_lowlevel.c.BAD fuse-2.7.2/lib/fuse_lowlevel.c
|
|||||||
else
|
else
|
||||||
fuse_reply_open(req, &fi);
|
fuse_reply_open(req, &fi);
|
||||||
}
|
}
|
||||||
|
--
|
||||||
|
1.7.3.1
|
||||||
|
|
@ -0,0 +1,125 @@
|
|||||||
|
From d8bdebc639a84fa280153a466d4bb420fc9572bc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
|
Date: Wed, 27 Oct 2010 16:29:45 +0400
|
||||||
|
Subject: [PATCH 3/3] Fix mounting FUSE fs into current working directory
|
||||||
|
|
||||||
|
See rhbz #622255 for bug description:
|
||||||
|
|
||||||
|
https://bugzilla.redhat.com/622255
|
||||||
|
|
||||||
|
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
||||||
|
---
|
||||||
|
lib/mount_util.c | 75 +++++++++++++-----------------------------------------
|
||||||
|
1 files changed, 18 insertions(+), 57 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/mount_util.c b/lib/mount_util.c
|
||||||
|
index 33e6697..b9a0895 100644
|
||||||
|
--- a/lib/mount_util.c
|
||||||
|
+++ b/lib/mount_util.c
|
||||||
|
@@ -54,8 +54,8 @@ static int mtab_needs_update(const char *mnt)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int add_mount_legacy(const char *progname, const char *fsname,
|
||||||
|
- const char *mnt, const char *type, const char *opts)
|
||||||
|
+static int add_mount(const char *progname, const char *fsname,
|
||||||
|
+ const char *mnt, const char *type, const char *opts, int is_legacy)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
int status;
|
||||||
|
@@ -76,6 +76,14 @@ static int add_mount_legacy(const char *progname, const char *fsname,
|
||||||
|
goto out_restore;
|
||||||
|
}
|
||||||
|
if (res == 0) {
|
||||||
|
+ /*
|
||||||
|
+ * Hide output, because old versions don't support
|
||||||
|
+ * --no-canonicalize
|
||||||
|
+ */
|
||||||
|
+ int fd = open("/dev/null", O_RDONLY);
|
||||||
|
+ dup2(fd, 1);
|
||||||
|
+ dup2(fd, 2);
|
||||||
|
+
|
||||||
|
char templ[] = "/tmp/fusermountXXXXXX";
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
@@ -99,59 +107,12 @@ static int add_mount_legacy(const char *progname, const char *fsname,
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
rmdir(tmp);
|
||||||
|
- execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type,
|
||||||
|
- "-o", opts, fsname, mnt, NULL);
|
||||||
|
- fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
|
||||||
|
- progname, strerror(errno));
|
||||||
|
- exit(1);
|
||||||
|
- }
|
||||||
|
- res = waitpid(res, &status, 0);
|
||||||
|
- if (res == -1)
|
||||||
|
- fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
|
||||||
|
-
|
||||||
|
- if (status != 0)
|
||||||
|
- res = -1;
|
||||||
|
-
|
||||||
|
- out_restore:
|
||||||
|
- sigprocmask(SIG_SETMASK, &oldmask, NULL);
|
||||||
|
-
|
||||||
|
- return res;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int add_mount(const char *progname, const char *fsname,
|
||||||
|
- const char *mnt, const char *type, const char *opts)
|
||||||
|
-{
|
||||||
|
- int res;
|
||||||
|
- int status;
|
||||||
|
- sigset_t blockmask;
|
||||||
|
- sigset_t oldmask;
|
||||||
|
-
|
||||||
|
- sigemptyset(&blockmask);
|
||||||
|
- sigaddset(&blockmask, SIGCHLD);
|
||||||
|
- res = sigprocmask(SIG_BLOCK, &blockmask, &oldmask);
|
||||||
|
- if (res == -1) {
|
||||||
|
- fprintf(stderr, "%s: sigprocmask: %s\n", progname, strerror(errno));
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- res = fork();
|
||||||
|
- if (res == -1) {
|
||||||
|
- fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
|
||||||
|
- goto out_restore;
|
||||||
|
- }
|
||||||
|
- if (res == 0) {
|
||||||
|
- /*
|
||||||
|
- * Hide output, because old versions don't support
|
||||||
|
- * --no-canonicalize
|
||||||
|
- */
|
||||||
|
- int fd = open("/dev/null", O_RDONLY);
|
||||||
|
- dup2(fd, 1);
|
||||||
|
- dup2(fd, 2);
|
||||||
|
-
|
||||||
|
- sigprocmask(SIG_SETMASK, &oldmask, NULL);
|
||||||
|
- setuid(geteuid());
|
||||||
|
- execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
|
||||||
|
- "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
|
||||||
|
+ if(is_legacy)
|
||||||
|
+ execl("/bin/mount", "/bin/mount", "-i",
|
||||||
|
+ "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
|
||||||
|
+ else
|
||||||
|
+ execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
|
||||||
|
+ "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
|
||||||
|
fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
|
||||||
|
progname, strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
@@ -177,9 +138,9 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname,
|
||||||
|
if (!mtab_needs_update(mnt))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- res = add_mount(progname, fsname, mnt, type, opts);
|
||||||
|
+ res = add_mount(progname, fsname, mnt, type, opts, 0);
|
||||||
|
if (res == -1)
|
||||||
|
- res = add_mount_legacy(progname, fsname, mnt, type, opts);
|
||||||
|
+ res = add_mount(progname, fsname, mnt, type, opts, 1);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.3.1
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
--- util/udev.rules 2005-11-03 19:38:05.000000000 +0100
|
|
||||||
+++ util/udev.rules 2005-11-03 19:38:13.000000000 +0100
|
|
||||||
@@ -1 +1 @@
|
|
||||||
-KERNEL=="fuse", MODE="0666"
|
|
||||||
+KERNEL=="fuse", MODE="0666",OWNER="root",GROUP="root"
|
|
15
fuse.spec
15
fuse.spec
@ -1,6 +1,6 @@
|
|||||||
Name: fuse
|
Name: fuse
|
||||||
Version: 2.8.5
|
Version: 2.8.5
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: File System in Userspace (FUSE) utilities
|
Summary: File System in Userspace (FUSE) utilities
|
||||||
|
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -8,8 +8,9 @@ License: GPL+
|
|||||||
URL: http://fuse.sf.net
|
URL: http://fuse.sf.net
|
||||||
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch0: fuse-udev_rules.patch
|
Patch1: fuse-0001-Fix-udev-rules-Fedora-specific.patch
|
||||||
Patch1: fuse-openfix.patch
|
Patch2: fuse-0002-More-parentheses.patch
|
||||||
|
Patch3: fuse-0003-Fix-mounting-FUSE-fs-into-current-working-directory.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
Requires: kernel >= 2.6.14
|
Requires: kernel >= 2.6.14
|
||||||
Requires: which
|
Requires: which
|
||||||
@ -50,8 +51,9 @@ pgk-config) to develop FUSE based applications/filesystems.
|
|||||||
%setup -q
|
%setup -q
|
||||||
#disable device creation during build/install
|
#disable device creation during build/install
|
||||||
sed -i 's|mknod|echo Disabled: mknod |g' util/Makefile.in
|
sed -i 's|mknod|echo Disabled: mknod |g' util/Makefile.in
|
||||||
%patch0 -p0 -b .patch0
|
%patch1 -p1 -b .fix_udev_rules
|
||||||
%patch1 -p0 -b .patch1
|
%patch2 -p1 -b .add_parentheses
|
||||||
|
%patch3 -p1 -b allow_mount_to_cwd
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Can't pass --disable-static here, or else the utils don't build
|
# Can't pass --disable-static here, or else the utils don't build
|
||||||
@ -125,6 +127,9 @@ fi
|
|||||||
%{_includedir}/fuse
|
%{_includedir}/fuse
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 27 2010 Peter Lemenkov <lemenkov@gmail.com> 2.8.5-2
|
||||||
|
- Fixed rhbz #622255
|
||||||
|
|
||||||
* Tue Oct 26 2010 Peter Lemenkov <lemenkov@gmail.com> 2.8.5-1
|
* Tue Oct 26 2010 Peter Lemenkov <lemenkov@gmail.com> 2.8.5-1
|
||||||
- Ver. 2.8.5
|
- Ver. 2.8.5
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user