Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
beagle
bnc462763-tmp-files-not-deleted.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc462763-tmp-files-not-deleted.patch of Package beagle
Index: Util/FileSystem.cs =================================================================== --- Util/FileSystem.cs (revision 4896) +++ Util/FileSystem.cs (revision 4897) @@ -148,6 +148,19 @@ 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 { Index: beagled/Lucene.Net/Store/SimpleFSLockFactory.cs =================================================================== --- beagled/Lucene.Net/Store/SimpleFSLockFactory.cs (revision 4896) +++ beagled/Lucene.Net/Store/SimpleFSLockFactory.cs (revision 4897) @@ -260,13 +260,7 @@ 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); Index: beagled/TextCache.cs =================================================================== --- beagled/TextCache.cs (revision 4896) +++ beagled/TextCache.cs (revision 4897) @@ -380,7 +380,10 @@ 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; Index: BeagleClient/Indexable.cs =================================================================== --- BeagleClient/Indexable.cs (revision 4896) +++ BeagleClient/Indexable.cs (revision 4897) @@ -326,7 +326,7 @@ 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 @@ 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 @@ // 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 @@ // 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); Index: Filters/FilterArchive.cs =================================================================== --- Filters/FilterArchive.cs (revision 4898) +++ Filters/FilterArchive.cs (revision 4899) @@ -227,12 +227,17 @@ return null; string filename = FileSystem.GetTempFileName (extension); - FileStream file_stream = File.OpenWrite (filename); + FileStream file_stream = new FileStream (filename, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); // FileShare.ReadWrite needed for setting the mtime + // When we dump the contents of an indexable into a file, we + // expect to use it again soon. + FileAdvise.PreLoad (file_stream); + //Log.Debug ("Storing archive contents in {0}", filename); - - Mono.Unix.Native.Syscall.chmod (filename, (Mono.Unix.Native.FilePermissions) 384); // 384 is 0600 - + + File.SetLastWriteTimeUtc (filename, mtime); // change this before making read-only + Mono.Unix.Native.Syscall.chmod (filename, Mono.Unix.Native.FilePermissions.S_IRUSR); + BufferedStream buffered_stream = new BufferedStream (file_stream); byte [] buffer = new byte [8192]; @@ -286,14 +291,10 @@ buffered_stream.Close (); if (skip_file) { - File.Delete (filename); + FileSystem.PosixDelete (filename); return null; } - File.SetLastWriteTimeUtc (filename, mtime); - - Mono.Unix.Native.Syscall.chmod (filename, (Mono.Unix.Native.FilePermissions) 256); // 256 is 0400 - return filename; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor