bugGNUstep - Bugs: bug #39313, NSFileManager...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39313: NSFileManager copyItemAtPath:toPath:error: has trouble copying directories with different permissions

Submitted by:  Michael Silva <msilvax28>
Submitted on:  Fri 21 Jun 2013 08:09:32 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: In Test

Thu 27 Jun 2013 06:47:16 AM UTC, comment #3:

Should be fixed in trunk now ... please give it a try.

Richard Frith-Macdonald <CaS>
Project Member
Sun 23 Jun 2013 06:10:30 AM UTC, comment #2:

Yep ... ran a test on OSX, and there it does not seem to attempt to copy attributes.

Richard Frith-Macdonald <CaS>
Project Member
Fri 21 Jun 2013 08:37:03 PM UTC, comment #1:

In looking at it some more, it seems that _copyPath:toPath:handler perhaps should not try to set the source folder attributes on the new destination folder?

Michael Silva <msilvax28>
Fri 21 Jun 2013 08:09:32 PM UTC, original submission:

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.

Michael Silva <msilvax28>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by msilvax28 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Jun 2013 06:47:16 AM UTCCaSStatusNone=>Fixed
      Assigned toCaS=>None
      Open/ClosedAnalyzed=>In Test
    Sun 23 Jun 2013 06:10:30 AM UTCCaSAssigned toNone=>CaS
      Open/ClosedOpen=>Analyzed

    Back to the top


    Powered by Savane 3.1-cleanup1