rpms/gedit/devel gedit-2.15.5-copy-xattrs.patch, NONE, 1.1 gedit.spec, 1.91, 1.92

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Aug 10 20:03:40 UTC 2006


Author: rstrode

Update of /cvs/dist/rpms/gedit/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16341

Modified Files:
	gedit.spec 
Added Files:
	gedit-2.15.5-copy-xattrs.patch 
Log Message:
- Apply patch from James Antill to copy extended attributes over
  when saving files (bug 202099)


gedit-2.15.5-copy-xattrs.patch:
 configure.ac                        |    6 +++++
 configure.ac.xattrs                 |only
 gedit/gedit-document-saver.c        |   43 ++++++++++++++++++++++++++++++++++++
 gedit/gedit-document-saver.c.xattrs |only
 4 files changed, 49 insertions(+)

--- NEW FILE gedit-2.15.5-copy-xattrs.patch ---
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


Index: gedit.spec
===================================================================
RCS file: /cvs/dist/rpms/gedit/devel/gedit.spec,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- gedit.spec	4 Aug 2006 03:26:48 -0000	1.91
+++ gedit.spec	10 Aug 2006 20:03:37 -0000	1.92
@@ -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 @@
 # 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 @@
 
 %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 @@
 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 @@
 %{_datadir}/gtk-doc/html/gedit/
 
 %changelog
+* Thu Aug 10 2006 Ray Strode <rstrode at 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 at 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 at redhat.com> - 1:2.15.4-1
 - Update to 2.15.4




More information about the fedora-cvs-commits mailing list