ukri-excalibur / excalibur-tests

Performance benchmarks and regression tests for the ExCALIBUR project
https://ukri-excalibur.github.io/excalibur-tests/
Apache License 2.0
17 stars 14 forks source link

[CI] Do not rewrite links in symlinked files #305

Closed giordano closed 3 months ago

giordano commented 3 months ago

If we rewrite the hyperlinks in symlinked files we risk to accidentally append duplicate ${PREVIEW_SUBDIR}, depending on the order with which find operates on the files.

Should fix #304.

giordano commented 3 months ago

@tkoskela I'm not crazy, right? This line after rewriting the links is

- [Installation](https://ukri-excalibur.github.io/excalibur-tests/preview/PR305/install/)

right? But then the generated website has the duplicate subdir https://github.com/ukri-excalibur/excalibur-tests/blob/5d49476b4fee1aa9a437c9eb72037a0c689c0ec2/preview/PR305/index.html#L1212

giordano commented 3 months ago

As far as I understand: the link rewriting command is working as intended, but mkdocs sometimes is doing something stupid when generating the HTML files. I say "sometimes" because in #295 it was working correctly.

giordano commented 3 months ago

After a long time staring at the screen to spot the error, I believe now I understand the problem: the find command is editing all *.md files, but some of them are symlinks, and so there's the risk to rewrite the links twice if the original file is modified first, and the symlink is modified afterwards (once the symlink is modified by sed it's turned into a real file and the symlink is broken, if the order is inverted we wouldn't get double rewrite of the same file).

This probably also explains why the error was occurring occasionally: the occurrence of the error depends on the order with which find operates on the files, which is probably unspecified and can change from run to run.

Note that the links are finally correct in https://github.com/ukri-excalibur/excalibur-tests/commit/22d3f8ed1bcb3e8304539be3125850f690a6a4fe (triggered by https://github.com/ukri-excalibur/excalibur-tests/commit/adf2e95772abd78204324fb420f664a4904ea814) and stayed the same in the three subsequent commits (https://github.com/ukri-excalibur/excalibur-tests/compare/22d3f8ed1bcb3e8304539be3125850f690a6a4fe...3e11c4b651b4957d65f4709530de009e13b671bd)