bug-gnustep
[Top][All Lists]
Advanced

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

[bug #39313] NSFileManager copyItemAtPath:toPath:error: has trouble copy


From: Michael Silva
Subject: [bug #39313] NSFileManager copyItemAtPath:toPath:error: has trouble copying directories with different permissions
Date: Fri, 21 Jun 2013 20:09:33 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17

URL:
  <http://savannah.gnu.org/bugs/?39313>

                 Summary: NSFileManager copyItemAtPath:toPath:error: has
trouble copying directories with different permissions
                 Project: GNUstep
            Submitted by: msilvax28
            Submitted on: Fri 21 Jun 2013 08:09:32 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Running gnustep-base v1.24.4 on x86 Debian Wheezy.

copyItemsAtPath:toPath:error: fails if the source path contains subfolders and
those subfolder have user/group permissions that 'exceed' the permissions of
the user running the copyItems command.

Simple example:

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv_p[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSError *error = nil;

    [[NSFileManager defaultManager]
copyItemAtPath:@"/usr/local/lib/GNUstep/Bundles" toPath:[@"~/Bundles"
stringByExpandingTildeInPath] error:&error];
    if(error)
    {
        NSLog(@"%@", error);
    }
    
    [pool release];
    
    return 0;
}


When first run this code will error:

2013-06-21 16:05:03.099 test[7216] Unable to change NSFileGroupOwnerAccountID
to '50' - Operation not permitted


subsequent runs will error:

2013-06-21 16:07:15.769 test[7279] [NSError-initWithDomain:code:userInfo:]
with nil domain


It seems that -changeFileAttributes:atPath: is used to try to 'restore' the
attributes of the copied sub-folder to that of the original subfolder.  In my
example the subfolder is owned by root/staff, and my user is not a member of
staff.

The subfolder is still readable by me. 

Should NSFileManager really error if it can't restore the user and/or group? 
The files and folders have been copied and assigned to the user already.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39313>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]