From c0fc41fe02648bcf50517b899dd5be15052edaef Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 10 Aug 2006 20:03:37 +0000 Subject: [PATCH] - Apply patch from James Antill to copy extended attributes over when saving files (bug 202099) --- gedit-2.15.5-copy-xattrs.patch | 92 ++++++++++++++++++++++++++++++++++ gedit.spec | 14 ++++-- 2 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 gedit-2.15.5-copy-xattrs.patch diff --git a/gedit-2.15.5-copy-xattrs.patch b/gedit-2.15.5-copy-xattrs.patch new file mode 100644 index 0000000..93f0cf3 --- /dev/null +++ b/gedit-2.15.5-copy-xattrs.patch @@ -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 + #include + ++#ifdef HAVE_LIBATTR ++# include ++#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 diff --git a/gedit.spec b/gedit.spec index 1e1ff34..08b4037 100644 --- a/gedit.spec +++ b/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 - 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 - 1:2.15.5-1.fc6 -- Update to 2.15.6 +- Update to 2.15.5 * Wed Jul 12 2006 Matthias Clasen - 1:2.15.4-1 - Update to 2.15.4