Review main Abandoned

75880[BUGFIX] Generate correct asset symlinks on Windows

Robert Kärner CR 0 V 0 Easy +13 −1 updated 01/17/23, 06:43

Commit message

When an extension's Resources/Public directory is symlinked into the
_assets folder, the symlink will be named using an md5 hash based on
parts of the extension's installation path on the filesystem. During
Composer installation, this relative path is derivated from the
absolute path provided by Composer. As Windows uses a different default
path separator (backslash) compared to Unix (forward slash), the
relative path will be different between both platforms, resulting in a
different md5 hash being generated.

Absolute path on Unix:
/path/to/typo3/vendor/mycompany/myext

Absolute path on Windows:
C:\path\to\typo3\vendor/mycompany/myext

Relative path to be used for the hash on Unix:
/vendor/mycompany/myext

Relative path to be used for the hash on Windows:
\vendor/mycompany/myext

If an uri into the _assets folder is to be generated in either frontend
or backend, the md5 hash will be always be generated by using forward
slashes, resulting in incorrect links on Windows installations.

This difference has been solved by replacing all backslashes in the
absolute extension installation path into forward slashes on Windows
installations, so the symlink will be named correctly from the
beginning.

Furthermore generating symlinks on Windows can fail to be generated.
Using junctions on Windows seems to be more stable and should be
preferred.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 912

  1. Robert Kärner uploaded patch set 1 09/27/22, 13:00

  2. core-ci voted on patch set 1 V +1 09/27/22, 13:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31591

  3. Nicole Hummel uploaded patch set 2 V +1 01/06/23, 11:31

  4. Nicole Hummel voted on patch set 2 V +1 CR +1 01/06/23, 11:32

  5. Robert Kärner commented on patch set 2 01/06/23, 11:37

    Thank you for the update, Nicole! Just wanted to note that I tackled the assets publishing as junctions in patch #75867. Should we move your changes to the other patch or just close the other one?
  6. Robert Kärner commented on patch set 2 01/06/23, 11:38

    Reply

  7. core-ci voted on patch set 2 V +1 01/06/23, 11:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35530

  8. Nicole Hummel uploaded patch set 3 CR +1 V +1 01/06/23, 12:06

  9. Nicole Hummel commented on patch set 3 V +1 CR +1 01/06/23, 12:09

    Reply

    Seems like I haven't found the other issue in the tracker. I would love to handle both Windows fixes in one ticket. This ensures ones this ticket is merged, an installation on Windows system can finally work and is doesn't depend on further handling.

    PackageArtifactBuilder.php:172

    I recommend to replace backslashes even on Unix systems as the core itself replaces them for all (package) paths by default.
  10. core-ci voted on patch set 3 V +1 01/06/23, 12:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35533

  11. Robert Kärner commented on patch set 3 01/06/23, 15:09

    Reply

    Fine with me. Let's continue in the other issue then, as it got more attention and includes the thoughts and discussion with Stefan and me.

    PackageArtifactBuilder.php:172 Reply Unresolved

    Also fine for me. I will add this and the whole changes of this patch to https://review.typo3.org/c/Packages/TYPO3.CMS/+/75867 after the weekend. You can do as well, if you find some time before. Will abandon this patch afterwards.
  12. Robert Kärner abandoned the change 01/17/23, 06:43