- Apply patch from James Antill to copy extended attributes over when
saving files (bug 202099)
This commit is contained in:
parent
fe9c1aef43
commit
c0fc41fe02
92
gedit-2.15.5-copy-xattrs.patch
Normal file
92
gedit-2.15.5-copy-xattrs.patch
Normal file
@ -0,0 +1,92 @@
|
||||
diff -rup gedit-2.15.5-orig/configure.ac gedit-2.15.5/configure.ac
|
||||
--- gedit-2.15.5-orig/configure.ac 2006-08-10 12:25:58.000000000 -0400
|
||||
+++ gedit-2.15.5/configure.ac 2006-08-10 15:16:02.000000000 -0400
|
||||
@@ -87,6 +87,12 @@ AC_SUBST(PSPELL_LIBS)
|
||||
|
||||
|
||||
dnl ================================================================
|
||||
+dnl libattr checks
|
||||
+dnl ================================================================
|
||||
+
|
||||
+AC_CHECK_LIB(attr, attr_copy_fd)
|
||||
+
|
||||
+dnl ================================================================
|
||||
dnl Start of pkg-config checks
|
||||
dnl ================================================================
|
||||
|
||||
Only in gedit-2.15.5: configure.ac.xattrs
|
||||
diff -rup gedit-2.15.5-orig/gedit/gedit-document-saver.c gedit-2.15.5/gedit/gedit-document-saver.c
|
||||
--- gedit-2.15.5-orig/gedit/gedit-document-saver.c 2006-05-18 18:55:16.000000000 -0400
|
||||
+++ gedit-2.15.5/gedit/gedit-document-saver.c 2006-08-10 15:16:08.000000000 -0400
|
||||
@@ -42,6 +42,12 @@
|
||||
#include <glib/gfileutils.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
||||
+#ifdef HAVE_LIBATTR
|
||||
+# include <attr/libattr.h>
|
||||
+#else
|
||||
+# define attr_copy_fd(x1, x2, x3, x4, x5, x6) (errno = ENOSYS, -1)
|
||||
+#endif
|
||||
+
|
||||
#include "gedit-document-saver.h"
|
||||
#include "gedit-debug.h"
|
||||
#include "gedit-convert.h"
|
||||
@@ -457,6 +463,15 @@ get_slow_mime_type (const char *text_uri
|
||||
|
||||
/* ----------- local files ----------- */
|
||||
|
||||
+#ifdef HAVE_LIBATTR
|
||||
+static int all_xattrs(const char *xattr, struct error_context *err)
|
||||
+{ /* Save everything: user/root xattrs, SELinux, ACLs. */
|
||||
+ (void)xattr;
|
||||
+ (void)err;
|
||||
+ return 1;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static gboolean
|
||||
save_existing_local_file (GeditDocumentSaver *saver)
|
||||
{
|
||||
@@ -597,6 +612,22 @@ save_existing_local_file (GeditDocumentS
|
||||
goto fallback_strategy;
|
||||
}
|
||||
|
||||
+ /* copy the xattrs, like user.mime_type, over. Also ACLs and
|
||||
+ SELinux context. */
|
||||
+ if ((attr_copy_fd (saver->priv->local_path, saver->priv->fd,
|
||||
+ tmp_filename, tmpfd,
|
||||
+ all_xattrs, NULL) == -1) &&
|
||||
+ (errno != EOPNOTSUPP) && (errno != ENOSYS))
|
||||
+ {
|
||||
+ gedit_debug_message (DEBUG_SAVER, "could not set xattrs");
|
||||
+
|
||||
+ close (tmpfd);
|
||||
+ unlink (tmp_filename);
|
||||
+ g_free (tmp_filename);
|
||||
+
|
||||
+ goto fallback_strategy;
|
||||
+ }
|
||||
+
|
||||
if (!write_document_contents (tmpfd,
|
||||
GTK_TEXT_BUFFER (saver->priv->document),
|
||||
saver->priv->encoding,
|
||||
@@ -751,6 +782,18 @@ save_existing_local_file (GeditDocumentS
|
||||
}
|
||||
}
|
||||
|
||||
+ /* copy the xattrs, like user.mime_type, over. Also ACLs and
|
||||
+ SELinux context. */
|
||||
+ if ((attr_copy_fd (saver->priv->local_path, saver->priv->fd,
|
||||
+ backup_filename, bfd,
|
||||
+ all_xattrs, NULL) == -1) &&
|
||||
+ (errno != EOPNOTSUPP) && (errno != ENOSYS))
|
||||
+ {
|
||||
+ gedit_debug_message (DEBUG_SAVER, "could not set xattrs");
|
||||
+
|
||||
+ goto out; /* is it better to save or not save? */
|
||||
+ }
|
||||
+
|
||||
if (!copy_file_data (saver->priv->fd, bfd, NULL))
|
||||
{
|
||||
gedit_debug_message (DEBUG_SAVER, "could not copy data into the backup");
|
||||
Only in gedit-2.15.5/gedit: gedit-document-saver.c.xattrs
|
||||
14
gedit.spec
14
gedit.spec
@ -17,7 +17,7 @@
|
||||
Summary: gEdit is a small but powerful text editor for GNOME.
|
||||
Name: gedit
|
||||
Version: 2.15.5
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 1
|
||||
License: GPL
|
||||
Group: Applications/Editors
|
||||
@ -49,6 +49,9 @@ Patch2: gedit-2.15.1-python.patch
|
||||
# gtk_widget_show()
|
||||
Patch3: gedit-2.15.1-bgo-341055-workaround.patch
|
||||
|
||||
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=202099
|
||||
Patch4: gedit-2.15.5-copy-xattrs.patch
|
||||
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: pango-devel >= %{pango_version}
|
||||
BuildRequires: gtk2-devel >= %{gtk2_version}
|
||||
@ -110,6 +113,7 @@ tar xzf %{SOURCE1}
|
||||
|
||||
%patch2 -p1 -b .python
|
||||
%patch3 -p1 -b .bgo-341055-workaround
|
||||
%patch4 -p1 -b .copy-xattrs
|
||||
|
||||
%build
|
||||
%configure --disable-scrollkeeper --disable-gtk-doc --enable-python
|
||||
@ -119,7 +123,7 @@ make
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
|
||||
%makeinstall
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
|
||||
|
||||
desktop-file-install --vendor gnome --delete-original \
|
||||
@ -186,8 +190,12 @@ fi
|
||||
%{_datadir}/gtk-doc/html/gedit/
|
||||
|
||||
%changelog
|
||||
* Thu Aug 10 2006 Ray Strode <rstrode@redhat.com> - 1:2.15.5-2.fc6
|
||||
- Apply patch from James Antill to copy extended attributes over
|
||||
when saving files (bug 202099)
|
||||
|
||||
* Thu Aug 3 2006 Matthias Clasen <mclasen@redhat.com> - 1:2.15.5-1.fc6
|
||||
- Update to 2.15.6
|
||||
- Update to 2.15.5
|
||||
|
||||
* Wed Jul 12 2006 Matthias Clasen <mclasen@redhat.com> - 1:2.15.4-1
|
||||
- Update to 2.15.4
|
||||
|
||||
Loading…
Reference in New Issue
Block a user