Bug 268640 - ports-mgmt/portlint: reported line numbers are sometimes wrong
Summary: ports-mgmt/portlint: reported line numbers are sometimes wrong
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Joe Marcus Clarke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-29 14:24 UTC by Vidar Karlsen
Modified: 2022-12-29 14:24 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vidar Karlsen 2022-12-29 14:24:01 UTC
I have noticed that portlint sometimes reports the wrong line numbers for warnings and errors.
Below, I have inserted errors into a port's Makefile to demonstrate how it gets reported by portlint.


Putting a != on line 15, portlint says it is on line 13:
# grep -n THIS Makefile
15:TRYTHIS!=	echo

# portlint
WARN: Makefile: [13]: 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.
WARN: Makefile: [13]: possible direct use of command "echo" found. use ${ECHO_CMD} or ${ECHO_MSG} instead.
0 fatal errors and 2 warnings found.


Putting some trailing whitespaces on line 13, portlint gets the whitespaces right, but thinks the != is on the same line:
# grep -n "   " Makefile
13:USES=		gmake tar:tgz   <-- three whitespaces at the end of the line here

# portlint
WARN: Makefile: [13]: whitespace before end of line.
WARN: Makefile: [13]: 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.
WARN: Makefile: [13]: possible direct use of command "echo" found. use ${ECHO_CMD} or ${ECHO_MSG} instead.
0 fatal errors and 3 warnings found.


Adding another variable above the != line, portlint now thinks the != is on line 15 while it should say 16:
# egrep -n "THIS|SOMEOTHER|   " Makefile
13:USES=		gmake tar:tgz   
15:SOMEOTHER=	1
16:TRYTHIS!=	echo

# portlint
WARN: Makefile: [13]: whitespace before end of line.
WARN: Makefile: [15]: 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.
WARN: Makefile: [15]: possible direct use of command "echo" found. use ${ECHO_CMD} or ${ECHO_MSG} instead.
0 fatal errors and 3 warnings found.