Ticket #26739: spotlightfs-2.0.3,2.diff

File spotlightfs-2.0.3,2.diff, 4.4 KB (added by mklein-de (Michael Klein), 14 years ago)

Portfile patch

  • files/patch-writable-dirs.diff

     
    1 Index: Source/SpotlightFS.m
    2 ===================================================================
    3 --- Source/SpotlightFS.m        (.../tags/macfuse-0.4.0/filesystems-objc/SpotlightFS)   (revision 445)
    4 +++ Source/SpotlightFS.m        (.../trunk/filesystems-objc/SpotlightFS)        (revision 445)
    5 @@ -129,6 +129,25 @@
    6    return userCreatedFolders;
    7  }
    8  
    9 +// -isUserCreatedFolder:
    10 +//
    11 +// Returns YES if the specified folder is a user created folder. Also try
    12 +// prepending a leading slash to the user created folders, incase |path| starts
    13 +// with a slash.
    14 +//
    15 +- (BOOL)isUserCreatedFolder:(NSString *)path {
    16 +  NSArray *folders = [self userCreatedFolders];
    17 +  NSString *folder = nil;
    18 +  NSEnumerator *folderEnumerator = [folders objectEnumerator];
    19 +  while ((folder = [folderEnumerator nextObject])) {
    20 +    if ([folder isEqualToString:path])
    21 +      return YES;
    22 +    if ([[@"/" stringByAppendingPathComponent:folder] isEqualToString:path])
    23 +      return YES;
    24 +  }
    25 +  return NO;
    26 +}
    27 +
    28  // -setUserCreatedFolders:
    29  //
    30  // Sets the folder names to use for the top-level user-created folders.
    31 @@ -341,20 +360,27 @@
    32    return NO;
    33  }
    34  
    35 +// By default, directories are not writeable, with the notable exceptions below:
    36 +// - Slash is writable
    37 +// - User created directories in slash are writable
    38  - (NSDictionary *)fileAttributesAtPath:(NSString *)path {
    39    if (!path)
    40      return nil;
    41    
    42    NSMutableDictionary *attr = nil;
    43 +  int mode = 0500;
    44    
    45    NSString *pathdir = [path stringByDeletingLastPathComponent];
    46    NSString *smarter = [@"/" stringByAppendingString:kSmarterFolder];
    47    
    48 -  if ([pathdir isEqualToString:@"/"]
    49 -      || [pathdir isEqualToString:smarter]) {
    50 +  if ([pathdir isEqualToString:@"/"] || [pathdir isEqualToString:smarter]) {
    51      
    52 +    if ([path isEqualToString:@"/"] || [self isUserCreatedFolder:path]) {
    53 +      mode = 0700;
    54 +    }
    55 +   
    56      attr = [NSDictionary dictionaryWithObjectsAndKeys:
    57 -      [NSNumber numberWithInt:0500], NSFilePosixPermissions,
    58 +      [NSNumber numberWithInt:mode], NSFilePosixPermissions,
    59        [NSNumber numberWithInt:geteuid()], NSFileOwnerAccountID,
    60        [NSNumber numberWithInt:getegid()], NSFileGroupOwnerAccountID,
    61        [NSDate date], NSFileCreationDate,
    62 Index: Source/SpotlightFS.h
    63 ===================================================================
    64 --- Source/SpotlightFS.h        (.../tags/macfuse-0.4.0/filesystems-objc/SpotlightFS)   (revision 445)
    65 +++ Source/SpotlightFS.h        (.../trunk/filesystems-objc/SpotlightFS)        (revision 445)
    66 @@ -45,6 +45,10 @@
    67  //
    68  - (NSArray *)userCreatedFolders;
    69  
    70 +// Returns YES if |path| is a user created folder.
    71 +//
    72 +- (BOOL)isUserCreatedFolder:(NSString *)path;
    73 +
    74  // Sets the full user-created folders array.
    75  //
    76  - (void)setUserCreatedFolders:(NSArray *)folders;
  • Portfile

     
    44PortGroup xcode 1.0
    55
    66name                spotlightfs
    7 version             0.1.0
    8 revision            2
     7version             2.0.3,2
     8set svn_tag         [string map {, \\|} ${version}]
     9revision            0
    910categories          fuse
    1011platforms           macosx
    1112maintainers         nomaintainer
     
    1920
    2021homepage            http://code.google.com/p/macfuse/
    2122
    22 master_sites        macports macports:FUSEObjC:objc
    23 distfiles           SpotlightFS-${version}.tar.bz2 FUSEObjC-0.4.0.tar.bz2:objc
    24 worksrcdir          SpotlightFS
    25 checksums           SpotlightFS-${version}.tar.bz2 md5 102e6196d635ee87521e8b586844a77c \
    26                                                    sha1 e10322f6ea526b878d0b8ac21c51e1246f645959 \
    27                     FUSEObjC-0.4.0.tar.bz2 md5 9ac70a7faf748e04e4e0bf0c8856b7c5 \
    28                                            sha1 99752396411e3b44728436d15d6cb76bd1966e1f
     23fetch.type          svn
    2924
    30 # this patch needs to be removed next time there's a SpotlightFS release
    31 patchfiles          patch-writable-dirs.diff
     25svn.url             http://macfuse.googlecode.com/svn/tags/macfuse-${svn_tag}/filesystems-objc
     26worksrcdir          filesystems-objc/SpotlightFS/
    3227
    33 use_bzip2           yes
    34 
    35 livecheck.distname  SpotlightFS-(.*).dmg
    36 
    37 
    3828depends_lib         port:macfuse
    3929
    4030xcode.target            SpotlightFS