[ntfs-3g/epel7] apply upstream patch to properly use fuse on older kernels
Tom Callaway
spot at fedoraproject.org
Fri Jan 2 17:45:49 UTC 2015
commit 29cb20d81415ce285ea2f222fb08e7fc0f45f7c1
Author: Tom Callaway <spot at fedoraproject.org>
Date: Fri Jan 2 12:45:58 2015 -0500
apply upstream patch to properly use fuse on older kernels
fuse-fallback.patch | 49 +++++++++++++++++++++
ntfs-3g.spec | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 166 insertions(+), 1 deletions(-)
---
diff --git a/fuse-fallback.patch b/fuse-fallback.patch
new file mode 100644
index 0000000..28c4262
--- /dev/null
+++ b/fuse-fallback.patch
@@ -0,0 +1,49 @@
+--- include/fuse-lite/fuse_kernel.h.ref 2014-11-01 17:35:14.000000000 +0100
++++ include/fuse-lite/fuse_kernel.h 2014-11-01 21:27:07.000000000 +0100
+@@ -56,11 +56,12 @@
+ #define FUSE_KERNEL_MINOR_VERSION 18
+
+ /*
+- * For binary compatibility with old kernels we accept falling back to 7.8
++ * For binary compatibility with old kernels we accept falling back
++ * to 7.12 or earlier maximum version supported by the kernel
+ */
+
+ #define FUSE_KERNEL_MAJOR_FALLBACK 7
+-#define FUSE_KERNEL_MINOR_FALLBACK 8
++#define FUSE_KERNEL_MINOR_FALLBACK 12
+
+ /** The node ID of the root inode */
+ #define FUSE_ROOT_ID 1
+--- libfuse-lite/fuse_lowlevel.c.ref 2014-11-01 17:35:14.000000000 +0100
++++ libfuse-lite/fuse_lowlevel.c 2014-11-02 08:18:17.000000000 +0100
+@@ -1105,7 +1105,7 @@
+ outarg.major = FUSE_KERNEL_VERSION;
+ /*
+ * Suggest using protocol 7.18 when available, and fallback
+- * to 7.8 when running on an old kernel.
++ * to 7.12 or even earlier when running on an old kernel.
+ * Protocol 7.12 has the ability to process the umask
+ * conditionnally (as needed if POSIXACLS is set)
+ * Protocol 7.18 has the ability to process the ioctls
+@@ -1119,8 +1119,20 @@
+ outarg.flags |= FUSE_DONT_MASK;
+ #endif
+ } else {
++ /* Never use a version more recent than supported by the kernel */
++ if ((arg->major < FUSE_KERNEL_MAJOR_FALLBACK)
++ || ((arg->major == FUSE_KERNEL_MAJOR_FALLBACK)
++ && (arg->minor < FUSE_KERNEL_MINOR_FALLBACK))) {
++ outarg.major = arg->major;
++ outarg.minor = arg->minor;
++ } else {
+ outarg.major = FUSE_KERNEL_MAJOR_FALLBACK;
+ outarg.minor = FUSE_KERNEL_MINOR_FALLBACK;
++#ifdef POSIXACLS
++ if (f->conn.want & FUSE_CAP_DONT_MASK)
++ outarg.flags |= FUSE_DONT_MASK;
++#endif
++ }
+ }
+ if (f->conn.async_read)
+ outarg.flags |= FUSE_ASYNC_READ;
diff --git a/ntfs-3g.spec b/ntfs-3g.spec
index 1260f76..2d3125a 100644
--- a/ntfs-3g.spec
+++ b/ntfs-3g.spec
@@ -5,13 +5,24 @@
# For release candidates
# %%global subver -RC
+%global oldrhel 0
+
+%if 0%{?rhel}
+%if 0%{?rhel} < 7
+%global oldrhel 1
+%endif
+%endif
+
Name: ntfs-3g
Summary: Linux NTFS userspace driver
Version: 2014.2.15
-Release: 6%{?dist}
+Release: 8%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: http://tuxera.com/opensource/%{name}_ntfsprogs-%{version}%{?subver}.tgz
+%if %{oldrhel}
+Source1: 20-ntfs-config-write-policy.fdi
+%endif
URL: http://www.ntfs-3g.org/
%if %{with_externalfuse}
BuildRequires: fuse-devel
@@ -38,6 +49,9 @@ Patch3: 0001-Fixed-fstrim-8-applied-to-partitions.patch
# a released version of ntfs-3g that includes the new feature.
BuildRequires: autoconf automake libtool
+# Fixes fuse on old kernels (RHEL 6 or older)
+Patch4: fuse-fallback.patch
+
%description
NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS
driver for Linux and many other operating systems. It provides safe
@@ -85,6 +99,7 @@ included utilities see man 8 ntfsprogs after installation).
%patch1 -p1 -b .ioctl
%patch2 -p1 -b .fstrim
%patch3 -p1 -b .parts
+%patch4 -p0 -b .oldkernel
autoreconf -i
%build
@@ -96,24 +111,46 @@ CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
--with-fuse=external \
%endif
--exec-prefix=/ \
+%if %{oldrhel}
+ --bindir=/bin \
+ --sbindir=/sbin \
+ --libdir=/%{_lib} \
+%endif
--enable-crypto \
--enable-extras
make %{?_smp_mflags} LIBTOOL=%{_bindir}/libtool
%install
make LIBTOOL=%{_bindir}/libtool DESTDIR=%{buildroot} install
+%if %{oldrhel}
+rm -rf %{buildroot}/%{_lib}/*.la
+rm -rf %{buildroot}/%{_lib}/*.a
+%else
rm -rf %{buildroot}%{_libdir}/*.la
rm -rf %{buildroot}%{_libdir}/*.a
+%endif
+%if %{oldrhel}
+rm -rf %{buildroot}/sbin/mount.ntfs-3g
+cp -a %{buildroot}/bin/ntfs-3g %{buildroot}/sbin/mount.ntfs-3g
+%else
rm -rf %{buildroot}/%{_sbindir}/mount.ntfs-3g
cp -a %{buildroot}/%{_bindir}/ntfs-3g %{buildroot}/%{_sbindir}/mount.ntfs-3g
+%endif
# Actually make some symlinks for simplicity...
# ... since we're obsoleting ntfsprogs-fuse
+%if %{oldrhel}
+pushd %{buildroot}/bin
+ln -s ntfs-3g ntfsmount
+popd
+pushd %{buildroot}/sbin
+%else
pushd %{buildroot}/%{_bindir}
ln -s ntfs-3g ntfsmount
popd
pushd %{buildroot}/%{_sbindir}
+%endif
ln -s mount.ntfs-3g mount.ntfs-fuse
# And since there is no other package in Fedora that provides an ntfs
# mount...
@@ -121,48 +158,120 @@ ln -s mount.ntfs-3g mount.ntfs
# Need this for fsck to find it
ln -s ../bin/ntfsck fsck.ntfs
popd
+
+%if %{oldrhel}
+# Compat symlinks
+mkdir -p %{buildroot}%{_bindir}
+pushd %{buildroot}%{_bindir}
+ln -s /bin/ntfs-3g ntfs-3g
+ln -s /bin/ntfsmount ntfsmount
+popd
+
+# Put the .pc file in the right place.
+mkdir -p %{buildroot}%{_libdir}/pkgconfig/
+mv %{buildroot}/%{_lib}/pkgconfig/libntfs-3g.pc %{buildroot}%{_libdir}/pkgconfig/
+%else
mv %{buildroot}/sbin/* %{buildroot}/%{_sbindir}
rmdir %{buildroot}/sbin
+%endif
# We get this on our own, thanks.
rm -rf %{buildroot}%{_defaultdocdir}/%{name}/README
+%if %{oldrhel}
+mkdir -p %{buildroot}%{_datadir}/hal/fdi/policy/10osvendor/
+cp -a %{SOURCE1} %{buildroot}%{_datadir}/hal/fdi/policy/10osvendor/
+%endif
+
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc AUTHORS ChangeLog COPYING CREDITS NEWS README
+%if %{oldrhel}
+/sbin/mount.ntfs
+%attr(754,root,root) /sbin/mount.ntfs-3g
+/sbin/mount.ntfs-fuse
+/sbin/mount.lowntfs-3g
+/bin/ntfs-3g
+/bin/ntfsmount
+%else
%{_sbindir}/mount.ntfs
%attr(754,root,root) %{_sbindir}/mount.ntfs-3g
%{_sbindir}/mount.ntfs-fuse
%{_sbindir}/mount.lowntfs-3g
+%endif
%{_bindir}/ntfs-3g
%{_bindir}/ntfsmount
+%if %{oldrhel}
+/bin/ntfs-3g.probe
+/bin/ntfs-3g.secaudit
+/bin/ntfs-3g.usermap
+/bin/lowntfs-3g
+%else
%{_bindir}/ntfs-3g.probe
%{_bindir}/ntfs-3g.secaudit
%{_bindir}/ntfs-3g.usermap
%{_bindir}/lowntfs-3g
+%endif
%{_bindir}/ntfs-3g
%{_bindir}/ntfsmount
+%if %{oldrhel}
+/%{_lib}/libntfs-3g.so.*
+%else
%{_libdir}/libntfs-3g.so.*
+%endif
%{_mandir}/man8/mount.lowntfs-3g.*
%{_mandir}/man8/mount.ntfs-3g.*
%{_mandir}/man8/ntfs-3g*
+%if %{oldrhel}
+%{_datadir}/hal/fdi/policy/10osvendor/20-ntfs-config-write-policy.fdi
+%endif
%files devel
%{_includedir}/ntfs-3g/
+%if %{oldrhel}
+/%{_lib}/libntfs-3g.so
+%else
%{_libdir}/libntfs-3g.so
+%endif
%{_libdir}/pkgconfig/libntfs-3g.pc
%files -n ntfsprogs
%doc AUTHORS COPYING CREDITS ChangeLog NEWS README
+%if %{oldrhel}
+/bin/ntfscat
+/bin/ntfscluster
+/bin/ntfscmp
+/bin/ntfsfix
+/bin/ntfsinfo
+/bin/ntfsls
+%else
%{_bindir}/ntfscat
%{_bindir}/ntfscluster
%{_bindir}/ntfscmp
%{_bindir}/ntfsfix
%{_bindir}/ntfsinfo
%{_bindir}/ntfsls
+%endif
# Extras
+%if %{oldrhel}
+/bin/ntfsck
+/bin/ntfsdecrypt
+/bin/ntfsdump_logfile
+/bin/ntfsmftalloc
+/bin/ntfsmove
+/bin/ntfstruncate
+/bin/ntfswipe
+/sbin/fsck.ntfs
+/sbin/mkfs.ntfs
+/sbin/mkntfs
+/sbin/ntfsclone
+/sbin/ntfscp
+/sbin/ntfslabel
+/sbin/ntfsresize
+/sbin/ntfsundelete
+%else
%{_bindir}/ntfsck
%{_bindir}/ntfsdecrypt
%{_bindir}/ntfsdump_logfile
@@ -178,12 +287,19 @@ rm -rf %{buildroot}%{_defaultdocdir}/%{name}/README
%{_sbindir}/ntfslabel
%{_sbindir}/ntfsresize
%{_sbindir}/ntfsundelete
+%endif
%{_mandir}/man8/mkntfs.8*
%{_mandir}/man8/mkfs.ntfs.8*
%{_mandir}/man8/ntfs[^m][^o]*.8*
%exclude %{_mandir}/man8/ntfs-3g*
%changelog
+* Wed Nov 19 2014 Tom Callaway <spot at fedoraproject.org> - 2:2014.2.15-8
+- apply upstream patch to properly use fuse on older kernels
+
+* Mon Nov 17 2014 Tom Callaway <spot at fedoraproject.org> - 2:2014.2.15-7
+- old rhel (< 7) needs old pathing and hal file. CONDITIONALIZE ALL THE THINGS!
+
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2:2014.2.15-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
More information about the scm-commits
mailing list