Bug 238320

Summary: Mk/bsd.default-versions.mk: perl5 default detection warning with perl only installed in user-defined LOCALBASE
Product: Ports & Packages Reporter: Jeroen Pulles <jeroen.pulles>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me CC: perl, ports-bugs
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (perl)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch path to perl none

Description Jeroen Pulles 2019-06-04 10:49:42 UTC
Created attachment 204817 [details]
patch path to perl

I'm running a ports tree in my home directory for writing my own port. I've set LOCALBASE to $HOME/local. I haven't updated PATH, and perl is not installed on my system. One of my port dependencies installed perl in $LOCALBASE. This seems to cause some sort of issue for the perl5 default detection mechanism:

sh: perl: not found
make: "/home/jeroenp/ports/Mk/bsd.default-versions.mk" line 78: warning: "perl -e 'printf "%vd\n", $^V;'" returned non-zero status

From the preceding if statement I'm guessing this default detection should have been based on the installed perl binary, which can be found in $LOCALBASE/bin/perl. I'm thinking, why do a exist test and then proceed to work with any perl on $PATH... Attached is a patch that uses the perl in $LOCALBASE. 

kind regards,
Jeroen
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2019-06-04 22:13:09 UTC
While your fix is theorically correct, not having ${LOCALBASE}/bin in your PATH will break ports dependencies, so the correct fix would be to add $HOME/local/bin to your PATH.
Comment 2 Jeroen Pulles 2019-06-05 07:39:18 UTC
Yes, but I got very far before I ran into issues with BUILD_DEPENDS not being found. And I'd have to put the $LOCALBASE/local/bin in front of the existing $PATH, otherwise this could still sting. But I don't want to quibble too much ;-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-06-05 14:38:27 UTC
A commit references this bug:

Author: mat
Date: Wed Jun  5 14:37:47 UTC 2019
New revision: 503508
URL: https://svnweb.freebsd.org/changeset/ports/503508

Log:
  Make sure we use perl installed by ports and not some other perl in PATH.

  PR:		238320
  Submitted by:	Jeroen Pulles

Changes:
  head/Mk/bsd.default-versions.mk
Comment 4 Mathieu Arnold freebsd_committer freebsd_triage 2019-06-05 14:38:44 UTC
Though I don't see any real bad things that can happen with this patch, and it is better to be consistent in what we do.