bugGNUstep - Bugs: bug #51592, -[NSFileManager...

Group
 
 

bug #51592: -[NSFileManager copyItemAtPath:toPath:error:] should not raise exceptions

Submitter:  Larry Campbell <lcampbel>
Submitted:  Thu 27 Jul 2017 03:30:08 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 02 Jan 2018 12:49:52 PM UTC, comment #2: 

Applied Gtraham's fix.

Richard Frith-Macdonald <CaS>
Group Member
Sun 26 Nov 2017 10:17:06 AM UTC, comment #1: 

I created a pull request to address this: https://github.com/gnustep/libs-base/pull/16

Graham Lee <leeg>
Thu 27 Jul 2017 03:30:08 PM UTC, original submission:  

At the top of _copyFile:toFile:handler:, we have this:

  /* Assumes source is a file and exists! */
  NSAssert1 ([self fileExistsAtPath: source],
    @"source file '%@' does not exist!", source);

  attributes = [self fileAttributesAtPath: source traverseLink: NO];
  NSAssert1 (attributes, @"could not get the attributes for file '%@'",
    source);

However, any other error causes the handler (if any) to be called and NO to be returned. I think these asserts should be replaced by something like:

if (!exists)
      return [self _proceedAccordingToHandler: handler
                                     forError: @"source file does not exist"
                                       inPath: source
                                     fromPath: source
                                       toPath: destination];

Larry Campbell <lcampbel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by leeg (Posted a comment)
  • -email is unavailable- added by FredKiefer (Updated the item)
  • -email is unavailable- added by lcampbel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-02 CaS StatusNone Fixed
        Open/ClosedOpen Closed
    2017-08-24 FredKiefer CategoryNone Base/Foundation
        Item GroupNone Bug

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code