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 added a subscriber: Pastakhov.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 14 2015, 5:42 AM
Pastakhov updated the task description. (Show Details)Oct 14 2015, 5:42 AM
Pastakhov set Security to None.
Pastakhov added a project: Jenkins.
hashar added a subscriber: hashar.

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
hashar removed a subscriber: hashar.Oct 14 2015, 12:34 PM

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

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 14 2015, 9:20 PM
Krinkle triaged this task as Low priority.Dec 14 2015, 9:20 PM
Krinkle assigned this task to Pastakhov.Mar 15 2017, 2:08 AM
Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Testing board.Jul 7 2017, 5:12 AM
hashar added a project: Refreshed.
hashar added a subscriber: hashar.

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

Restricted Application added a project: Performance-Team. · View Herald TranscriptNov 4 2017, 9:59 PM
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 Pastakhov as the assignee of this task.May 4 2018, 2:10 AM
Krinkle removed a project: Patch-For-Review.
Krinkle added a subscriber: Krinkle.

@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
hashar assigned this task to TheDJ.Jun 5 2018, 2:16 PM

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 claimed this task.Jul 17 2018, 4:04 PM
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.

Krinkle closed this task as Resolved.Jul 20 2018, 4:42 AM

Thanks!

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