Page MenuHomeFreeBSD

freebsd-update: Fix src component detection
ClosedPublic

Authored by grembo on Sep 9 2019, 10:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 23, 3:28 AM
Unknown Object (File)
Wed, Oct 23, 3:28 AM
Unknown Object (File)
Wed, Oct 23, 3:28 AM
Unknown Object (File)
Wed, Oct 23, 3:27 AM
Unknown Object (File)
Wed, Oct 23, 3:08 AM
Unknown Object (File)
Oct 2 2024, 10:28 PM
Unknown Object (File)
Sep 30 2024, 8:44 PM
Unknown Object (File)
Sep 28 2024, 5:41 PM
Subscribers

Details

Summary

This was originally part of D21473. As that review also added new features, I separated it into its own review, hoping that this will speed up the review process and also allow a separate commit that could be MFCed.

D18849, commit rS343152, bug https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224048 aimed to fix freebsd-update's detection if the src component is installed.

Unfortunately this fix doesn't work, as freebsd-update's option calculation works differently.

  1. If BaseDir is configured in freebsd-update.conf, COMPONENTS is calculated first, so BASEDIR isn't set yet when used in config_Components
  2. If BaseDir is specified on the command line (-b), it's moved to BASEDIR_saved before parsing the configuration file, so again, it's not available when used in config_Components

The cleanest fix seemed to add an additional function that's called after parsing all inputs and check if "src" needs to be removed.

The result of this problem is that the existence of /usr/src/COPYRIGHT determines if the src components should be updated or not, leading to not updating it or error messages as it isn't around. This is a common problem for certain jail setups (I noticed it while upgrading an iocage jail).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fine with me, although I'd prefer a different name for config_Components_src. This is not directly used for the config file as other config_-prefixed functions are. Maybe something like filter_components?

This revision is now accepted and ready to land.Sep 19 2019, 11:21 AM

Yeah, that's a good point. Also "config_Components_src" would get called if someone has a line in freebsd-update.conf starting with "Components_src" which is not what we want (it should be an error).

Change function name to make more sense.

This revision now requires review to proceed.Sep 19 2019, 11:45 AM

Fine with me, although I'd prefer a different name for config_Components_src. This is not directly used for the config file as other config_-prefixed functions are. Maybe something like filter_components?

Good point. As there is quite a lot of filtering going on already (functionally as well as in terms of naming) I changed it to `finalize_components_config' now, does this work for you?

This revision is now accepted and ready to land.Sep 19 2019, 12:00 PM
This revision was automatically updated to reflect the committed changes.