From 9532a0129c66833fc4d7515e53ec738f9d257aa4 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 8 Mar 2016 13:09:25 +0100 Subject: [PATCH 1/2] Correct error message to match actual behavior --- src/Composer/Command/SelfUpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 030c6bebd..6aaa2fa5c 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -281,7 +281,7 @@ TAGSPUBKEY $io = $this->getIO(); $io->writeError(sprintf("Rolling back to version %s.", $rollbackVersion)); if ($err = $this->setLocalPhar($localFilename, $oldFile)) { - $io->writeError('The backup file was corrupted ('.$err->getMessage().') and has been removed.'); + $io->writeError('The backup file was corrupted ('.$err->getMessage().').'); return 1; } From f7757c606dc26de61b78af40c460fb699275dd63 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 8 Mar 2016 13:10:11 +0100 Subject: [PATCH 2/2] Move instruction to delete corrupted file --- src/Composer/Command/SelfUpdateCommand.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 6aaa2fa5c..a5590164f 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -203,6 +203,7 @@ TAGSPUBKEY } if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) { + @unlink($tempFilename); $io->writeError('The file is corrupted ('.$err->getMessage().').'); $io->writeError('Please re-run the self-update command to try again.'); @@ -312,9 +313,6 @@ TAGSPUBKEY rename($newFilename, $localFilename); } catch (\Exception $e) { - if ($backupTarget) { - @unlink($newFilename); - } if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) { throw $e; }