From a49b501034bc0f3e4a78da4564e72caf40e274bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Wed, 12 Jun 2024 06:26:18 +0200 Subject: [PATCH 1/2] [AssetMapper] Skip test with `chmod` failing on Windows --- .../AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php index 0019f604cc8c5..2691126bd8e95 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageStorageTest.php @@ -43,6 +43,10 @@ public function testGetStorageDir() public function testSaveThrowsWhenVendorDirectoryIsNotWritable() { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('chmod is not supported on Windows'); + } + $this->filesystem->mkdir($vendorDir = self::$writableRoot.'/assets/acme/vendor'); $this->filesystem->chmod($vendorDir, 0555); From e58b1021dbb1bc5b2f0abefc5a394387dd5bf020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Thu, 27 Jun 2024 07:06:03 +0200 Subject: [PATCH 2/2] Test my theory --- src/Symfony/Component/Filesystem/Filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 52ecfbda65c05..4ff2129930a7c 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -172,7 +172,7 @@ private static function doRemove(array $files, bool $isRecursive): void } } elseif (is_dir($file)) { if (!$isRecursive) { - $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-_')); + $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-.')); if (file_exists($tmpName)) { try {