gparted r826 - in trunk: . po src



Author: gedakc
Date: Mon Apr 21 15:22:00 2008
New Revision: 826
URL: http://svn.gnome.org/viewvc/gparted?rev=826&view=rev

Log:
Fixed bug #324220 with the following changes:
- Removed gparted-disable-automount.fdi handling.
- Renamed gparted binary to gpartedbin to permit a calling script to be named gparted.
- Added new calling script gparted.in to permit using hal-lock to acuiqre device locks to prevent automounting while executing gpartedbin.
- Renamed gparted.desktop.in to gparted.desktop.in.in to permit parsing installdir.

Added:
   trunk/gparted.desktop.in.in
      - copied, changed from r823, /trunk/gparted.desktop.in
   trunk/gparted.in   (contents, props changed)
   trunk/po/POTFILES.skip
Removed:
   trunk/gparted.desktop.in
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/src/GParted_Core.cc
   trunk/src/Makefile.am

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Mon Apr 21 15:22:00 2008
@@ -2,18 +2,32 @@
 
 @INTLTOOL_DESKTOP_RULE@
 
+DESKTOP_IN_IN_FILES = gparted.desktop.in.in
 DESKTOP_IN_FILES = gparted.desktop.in
 DESKTOP_FILES =$(DESKTOP_IN_FILES:.desktop.in=.desktop)
 
 desktopdir = $(datadir)/applications
 desktop_DATA = $(DESKTOP_FILES)
 
+sbin_SCRIPTS = gparted
+CLEANFILES = $(sbin_SCRIPTS) $(DESKTOP_IN_FILES)
+
+do_subst = sed -e 's,[ ]installdir[@],$(sbindir),g'
+
+gparted.desktop.in:  gparted.desktop.in.in Makefile
+	$(do_subst) < $(srcdir)/gparted.desktop.in.in > gparted.desktop.in
+
+gparted:  gparted.in Makefile
+	$(do_subst) < $(srcdir)/gparted.in > gparted
+	chmod +x gparted
+
 EXTRA_DIST =			\
-	$(DESKTOP_IN_FILES)	\
+	$(DESKTOP_IN_IN_FILES)	\
 	$(DESKTOP_FILES)	\
 	intltool-extract.in  	\
 	intltool-merge.in	\
-	intltool-update.in
+	intltool-update.in	\
+	gparted.in
 
 DISTCLEANFILES =		\
 	intltool-extract	\

Copied: trunk/gparted.desktop.in.in (from r823, /trunk/gparted.desktop.in)
==============================================================================
--- /trunk/gparted.desktop.in	(original)
+++ trunk/gparted.desktop.in.in	Mon Apr 21 15:22:00 2008
@@ -1,7 +1,7 @@
 [Desktop Entry]
 _Name=GParted Partition Editor
 _Comment=Create, reorganize, and delete partitions
-Exec=gksu gparted
+Exec=gksu @installdir@/gparted
 Icon=gparted
 Terminal=false
 Type=Application

Added: trunk/gparted.in
==============================================================================
--- (empty file)
+++ trunk/gparted.in	Mon Apr 21 15:22:00 2008
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+#  Purpose:  Acquire device locks prior to running gparted.
+#            This is to prevent devices from being automounted.
+#            File system problems can occur if devices are mounted
+#            prior to the completion of GParted's operations.
+#            See GParted bug #324220
+#            http://bugzilla.gnome.org/show_bug.cgi?id=324220
+#
+#
+#  Following is a quote from HAL 0.5.10 Specification.
+#  http://people.freedesktop.org/~david/hal-spec/hal-spec.html#locking-guidelines
+#
+#  In order to prevent HAL-based automounters from mounting partitions
+#  that are being prepared, applications that access block devices
+#  directly (and pokes the kernel to reload the partitioning table)
+#  should lock out automounters by either a) obtaining the
+#  org.freedesktop.Hal.Device.Storage lock on each drive being processed;
+#  or b) obtaining the global org.freedesktop.Hal.Device.Storage lock.
+#
+
+hal-lock --interface org.freedeskdesktop.Hal.Device.Storage --exclusive \
+	--run @installdir@/gpartedbin $*

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Mon Apr 21 15:22:00 2008
@@ -1,6 +1,6 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
-gparted.desktop.in
+gparted.desktop.in.in
 src/Dialog_Base_Partition.cc
 src/Dialog_Disklabel.cc
 src/Dialog_Partition_Copy.cc

Added: trunk/po/POTFILES.skip
==============================================================================
--- (empty file)
+++ trunk/po/POTFILES.skip	Mon Apr 21 15:22:00 2008
@@ -0,0 +1,4 @@
+# List of source files containing translatable strings, but should be skipped.
+# Please keep this file sorted alphabetically.
+gparted.desktop.in
+

Modified: trunk/src/GParted_Core.cc
==============================================================================
--- trunk/src/GParted_Core.cc	(original)
+++ trunk/src/GParted_Core.cc	Mon Apr 21 15:22:00 2008
@@ -39,8 +39,6 @@
 #include "../include/ufs.h"
 
 #include <cerrno>
-#include <cstdio>
-#include <csignal>
 #include <sys/statvfs.h>	
 
 std::vector<Glib::ustring> libparted_messages ; //see ped_exception_handler()
@@ -48,13 +46,6 @@
 namespace GParted
 {
 
-// Clean up the fdi when terminating
-void sig_fdi_cleanup( int signum )
-{
-	remove( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" );
-	raise( signum );
-}
-
 GParted_Core::GParted_Core() 
 {
 	lp_device = NULL ;
@@ -64,44 +55,6 @@
 
 	ped_exception_set_handler( ped_exception_handler ) ; 
 
-	//make sure that the fdi is cleaned up on all but the most forceful
-	//program exits
-	struct sigaction sa;
-	sa.sa_handler = sig_fdi_cleanup;
-	sigemptyset( &sa.sa_mask );
-	sa.sa_flags = SA_RESETHAND;
-	if( sigaction( SIGHUP, &sa, NULL ) == -1 ||
-	    sigaction( SIGINT, &sa, NULL ) == -1 ||
-	    sigaction( SIGQUIT, &sa, NULL ) == -1 ||
-	    sigaction( SIGILL, &sa, NULL ) == -1 ||
-	    sigaction( SIGABRT, &sa, NULL ) == -1 ||
-	    sigaction( SIGFPE, &sa, NULL ) == -1 ||
-	    sigaction( SIGSEGV, &sa, NULL ) == -1 ||
-	    sigaction( SIGPIPE, &sa, NULL ) == -1 ||
-	    sigaction( SIGALRM, &sa, NULL ) == -1 ||
-	    sigaction( SIGTERM, &sa, NULL ) == -1 ||
-	    sigaction( SIGUSR1, &sa, NULL ) == -1 ||
-	    sigaction( SIGUSR2, &sa, NULL ) == -1 ||
-	    sigaction( SIGBUS, &sa, NULL ) == -1 ||
-	    sigaction( SIGXCPU, &sa, NULL ) == -1 ||
-	    sigaction( SIGXFSZ, &sa, NULL ) == -1 )
-		perror( "Could not set signal handler" );
-	
-	//disable automount //FIXME: temporary hack, till i find a better solution...
-	std::ofstream fdi_file( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" ) ;
-	if ( fdi_file )
-	{
-		fdi_file << "<deviceinfo version='0.2'>" ;
-		fdi_file << "<device>" ;
-		fdi_file << "<match key='storage.hotpluggable' bool='true'>" ;
-		fdi_file << "<merge key='storage.automount_enabled_hint' type='bool'>false</merge>" ;
-		fdi_file << "</match>" ;
-		fdi_file << "</device>" ;
-		fdi_file << "</deviceinfo>" ;
-
-		fdi_file .close() ;
-	}	
-
 	//get valid flags ...
 	for ( PedPartitionFlag flag = ped_partition_flag_next( static_cast<PedPartitionFlag>( NULL ) ) ;
 	      flag ;
@@ -2371,9 +2324,6 @@
 {
 	if ( p_filesystem )
 		delete p_filesystem ;
-
-	//remove .fdi file..
-	remove( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" ) ;
 }
 	
 } //GParted

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Apr 21 15:22:00 2008
@@ -7,9 +7,9 @@
 
 AM_CXXFLAGS = -Wall	
 
-sbin_PROGRAMS = gparted
+sbin_PROGRAMS = gpartedbin
 
-gparted_SOURCES = \
+gpartedbin_SOURCES = \
 	Device.cc			\
 	Dialog_Base_Partition.cc	\
 	Dialog_Disklabel.cc 		\
@@ -55,7 +55,7 @@
 	ufs.cc				\
 	xfs.cc
 	
-gparted_LDFLAGS = -lparted -lgthread-2.0 
+gpartedbin_LDFLAGS = -lparted -lgthread-2.0 
 
-gparted_LDADD = $(GTKMM_LIBS)
+gpartedbin_LDADD = $(GTKMM_LIBS)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]