Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938339 - If <remote-id> content is indented, URL is rendered with an extra space
Summary: If <remote-id> content is indented, URL is rendered with an extra space
Status: RESOLVED FIXED
Alias: None
Product: Websites
Classification: Unclassified
Component: Packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Packages Website
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-08-23 09:51 UTC by Emanuele Torre
Modified: 2024-08-24 14:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
screenshot (file_000.png,11.92 KB, image/png)
2024-08-23 09:51 UTC, Emanuele Torre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Torre 2024-08-23 09:51:00 UTC
Created attachment 901002 [details]
screenshot

sys-apps/asahi-nvram is the only packaga in the gentoo repository that
does this, but apparently it is possible to indent the content of
<remote-id> tags in metadata.xml files using TABS (n.b. not spaces!)

    <remote-id type="github">
    	user/repo
    </remote-id>

instead of

    <remote-id type="github">user/repo</remote-id>

The problem is that soko will render such <remote-id>s with an extra
space after "https://github.com/":

    Upstream   REMOTE-ID https://github.com/ user/repo

instead of

    Upstream   REMOTE-ID https://github.com/user/repo

This is only a visual bug, the URL still works correctly and does not
contain the space.

See https://packages.gentoo.org/packages/sys-apps/asahi-nvram

o/
 emanuele6
Comment 1 Emanuele Torre 2024-08-24 02:50:17 UTC
I just looked at the HTML generated for the asahi-nvram package page
https://packages.gentoo.org/packages/sys-apps/asahi-nvram
and I saw this

    <a href="https://github.com/
    			WhatAmISupposedToPutHere/asahi-nvram
    		">https://github.com/
    			WhatAmISupposedToPutHere/asahi-nvram
    		</a>

So it seems that soko is not doing anything to unbreak the URL, it only
works because browsers (I tested qutebrowser, firefox, and links) are ok
with TABs and newlines in the middle of URLs in <a> tag href attributes.

I only assumed that TAB is allowed in <remote-id> because pkgcheck
doesn't complain with DeadUrl when it contains TAB, as it does when
there are spaces (because the URL will contain %20 characters in that
case).
But maybe it should complain, and this is not supposed to be allowed and
the asahi-nvram metadata.xml should be fixed given it is the only
package that does this.

o/
 emanuele6
Comment 2 Larry the Git Cow gentoo-dev 2024-08-24 10:45:59 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfb3ff518fe6a3eda3c158555dd7adae0db9e5d0

commit bfb3ff518fe6a3eda3c158555dd7adae0db9e5d0
Author:     Emanuele Torre <torreemanuele6@gmail.com>
AuthorDate: 2024-08-23 09:30:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-08-24 10:44:56 +0000

    sys-apps/asahi-nvram: fix remote-id in metadata.xml
    
    Whitespace in text XML tags is meaningful, content should not be
    indented.
    
    sys-apps/asahi-nvram was the only package in the gentoo repository that
    did this, and the whitespace is causing soko to render the Upstream URL
    on https://packages.gentoo.org/packages/sys-apps/asahi-nvram incorrectly
    
        https://github.com/ WhatAmISupposedToPutHere/asahi-nvram
    
    Found with  git grep '<remote-id[^<]*> *$'
    
    Bug: https://bugs.gentoo.org/938339
    Signed-off-by: Emanuele Torre <torreemanuele6@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/38258
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/asahi-nvram/metadata.xml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Comment 3 Larry the Git Cow gentoo-dev 2024-08-24 14:02:58 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/sites/soko.git/commit/?id=86e47718ee1528281f3267893894c0f303f43186

commit 86e47718ee1528281f3267893894c0f303f43186
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2024-08-24 14:02:38 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2024-08-24 14:02:38 +0000

    updater/portage: trim whitespace for metadata.xml values
    
    Closes: https://bugs.gentoo.org/938339
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 pkg/portage/repository/package.go | 15 ++++++++-------
 pkg/utils/utils.go                | 15 +++++++++++++--
 2 files changed, 21 insertions(+), 9 deletions(-)