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.
- If BaseDir is configured in freebsd-update.conf, COMPONENTS is calculated first, so BASEDIR isn't set yet when used in config_Components
- 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).