Bug 271623

Summary: ports-mgmt/portlint: False positive on desktop-file-utils
Product: Ports & Packages Reporter: Lewis Cook <lcook>
Component: Individual Port(s)Assignee: Joe Marcus Clarke <marcus>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (marcus)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Lewis Cook freebsd_committer freebsd_triage 2023-05-25 03:47:40 UTC
When working on some ports earlier, after some sanity checking, I came across a false positive regarding the usage of desktop-file-utils. The confusing part was on the one hand portlint(1) complaining about the absence of `USES=desktop-file-utils`, while the other in the stage-qa target told me that it was unnecessary after the fact of adding it.

The culprit in portlint(1) appears to be here[0]. Just the presence of an `.desktop` file trips the check up without determining whether a MimeType is actually specified (seen in Scripts/qa.sh[1]; we should follow this behaviour as currently this is an incorrect assumption of portlint(1) and a little confusing to consumers).

Unfortunately my perl-foo is quite rusty, ergo this problem report. :)  

[0] https://cgit.freebsd.org/ports/tree/ports-mgmt/portlint/src/portlint.pl#n813
[1] https://cgit.freebsd.org/ports/tree/Mk/Scripts/qa.sh#n222
Comment 1 Joe Marcus Clarke freebsd_committer freebsd_triage 2023-11-13 18:24:28 UTC
Thanks for the report.  This is a tricky one since portlint operates on the build infra rather than the package data itself.  That said, I've softened the error to:

&perror("WARN", $file, $., "this port installs .desktop files. ".
                "If the .desktop file(s) installed contain ``MimeType='', ".
                "you must add `desktop-file-utils` to USES.");

What do you think?
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-11-13 19:05:17 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=045f9995fb3624885bdae850d12eca43f7625732

commit 045f9995fb3624885bdae850d12eca43f7625732
Author:     Joe Marcus Clarke <marcus@FreeBSD.org>
AuthorDate: 2023-11-13 19:02:19 +0000
Commit:     Joe Marcus Clarke <marcus@FreeBSD.org>
CommitDate: 2023-11-13 19:02:19 +0000

    ports-mgmt/portlint: Update to 2.21.0

    * Soften the desktop-file-utils message [1]
    * Avoid a bogus error on ports that append to DISTFILES. [2]
    * Colorize output for warnings and errors. [3]

    PR:             271623 [1]
                    268681 [2]
                    274981 [3]
    Inspired by:    yuri [3]

 ports-mgmt/portlint/Makefile        |  2 +-
 ports-mgmt/portlint/src/portlint.pl | 37 +++++++++++++++++++++++++------------
 2 files changed, 26 insertions(+), 13 deletions(-)
Comment 3 Joe Marcus Clarke freebsd_committer freebsd_triage 2023-11-13 19:05:28 UTC
Fixed in 2.21.0.