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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Fred Kiefer-3
URL:
  <http://savannah.gnu.org/bugs/?51592>

                 Summary: -[NSFileManager copyItemAtPath:toPath:error:] should
not raise exceptions
                 Project: GNUstep
            Submitted by: lcampbel
            Submitted on: Thu 27 Jul 2017 03:30:08 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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];





    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

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

Fred Kiefer-3
Update of bug #51592 (project gnustep):

                Category:                    None => Base/Foundation        
              Item Group:                    None => Bug                    


    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

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

Fred Kiefer-3
Follow-up Comment #1, bug #51592 (project gnustep):

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

    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-gnustep
Reply | Threaded
Open this post in threaded view
|

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

Fred Kiefer-3
Update of bug #51592 (project gnustep):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #2:

Applied Gtraham's fix.

    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-gnustep