Bug 227356 - lang/perl5.26: suggestion to set DEFAULT_VERSIONS=perl5=5.26 does not work if perl5.24 installed
Summary: lang/perl5.26: suggestion to set DEFAULT_VERSIONS=perl5=5.26 does not work if...
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-perl (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-08 00:09 UTC by John Hein
Modified: 2018-06-29 14:09 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2018-04-08 00:09:35 UTC
A pre-everything check in lang/perl5.26 suggest that the user can set DEFAULT_VERSIONS=perl5=5.26 in make.conf to make perl5.26 install files as the default perl (bin/perl, bin/perl5, etc.).  This fails if a different perl (e.g., perl5.24) is already installed.

Even if this behavior is not changed, the wording of the pre-everything message should probably be clarified to account for this case.
Comment 1 John Hein 2018-04-08 00:22:46 UTC
(In reply to John Hein from comment #0)
I should have said that it fails if perl5.24 (or another perl, such as perl5.22) was installed as the default (i.e., bin/perl exists and points to a version other than the version the user says he wants to be the default via DEFAULT_VERSIONS=perl5=x.y).
Comment 2 John Hein 2018-04-08 03:28:48 UTC
Never mind.  There was a stray /tmp/PERL5_DEFAULT file that had 'PERL5_DEFAULT=5.24'.  Closing as not-a-bug.  Or maybe it's a different issue (/tmp/PERL5_DEFAULT not getting cleaned up and affecting later builds).  I wonder if that mechanism (_PERL_DEFAULT_FILE stuff) is still useful or necessary?  But that requires more analysis and would be a separate bug.
Comment 3 Mathieu Arnold freebsd_committer 2018-04-09 10:13:56 UTC
Ok, so, the _PERL_DEFAULT_FILE was there for a good reason to begin with, which is installing a Perl that is not the default as the default, but I am wondering if it is still needed too, I will investigate a bit.
Comment 4 John Hein 2018-04-16 14:38:05 UTC
(In reply to Mathieu Arnold from comment #3)
I started a review regarding this...

https://reviews.freebsd.org/D15016
Comment 5 Mathieu Arnold freebsd_committer 2018-06-29 14:04:54 UTC
Ok, took me a while to remember why this is still needed.

- Default Perl is 5.24.
- You install stuff, and have Perl 5.24.
- The default Perl is changed to 5.26.
- You do not really follow those things and are not using pkg (and possibly poudriere) to maintain your /usr/local and you run portmaster to update what needs to be updated.
- As you did not set anything, your Perl default is still 5.24 because it is the installed /usr/local/bin/perl.
- Turns out that there has been a new version of Perl 5.24 in the mean time, and portmaster updates it.  Keep in mind that the only thing that makes 5.24 the default is that it is the installed version you have.  If you did not have it installed, the default would be 5.26.
- portmaster builds the new perl 5.24, and before it installs it, it needs to remove the old version.
- now, you do not have any Perl installed, so the default falls back to 5.26.
- portmaster installs perl 5.24 it just built, but as it is not the default any pore, it will not install /usr/local/bin/perl, and everything using Perl on your system is toast, you spend countless hours not understanding wtf happened.  You end up rebuilding everything with 5.26.

So, this *is* still required.
Comment 6 commit-hook freebsd_committer 2018-06-29 14:09:07 UTC
A commit references this bug:

Author: mat
Date: Fri Jun 29 14:08:41 UTC 2018
New revision: 473550
URL: https://svnweb.freebsd.org/changeset/ports/473550

Log:
  Make a note about why this hack is required.

  Here is the story:

  - Default Perl is 5.24.
  - You install stuff, and have Perl 5.24.
  - The default Perl is changed to 5.26 because it was time.
  - You do not really follow those things and are not using pkg (and
    possibly poudriere) to maintain your /usr/local and you run
    portmaster to update what needs to be updated.
  - As you did not set anything, your Perl default is still 5.24 because
    it is the installed /usr/local/bin/perl.
  - Turns out that there has been a new version of lang/perl5.24 in the
    mean time, and portmaster updates it.  Keep in mind that the only
    thing that makes 5.24 the default is that it is the installed version
    you have.  If you did not have it installed, the default would be
    5.26.
  - portmaster builds the new perl 5.24, and before it installs it, it
    needs to remove the old version.
  - now, you do not have any Perl installed, so the default falls back to
    5.26.
  - portmaster installs perl 5.24 it just built, but as it is not the
    default any pore, it will not install /usr/local/bin/perl, and
    everything using Perl on your system is toast, you spend countless
    hours not understanding wtf happened.  You end up rebuilding
    everything with 5.26.

  PR:		227356
  Sponsored by:	Absolight

Changes:
  head/lang/perl5-devel/Makefile
  head/lang/perl5.24/Makefile
  head/lang/perl5.26/Makefile
  head/lang/perl5.28/Makefile