drush_delete_dir() function deletes symlinked files. I think it isn't normal behavior for directory deletion function. Deleting symlinked files is very rare case and potentially dangerous operation.

I think that drush_delete_dir() should simply unlink symbolic links by default and delete symlinked files only if special argument provided.

Members fund testing for the Drupal project. Drupal Association Learn more


danylevskyi’s picture

Title: drush_delete_dir() deletes symlinked files » Here is a patch
Status: Active » Needs review
1.25 KB

Here is a patch

danylevskyi’s picture

Title: Here is a patch » drush_delete_dir() function deletes symlinked files

fixing title...

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Needs review » Reviewed & tested by the community

This seems right to me. Works with all of our test cases, and should do the right thing for most normal uses. I can't think of an instance where someone might be depending on the current behavior -- although it certainly is possible that someone might be, I tend to think that the behavior is better (less surprising) with the patch in #1 applied.

As implemented, there is no way to tell Drush that it should destructively, recursively follow symlinks. I don't know if there's a usecase for that (c.f. instances where someone might be depending on the current behavior).

moshe weitzman’s picture

Assigned: Unassigned » jonhattan

hopefully jonhattan can take a quick look. if he is not available, greg can commit this in a couple days.

jonhattan’s picture

Status: Reviewed & tested by the community » Fixed

It seems right. Indeed the behaviour without this patch is a bug to me.

Committed to 6.x and 5.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.