Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#42047 closed defect (fixed)

proc delete should not complain if file does not exist

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone: MacPorts 2.3.0
Component: base Version: 2.2.1
Keywords: Cc: cooljeanius (Eric Gallager)
Port:

Description

The documentation for Tcl's "file delete" says "Trying to delete a non-existent file is not considered an error." MacPorts' "delete" is supposed to be a smarter "file delete", but it does consider attempting to delete a non-existent file to be an error.

This was not always the case. Originally, proc delete was implemented in r18144 using rm -rf (which does not complain about non-existent items) because it was faster and more reliable than using "file delete".

In r22007 it was rewritten to use Tcl code, traversing each directory and deleting each file individually. The comment was rewritten to specify that "file delete" doesn't handle deleting directories properly until Tiger.

In r24435 it was reimplemented using proc fs-traverse, but there was no preceding check for whether the item being deleted is a directory or if it even exists. fs-traverse quite rightly complains when asked to traverse a non-existent directory.

Now that MacPorts base has for years already required at least Tiger, we can remove all the code and make it simply call "file delete -force" directly.

Change History (3)

comment:1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

comment:2 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:3 Changed 10 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.3.0
Note: See TracTickets for help on using tickets.