com web/rmtools: Workaround issue where files can't be deleted because of security scan: include/Branch.php
| From: | Anatol Belski | Date: | Wed, 20 Sep 2017 10:55:21 +0000 |
| Subject: | com web/rmtools: Workaround issue where files can't be deleted because of security scan: include/Branch.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26418@lists.php.net to get a copy of this message | ||
Commit: dcf582032671c3333828fb24e54bcdf977cfecfa
Author: Anatol Belski <ab@php.net> Wed, 20 Sep 2017 12:55:21 +0200
Parents: 073975a5a8e1401cbb21e0d6a1744816d4cd9042
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=dcf582032671c3333828fb24e54bcdf977cfecfa
Log:
Workaround issue where files can't be deleted because of security scan
Changed paths:
M include/Branch.php
Diff:
diff --git a/include/Branch.php b/include/Branch.php
index 323e16c..b8dd6a1 100644
--- a/include/Branch.php
+++ b/include/Branch.php
@@ -249,6 +249,10 @@ class Branch {
}
elseif ($is_zip === true) {
$extract_dir = $build_dir . DIRECTORY_SEPARATOR . "$build_type-$rev_name-tmp-unzip";
+ while(is_dir($extract_dir)) {
+ rmdir_rf($extract_dir);
+ $extract_dir = $extract_dir . "-" . rand(0, 9);
+ }
if (true !== mkdir($extract_dir)) {
throw new \Exception("Could not create temporary exctract dir under
'$extract_dir'.");
}
@@ -263,6 +267,10 @@ class Branch {
} else {
$gitname = $extract_dir . '/php-src-' . $rev_name;
}
+ while(is_dir($target)) {
+ rmdir_rf($target);
+ $target = $target . "-" . rand(0, 9);
+ }
if (true !== rename($gitname, $target)) {
throw new \Exception("Failed to rename '$gitname' to '$target'");
}