rpms/beagle/F-10 beagle-0.3.8-tmp-permissions.patch,1.1,1.2

Adel Gadllah drago01 at fedoraproject.org
Sun Dec 28 14:42:25 UTC 2008


Author: drago01

Update of /cvs/pkgs/rpms/beagle/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7360

Modified Files:
	beagle-0.3.8-tmp-permissions.patch 
Log Message:
backport all required changes

beagle-0.3.8-tmp-permissions.patch:

Index: beagle-0.3.8-tmp-permissions.patch
===================================================================
RCS file: /cvs/pkgs/rpms/beagle/F-10/beagle-0.3.8-tmp-permissions.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- beagle-0.3.8-tmp-permissions.patch	28 Dec 2008 14:30:23 -0000	1.1
+++ beagle-0.3.8-tmp-permissions.patch	28 Dec 2008 14:41:55 -0000	1.2
@@ -1,3 +1,75 @@
+diff -upNr beagle-0.3.8.orign/BeagleClient/Indexable.cs beagle-0.3.8/BeagleClient/Indexable.cs
+--- beagle-0.3.8.orign/BeagleClient/Indexable.cs	2008-04-26 04:47:26.000000000 +0200
++++ beagle-0.3.8/BeagleClient/Indexable.cs	2008-12-28 15:41:40.000000000 +0100
+@@ -326,7 +326,7 @@ namespace Beagle {
+ 						Logger.Log.Debug ("Cleaning up {0} ({1})", contentUri.LocalPath, Uri);
+ 
+ 					try {
+-						File.Delete (contentUri.LocalPath);
++						FileSystem.PosixDelete (contentUri.LocalPath);
+ 					} catch { 
+ 						// It might be gone already, so catch the exception.
+ 					}
+@@ -339,7 +339,7 @@ namespace Beagle {
+ 						Logger.Log.Debug ("Cleaning up {0} ({1})", hotContentUri.LocalPath, Uri);
+ 
+ 					try {
+-						File.Delete (hotContentUri.LocalPath);
++						FileSystem.PosixDelete (hotContentUri.LocalPath);
+ 					} catch {
+ 						// Ditto
+ 					}
+@@ -635,7 +635,7 @@ namespace Beagle {
+ 			// Make sure the temporary file is only readable by the owner.
+ 			// FIXME: There is probably a race here.  Could some malicious program
+ 			// do something to the file between creation and the chmod?
+-			Mono.Unix.Native.Syscall.chmod (filename, (Mono.Unix.Native.FilePermissions) 256);
++			Mono.Unix.Native.Syscall.chmod (filename, Mono.Unix.Native.FilePermissions.S_IRUSR);
+ 
+ 			BufferedStream bufferedStream = new BufferedStream (fileStream);
+ 			StreamWriter writer = new StreamWriter (bufferedStream);
+@@ -671,7 +671,7 @@ namespace Beagle {
+ 			// Make sure the temporary file is only readable by the owner.
+ 			// FIXME: There is probably a race here.  Could some malicious program
+ 			// do something to the file between creation and the chmod?
+-			Mono.Unix.Native.Syscall.chmod (filename, (Mono.Unix.Native.FilePermissions) 256);
++			Mono.Unix.Native.Syscall.chmod (filename, Mono.Unix.Native.FilePermissions.S_IRUSR);
+ 
+ 			BufferedStream bufferedStream = new BufferedStream (fileStream);
+ 
+diff -upNr beagle-0.3.8.orign/beagled/Lucene.Net/Store/SimpleFSLockFactory.cs beagle-0.3.8/beagled/Lucene.Net/Store/SimpleFSLockFactory.cs
+--- beagle-0.3.8.orign/beagled/Lucene.Net/Store/SimpleFSLockFactory.cs	2008-03-12 02:49:33.000000000 +0100
++++ beagle-0.3.8/beagled/Lucene.Net/Store/SimpleFSLockFactory.cs	2008-12-28 15:41:40.000000000 +0100
+@@ -260,13 +260,7 @@ namespace Lucene.Net.Store
+ 		
+ 		public override void  Release()
+ 		{
+-			int fd = Mono.Unix.Native.Syscall.unlink (
+-		    	    	lockFile.FullName);
+-		    	if (fd == -1)
+-				throw new System.IO.IOException (
+-					"Could not release lock file: "
+-					+ Mono.Unix.Native.Stdlib.strerror (Mono.Unix.Native.Stdlib.GetLastError ()
+-				));
++			Beagle.Util.FileSystem.PosixDelete (lockFile.FullName);
+ 
+ 			if (System.IO.File.Exists(lockFile.FullName)) {
+ 				Beagle.Util.Logger.Log.Warn ("Release didnt delete lockfile {0}.", lockFile.FullName);
+diff -upNr beagle-0.3.8.orign/beagled/TextCache.cs beagle-0.3.8/beagled/TextCache.cs
+--- beagle-0.3.8.orign/beagled/TextCache.cs	2008-04-26 04:47:26.000000000 +0200
++++ beagle-0.3.8/beagled/TextCache.cs	2008-12-28 15:41:40.000000000 +0100
+@@ -380,7 +380,10 @@ namespace Beagle.Daemon {
+ 			
+ 				if (! world_readable) {
+ 					// Make files only readable by the owner.
+-					Mono.Unix.Native.Syscall.chmod (path, (Mono.Unix.Native.FilePermissions) 384);
++					Mono.Unix.Native.Syscall.chmod (
++						path,
++						Mono.Unix.Native.FilePermissions.S_IRUSR |
++						Mono.Unix.Native.FilePermissions.S_IWUSR);
+ 				}
+ 
+ 				stream = file_stream;
 diff -upNr beagle-0.3.8.orign/Filters/FilterArchive.cs beagle-0.3.8/Filters/FilterArchive.cs
 --- beagle-0.3.8.orign/Filters/FilterArchive.cs	2008-06-12 02:20:07.000000000 +0200
 +++ beagle-0.3.8/Filters/FilterArchive.cs	2008-12-28 15:28:54.000000000 +0100
@@ -39,3 +111,26 @@
  			return filename;
  		}
  
+diff -upNr beagle-0.3.8.orign/Util/FileSystem.cs beagle-0.3.8/Util/FileSystem.cs
+--- beagle-0.3.8.orign/Util/FileSystem.cs	2007-11-27 02:49:59.000000000 +0100
++++ beagle-0.3.8/Util/FileSystem.cs	2008-12-28 15:41:40.000000000 +0100
+@@ -148,6 +148,19 @@ namespace Beagle.Util {
+                         return path;
+                 }
+ 
++		// Windows (and hence .Net File.Delete) requires write
++		// permission on a file to delete it. This is different from
++		// the POSIX behaviour and works against our readonly
++		// tmp files.
++		public static void PosixDelete (string path)
++		{
++			int ret = Mono.Unix.Native.Syscall.unlink (path);
++		    	if (ret == -1)
++				throw new System.IO.IOException (String.Format (
++					    "Delete failed for {0}: {1}",
++					    path,
++					    Mono.Unix.Native.Stdlib.strerror (Mono.Unix.Native.Stdlib.GetLastError ())));
++		}
+ 	}
+ 
+ 	public class NoSpaceException : Exception {




More information about the fedora-extras-commits mailing list