From 2ec10d9799a3c27cedf772adbcb7a9aca1d7137a Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Sun, 2 Sep 2012 13:17:16 +0200 Subject: [PATCH] [TASK] Stabilize some tests if run as root GeneralUtility::fixPermissions has a bug if createGroup is set to the id of the root group (0), and does not set the correct group. This is fixed with a more sophisticated test in fixPermissions to allow 0 as valid group. Default for createGroup is empty string, so it is now checked with isset and strlen > 0 if chgrp() should be applied. Additionally, the FAL test permissionsAreCorrectlyRetrieved is splitted to four tests, and two of them are skipped if the test is run on linux as root. Change-Id: Icd3bb5808fef195da8394a8fd9c2797f9f01e9aa Resolves: #40523 Releases: 6.0 Reviewed-on: http://review.typo3.org/14288 Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../t3lib/file/Driver/LocalDriverTest.php | Bin 47968 -> 49015 bytes .../core/Classes/Utility/GeneralUtility.php | 5 ++++- .../Tests/Unit/Utility/GeneralUtilityTest.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Unit/t3lib/file/Driver/LocalDriverTest.php b/tests/Unit/t3lib/file/Driver/LocalDriverTest.php index 3e421c7f2bf3681921b187fe72ce9bf61cddcf50..d710f88334d5823a89301a9c06160afda8d37614 100644 GIT binary patch delta 498 zcmaFxjp_S8rVVKOnEXCpK?EobL`j(`DXDoN1sa+P)svG;73)*eGgH(x71Y!e z3i69HE8^2rOF%+Ed0Sgs1)vSpT%4SoDkT}2#kzL6iAC8Vsl_G1*_j0esVN%jAdW&Y zgr|_1rchLxr;wkgkdv8LTA`3wtWcDnU!tyQ4K$(_i1oF!6dcMDixgDSGAl|-i&7P0 zChvDInmoHeV)C3q&dJP$W9GI>L>z+~RtdpM<3Bx=hfaK5ooRrie zpig@yw-icF4k|PPY7U=#px9(`elhoCjuM{97ouc9z86FBJy_cy@_*;#*@cxLKX2Yp Kyw;t`-VOlZ7qL$O delta 116 zcmezVkLkfTrVVK IGnc&`05=ROtN;K2 diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 0f1f2faa22df..1bfa713576b8 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2507,7 +2507,10 @@ Connection: close $result = @chmod($path, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'])); } // Set createGroup if not empty - if ($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { + if ( + isset($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) + && strlen($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) > 0 + ) { // "@" is there because file is not necessarily OWNED by the user $changeGroupResult = @chgrp($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); $result = $changeGroupResult ? $result : FALSE; diff --git a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php index de0e324f6a27..f70d05e5bc03 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php @@ -2581,7 +2581,7 @@ class GeneralUtilityTest extends \tx_phpunit_testcase { clearstatcache(); $resultFileGroup = filegroup($filename); unlink($filename); - $this->assertEquals($resultFileGroup, $currentGroupId); + $this->assertEquals($currentGroupId, $resultFileGroup); } /** -- 2.20.1