Bug 274839 - ftp/lftp: lint to pass sanity checks
Summary: ftp/lftp: lint to pass sanity checks
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Ganael LAPLANCHE
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2023-10-31 23:10 UTC by Andrey Korobkov
Modified: 2023-11-10 11:40 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (martymac)


Attachments
[PATCH 1/2] ftp/lftp: lint to pass sanity checks: add desktop-file-utils to USES (863 bytes, patch)
2023-10-31 23:47 UTC, Andrey Korobkov
no flags Details | Diff
[PATCH 2/2] ftp/lftp: lint to pass sanity checks: avoid use of != in assignments (801 bytes, patch)
2023-10-31 23:49 UTC, Andrey Korobkov
alster: maintainer-approval? (martymac)
Details | Diff
[PATCH 3/3] ftp/lftp: Lint with portclippy(1) and portfmt(1) (3.45 KB, patch)
2023-11-04 09:37 UTC, Andrey Korobkov
alster: maintainer-approval? (martymac)
Details | Diff
[PATCH] ftp:/lftp: Lint with portclippy(1) and portfmt(1) (2.65 KB, patch)
2023-11-09 19:00 UTC, Andrey Korobkov
alster: maintainer-approval? (martymac)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Korobkov 2023-10-31 23:10:42 UTC
FATAL: ports/ftp/lftp/pkg-plist: [28]: this port installs .desktop files. Please add `desktop-file-utils` to USES.
WARN: Makefile: [63]: use of != in assignments is almost never a good thing to do.  Try to avoid using them.  See http://lists.freebsd.org/pipermail/freebsd-ports/2008-July/049777.html for some helpful hints on what to do instead.
Comment 1 Andrey Korobkov 2023-10-31 23:47:34 UTC
Created attachment 246033 [details]
[PATCH 1/2] ftp/lftp: lint to pass sanity checks: add desktop-file-utils to USES
Comment 2 Andrey Korobkov 2023-10-31 23:49:49 UTC
Created attachment 246034 [details]
[PATCH 2/2] ftp/lftp: lint to pass sanity checks: avoid use of != in assignments
Comment 3 Andrey Korobkov 2023-11-04 09:37:18 UTC
Created attachment 246100 [details]
[PATCH 3/3] ftp/lftp: Lint with portclippy(1) and portfmt(1)
Comment 4 Ganael LAPLANCHE freebsd_committer freebsd_triage 2023-11-07 11:26:54 UTC
Hello Andrey,

Thanks for your contribution.

Despite portlint warnings, lftp does not need 'USES=desktop-file-utils', because it has no MimeType entry in its .desktop file, see:

See: https://docs.freebsd.org/en/books/porters-handbook/book/#updating-desktop-database

so I'll skip patch 1.

Patch 3 does not apply cleanly. Could you update it please ?
Comment 5 Ganael LAPLANCHE freebsd_committer freebsd_triage 2023-11-07 11:39:29 UTC
Patch 2 seems a bit odd to me as what we want to do is executing the ldd command to check for libthr.so presence. We cannot remove the '!=' here. Also, you are assigning the string to a new variable, while we check for the old variable later in the code, see:

.if !empty(NEED_PTHREAD)
LDFLAGS+=       -pthread
.endif

Best regards,

Ganael.
Comment 6 Andrey Korobkov 2023-11-07 12:30:47 UTC
Thank you for reviewing.

On second patch: sorry for not stating upfront my reason behind it.
The portlint(1) warning mentioned this issue discussed on mailing list:
https://lists.freebsd.org/pipermail/freebsd-ports/2008-July/049777.html

I understood it as just another form of setting variable value to the output of commands chain. 

Is it indeed so? Do you think this may be applicable here?
I am ready to cancel the patches would you not like them.

Best regards,
Andrey
Comment 7 Andrey Korobkov 2023-11-07 12:45:50 UTC
On third patch: I'm waiting for your answer about the second one to make it properly.
Comment 8 Ganael LAPLANCHE freebsd_committer freebsd_triage 2023-11-09 11:38:35 UTC
(In reply to Andrey Korobkov from comment #6)

Thanks for the link, that point is interesting.

The aim of this advice is to run processes only when necessary. It probably mostly applies to Mk/* files as they are embedded with other ports. In the case of ftp/lftp, we are talking about a *leaf* Makefile, with a lower incidence. Moreover, moving the execution to the 'if' statement (for example) would not improve things as it is not located in a specific target. The process would be executed at the same time it is currently with the '!=' assignment. I would prefer leaving the call as is, to facilitate readability/maintainability of the port.

Could you update patch 3 so that I can take a look at it please ?
Comment 9 Andrey Korobkov 2023-11-09 19:00:19 UTC
Created attachment 246217 [details]
[PATCH] ftp:/lftp: Lint with portclippy(1) and portfmt(1)

Of course. Here it is.
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-11-10 11:34:44 UTC
A commit in branch main references this bug:

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

commit a822421ac76be8f974de51d35470eab65610332f
Author:     Andrey Korobkov <alster@vinterdalen.se>
AuthorDate: 2023-11-10 11:32:45 +0000
Commit:     Ganael LAPLANCHE <martymac@FreeBSD.org>
CommitDate: 2023-11-10 11:32:45 +0000

    ftp/lftp: lint port

    Re-order variables and fix COMMENT

    PR:     274839
    Reported by:    Andrey Korobkov <alster@vinterdalen.se>

 ftp/lftp/Makefile | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)
Comment 11 Ganael LAPLANCHE freebsd_committer freebsd_triage 2023-11-10 11:40:18 UTC
Patch committed, thanks Andrey!