Review main Merged

80916[BUGFIX] Do not try to create symlinks on Windows

Helmut Hummel CR +2 V +2 Easy +24 −4 updated 09/08/23, 14:46

Commit message

When a junction already exists on Windows, it is tried
to create a symlink, because of a missing OS check.

While this works as errors are ignored, it is
an unnecessary filesystem call.

Therefore the code is changed to only emit
the appropriate filesystem operations per OS.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 3

Files 1

Review log 1619

  1. Helmut Hummel uploaded patch set 1 09/07/23, 09:52

  2. core-ci voted on patch set 1 V +1 09/07/23, 10:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46339

  3. Benjamin Franzke commented on patch set 1 09/07/23, 10:24

    PackageArtifactBuilder.php:289

    Am I right that this command will fail when a symlink has been added because of the previous code we had? (state as of before https://review.typo3.org/c/Packages/TYPO3.CMS/+/75867 ) Can we check if the path is currently existing an provide instructions? Or maybe easier: Just call `$this->fileSystem->removeEdgeCases($junction)` so a possible symlink is removed (which is even allowed as non-privileged user – at least on Benji's system, I just asked him to test that)
  4. Helmut Hummel rebased onto patch set 2 V +1 09/07/23, 11:11

  5. Helmut Hummel commented on patch set 2 09/07/23, 11:15

    PackageArtifactBuilder.php:289 Reply

    removeEdgeCases is a private method in composer code I have available. Edit: https://github.com/composer/composer/blob/75ae504b2c8a7ee8533c69788c3bbdbf3740e610/src/Composer/Util/Filesystem.php#L170 seems still to be private But yes in general, this code isn't very resilient, it never was (especially not since junctions are created). If assets directory is somewhat wrong, it can be deleted and recreated with composer dumpautoload. This change here addresses the case that no symlink should be tried to be created on windows
  6. core-ci voted on patch set 2 V +1 09/07/23, 11:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46348

  7. Helmut Hummel commented on patch set 2 09/07/23, 11:22

    PackageArtifactBuilder.php:289 Reply

    Additional note: For TYPO3 13, we may want to create a class that handles all details asset publishing.
  8. Helmut Hummel commented on patch set 2 09/07/23, 17:19

    PackageArtifactBuilder.php:289 Reply

    This change improves/ fixes the behaviour further improvements can be added on top
  9. Stefan Bürk voted on patch set 2 V +1 CR +1 09/07/23, 20:46

  10. Thomas Hohn voted on patch set 2 V +1 CR +1 09/08/23, 05:06

  11. Benjamin Franzke commented on patch set 2 CR -1 09/08/23, 05:52

    on it
  12. Benjamin Franzke uploaded patch set 3 CR +1 V +1 09/08/23, 06:14

  13. Benjamin Franzke commented on patch set 3 09/08/23, 06:18

    PackageArtifactBuilder.php:289 Reply

    As I already guessed, a check is *important* taking our previous code into account. Otherwise an existing installation would run into following error: https://bnf.dev/~ben/uploads/4d2e4/failed-to-create-junction-on-previously-symlinked-folder.png …which is not ok. I see no reason not to fix that *now*, since we're at it testing/reviewing this… Done in patchset 3.
  14. core-ci voted on patch set 3 V +1 09/08/23, 06:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46373

  15. Andreas Kienast voted on patch set 3 CR +1 09/08/23, 06:50

  16. Stefan Bürk voted on patch set 3 V +1 CR +1 09/08/23, 11:17

  17. Benjamin Franzke voted on patch set 3 V +2 CR +2 09/08/23, 11:26

  18. Benjamin Franzke merged patch set 4 09/08/23, 11:35

  19. Helmut Hummel commented on patch set 4 09/08/23, 14:46

    PackageArtifactBuilder.php:289 Reply

    Thanks for taking care of the change and merge! As I tried to outline: I would have preferred to let users clear out the assets directory once, rather than maintaining such cleanup code "forever". Fine to have different priorities here, though. Can we at least remove this code in main branch right now?