Bug 239997 - freebsd-update: Fix detection of src component
Summary: freebsd-update: Fix detection of src component
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Gmelin
URL: https://reviews.freebsd.org/D21579
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-08-20 16:26 UTC by Michael Gmelin
Modified: 2019-09-23 15:59 UTC (History)
2 users (show)

See Also:
grembo: mfc-stable12+
grembo: mfc-stable11+


Attachments
Patch to introduce new environment variable SKIPISFETCHEDCHECK (1.28 KB, patch)
2019-08-20 16:26 UTC, Michael Gmelin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gmelin freebsd_committer freebsd_triage 2019-08-20 16:26:08 UTC
Created attachment 206735 [details]
Patch to introduce new environment variable SKIPISFETCHEDCHECK

In bug #229346 freebsd-update was changed to fix ezjail and iocell ugrades. Unfortunately this also broke iocage's upgrade mechanism.

This patch introduces an environment variable to control the behavior of the check in question. By setting SKIPISFETCHEDCHECK, the test if there was a fetch phase before running install is skipped, therefore not showing an error message (which confuses the user in automatic setups anyway) and avoiding exiting with an error code, which broke iocage.

See also:
https://github.com/iocage/iocage/pull/1027
Comment 1 Xin LI freebsd_committer freebsd_triage 2019-08-20 21:17:27 UTC
Is there any reason that iocage shouldn't do a 'fetch' before install?
Comment 2 Michael Gmelin freebsd_committer freebsd_triage 2019-08-30 02:23:41 UTC
(In reply to Xin LI from comment #1)

Yes, not everyone always runs "freebsd-update fetch install" in one command, but separately like in "freebsd-update fetch", "freebsd-update install"
Comment 3 Michael Gmelin freebsd_committer freebsd_triage 2019-08-30 02:29:06 UTC
After going back and forth and discussing with Colin, I implemented a better solution for iocage.

While testing I noticed that detection of the src component didn't work if BASEPATH != "/" (even though there was an attempt to correct that earlier this year), so I fixed that. While there, I added new exit codes (instead of the original SKIPISFETCHEDCHECK solution) and two new commands (partially discussed OL).

As freebsd-update is mission critical, I opened a code review for better collaboration on it:

https://reviews.freebsd.org/D21473

(this sounds like a lot, but is relatively trivial in the end)
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2019-09-22 19:23:22 UTC
After splitting bugfix and feature parts in the review, I'm doing the same with the problem report.
Comment 5 Michael Gmelin freebsd_committer freebsd_triage 2019-09-22 19:30:51 UTC
(In reply to Michael Gmelin from comment #4)
New feature Bug #240757
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-09-22 19:54:00 UTC
A commit references this bug:

Author: grembo
Date: Sun Sep 22 19:53:29 UTC 2019
New revision: 352608
URL: https://svnweb.freebsd.org/changeset/base/352608

Log:
  MFC r352542: freebsd-update: Fix src component detection

  PR:	224048, 238558, 239997
  Reviewed by:    emaste
  Differential Revision:  https://reviews.freebsd.org/D21579

Changes:
_U  stable/12/
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Comment 7 Michael Gmelin freebsd_committer freebsd_triage 2019-09-22 20:11:49 UTC
Typo in commit message.

A commit references this bug:

Author: grembo
Date: Sun Sep 22 20:03:26 UTC 2019
New revision: 352610
URL: https://svnweb.freebsd.org/changeset/base/352610

Log:
  MFC r352542: freebsd-update: Fix src component detection

  PR:		224048, 238558, 23999
  Reviewed by:	emaste
  Differential Revision:	https://reviews.freebsd.org/D21579

Changes:
_U  stable/11/
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-09-23 15:59:25 UTC
A commit references this bug:

Author: grembo
Date: Mon Sep 23 15:58:55 UTC 2019
New revision: 352628
URL: https://svnweb.freebsd.org/changeset/base/352628

Log:
  MF stable/12 r352608

  Approved by:	re (gjb)

  r352608:
  freebsd-update: Fix src component detection

  In case BASEDIR was set to a directory that differed from the default
  filesystem root, freebsd-update wrongly checked for the existence
  of /usr/src/COPYRIGHT to determine if the src component was
  installed. Existing code to address this wasn't effective due to the
  order in which configuration options were evaluated.

  PR:		224048, 238558, 239997
  Reviewed by:	emaste
  Differential Revision:	https://reviews.freebsd.org/D21579

Changes:
_U  releng/12.1/
  releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh