Drush doesn't cleanup temporary files created with drush_save_data_to_temp_file() anymore. For a reason that is unclear to me, the drush_register_file_dor_delettion function isn't called anymore in Drush 5.x.

Even in Drush 4, where the function is called properly, if the script is interrupted halfway, the tempfile is not deleted.

I noticed this while working on #671906: mysql credentials leak in drush sqlc.

Comments

greg.1.anderson’s picture

Status: Active » Postponed (maintainer needs more info)

Really? I added a drush_log to _drush_delete_registered_files(), and observed that it was getting called, and the temp files for sql-sync were being deleted. Perhaps there are specific conditions when the shutdown function is not being called?

anarcat’s picture

Title: Drush doesn't clean up temporary files » Drush doesn't clean up temporary files if interrupted
Status: Postponed (maintainer needs more info) » Active

Right, I was confused by the fact that the register moved to *tempnam()...

Regardless, the "register_shutdown" functions never get called if PHP gets interrupted (control-c), so yes, this still stands. At the very least I could reproduce this with Drush 4 and the patch in #671906: mysql credentials leak in drush sqlc, by running drush sqlc and interrupting it after the patch is applied.

greg.1.anderson’s picture

Yea, I wasn't checking the interrupted case. We could take care of that with a call to pcntl-signal.

jonhattan’s picture

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.

greg.1.anderson’s picture

Issue summary: View changes

add source