From 4c945a64acc9fc9768b0302d0842fcc89f67494b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Wed, 4 Oct 2023 17:58:00 +0200 Subject: [PATCH] fix: remove setfacl calls on Darwin and Windows (#146) * fix: remove setfacl calls on Darwin and Windows * fix: remove setfacl calls on Darwin and Windows * fix: remove setfacl calls on Darwin and Windows * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * dump PS and Make versions * cleanup --- resources/Common/Platform/Darwin/default.mk | 9 +-------- resources/Common/Platform/Windows/default.mk | 12 ++---------- tests/functional/MakefileTestCase.php | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/resources/Common/Platform/Darwin/default.mk b/resources/Common/Platform/Darwin/default.mk index b195395..74f2a9a 100644 --- a/resources/Common/Platform/Darwin/default.mk +++ b/resources/Common/Platform/Darwin/default.mk @@ -10,12 +10,5 @@ $(shell test -f ${2}${1} && echo -n ${2}${1} || echo ${1}) endef define permissions - setfacl -dRm m:rwX $(1) - setfacl -Rm m:rwX $(1) - setfacl -dRm u:`whoami`:rwX $(1) - setfacl -Rm u:`whoami`:rwX $(1) - setfacl -dRm u:${RUNNER}:rwX $(1) - setfacl -Rm u:${RUNNER}:rwX $(1) - setfacl -dRm u:root:rwX $(1) - setfacl -Rm u:root:rwX $(1) + endef diff --git a/resources/Common/Platform/Windows/default.mk b/resources/Common/Platform/Windows/default.mk index 5d449ee..0ffc557 100644 --- a/resources/Common/Platform/Windows/default.mk +++ b/resources/Common/Platform/Windows/default.mk @@ -1,4 +1,4 @@ -SHELL := powershell.exe +SHELL := pwsh.exe COMMA := , EMPTY := @@ -6,7 +6,7 @@ SPACE := $(empty) $(empty) # TODO: rewrite output with https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.3#escape-e help: ## Prints this help - @Select-String -Pattern '^ *(?[-a-zA-Z0-9_/]+) *:.*## *(?.+)' $(subst $(SPACE),${COMMA},${MAKEFILE_LIST}) | Sort-Object {$$_.Matches[0].Groups["name"]} | ForEach-Object{"{0, -20}" -f $$_.Matches[0].Groups["name"] | Write-Host -NoNewline -BackgroundColor Magenta -ForegroundColor White; " {0}" -f $$_.Matches[0].Groups["help"] | Write-Host -ForegroundColor White} + @Select-String -Pattern '^ *(?[-a-zA-Z0-9_/]+) *:.*## *(?.+)' $(subst $(SPACE),${COMMA},$(strip ${MAKEFILE_LIST})) | Sort-Object {$$_.Matches[0].Groups["name"]} | ForEach-Object{"{0, -20}" -f $$_.Matches[0].Groups["name"] | Write-Host -NoNewline -BackgroundColor Magenta -ForegroundColor White; " {0}" -f $$_.Matches[0].Groups["help"] | Write-Host -ForegroundColor White} # TODO: review DOCKER_CWD := ${CURDIR} @@ -19,12 +19,4 @@ endef # TODO: review define permissions - setfacl -dRm m:rwX $(1) - setfacl -Rm m:rwX $(1) - setfacl -dRm u:`whoami`:rwX $(1) - setfacl -Rm u:`whoami`:rwX $(1) - setfacl -dRm u:${RUNNER}:rwX $(1) - setfacl -Rm u:${RUNNER}:rwX $(1) - setfacl -dRm u:root:rwX $(1) - setfacl -Rm u:root:rwX $(1) endef diff --git a/tests/functional/MakefileTestCase.php b/tests/functional/MakefileTestCase.php index afa8693..17851ff 100644 --- a/tests/functional/MakefileTestCase.php +++ b/tests/functional/MakefileTestCase.php @@ -172,14 +172,16 @@ protected function generatePermissionsExecutionPath(array $dirs): array $commands = []; foreach ($dirs as $dir) { $commands[] = sprintf('mkdir -p %1$s', $dir); - $commands[] = sprintf('setfacl -dRm m:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm m:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:`whoami`:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:`whoami`:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:999:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:999:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:root:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:root:rwX %1$s', $dir); + if (\PHP_OS_FAMILY === 'Linux') { + $commands[] = sprintf('setfacl -dRm m:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -Rm m:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -dRm u:`whoami`:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -Rm u:`whoami`:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -dRm u:999:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -Rm u:999:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -dRm u:root:rwX %1$s', $dir); + $commands[] = sprintf('setfacl -Rm u:root:rwX %1$s', $dir); + } } return $commands;