Page MenuHomePhabricator

ResourcesTest::testFileExistence does not ignore anchor in url
Closed, ResolvedPublic

Description

upstream library contains the anchor in url in its style :

@font-face
{
...
src: ..., url('./fonts/slick.svg#slick') format('svg');
}

https://gerrit.wikimedia.org/r/#/c/246154/1/resources/libs/slick/slick-theme.css

And Jenkins reports failure when testing it:

ResourcesTest::testFileExistence with data set #477 ( ...blablabla... ./fonts/slick.svg#slick')
File '...blablabla... /fonts/slick.svg#slick' referenced by 'ext.PhpTagsWidgets.slick' must exist.
Failed asserting that file "...blablabla... /fonts/slick.svg#slick" exists.

https://integration.wikimedia.org/ci/job/mwext-PhpTagsWidgets-testextension-zend/33/console

I do not know for what the anchor there and whether I need to fix it.
May be ResourcesTest::testFileExistence should ignore anchor in url, doesn't it?

Event Timeline

Pastakhov raised the priority of this task from to Needs Triage.
Pastakhov updated the task description. (Show Details)
Pastakhov subscribed.
Pastakhov set Security to None.
Pastakhov added a project: Jenkins.
hashar subscribed.

That is not a Jenkins issue but the extension PhpTagsWidgets not confirming to MediaWiki core resource loader expectations. See in core the 'structure' PHPUnit suite which you can run with:

php tests/phpunit.php --testsuite structure

www.w3.org says:

An IRI which includes an IRI fragment identifier consists of an optional base IRI, followed by a "#" character, followed by the IRI fragment identifier.

So, ResourcesTest::testFileExistence should be fixed.

Change 247998 had a related patch set uploaded (by Pastakhov):
Ignore fragment of file name after anchor in ResourcesTest

https://gerrit.wikimedia.org/r/247998

hashar added a project: Refreshed.
hashar subscribed.

The Jenkins job now process submodules. The MediaWiki test fails to find WikiFont-Glyphs.svg#wikiglyph because of the anchor :-/

Krinkle changed the task status from Open to Stalled.Jan 18 2018, 10:45 AM
Krinkle edited projects, added Performance-Team (Radar); removed Performance-Team.
Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.
Krinkle removed a project: Patch-For-Review.
Krinkle subscribed.

@Pastakhov I am un-assigning this given it has been two years. That way, it can be seen as available for someone else interested in this. Feel free to re-assign it if/when you have time available to work on this. Thanks!

Krinkle changed the task status from Stalled to Open.May 4 2018, 2:10 AM

That got fixed between 1.29 and 1.30. Fixed by 032f0ce8cb513dd07ad77156a4630a9712654214

CSSMin: Skip #default#behaviorName when detecting local files

Bug: T162973
Change-Id: If76869910f308f8a91c73f287e7e74c214f02e9b

Krinkle reopened this task as Open.EditedJun 5 2018, 5:52 PM

@hashar I do not think that is a duplicate. This task is about arbitrary values after #, specifically for anchoring inside SVG files. Such as url(fonts/Foo.svg#bar) has to be indexed by ResourceLoader as dependency on a file: fonts/Foo.svg.

On the other hand, task T162973 is not about files and anchors, it is about the whole url being an magic value that looks like an anchor, the exact value url(#default#behaviorName). For T162973 the solution was to ignore those urls entirely because they are not dependencies on real files.

For this task, the problem still happens in master, and the solution will have to be to keep the file but strip the anchor.

Change 446352 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/core@master] CSSMin::getLocalFileReferences now strips anchors

https://gerrit.wikimedia.org/r/446352

Change 446353 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/skins/Refreshed@master] (DO NOT SUBMIT) test case for T115436

https://gerrit.wikimedia.org/r/446353

hashar added a subscriber: TheDJ.

@Krinkle thank you! I got confused by how similar the two tasks are :] I eventually crafted a patch that would strip the anchors entirely.

Change 446352 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: CSSMin::getLocalFileReferences now strips anchors

https://gerrit.wikimedia.org/r/446352

Change 447032 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] Migrate Refreshed skin to Quibble

https://gerrit.wikimedia.org/r/447032

Change 446353 abandoned by Hashar:
(DO NOT SUBMIT) test case for T115436

https://gerrit.wikimedia.org/r/446353

Change 447032 merged by jenkins-bot:
[integration/config@master] Migrate Refreshed skin to Quibble

https://gerrit.wikimedia.org/r/447032

Change 247998 abandoned by Thiemo Kreuz (WMDE):
[mediawiki/core@master] Ignore fragment of file name after anchor in ResourcesTest

Reason:
This code doesn't exist any more since Iae46b2d, the task is closed as resolved.

https://gerrit.wikimedia.org/r/247998

Change 653744 had a related patch set uploaded (by Legoktm; owner: Hashar):
[mediawiki/core@REL1_31] resourceloader: CSSMin::getLocalFileReferences now strips anchors

https://gerrit.wikimedia.org/r/653744

Change 653744 merged by jenkins-bot:
[mediawiki/core@REL1_31] resourceloader: CSSMin::getLocalFileReferences now strips anchors

https://gerrit.wikimedia.org/r/653744