Page MenuHomeFreeBSD

kldxref: skip .pkgsave files
Needs ReviewPublic

Authored by me_igalic.co on Jan 4 2021, 9:29 PM.

Details

Reviewers
emaste
Group Reviewers
pkgbase
Summary

add .pkgsave to list of skipped files, by skipping all files that
contain two '.'

Motivation: This should help people transitioning from
traditional setups to pkgbase experience a lot less friction.

Test Plan

update your system to pkgbase (using, for instance https://alpha.pkgbase.live/ ;)
or, copy .ko files in /boot/kernel to .ko.pkgsave

service kldxref onerestart
reboot, see unhappy boot messages

apply this patch
rebuild kldxref
reboot and see *no* unhappy boot messages!

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

me_igalic.co created this revision.
emaste added a subscriber: emaste.

LGTM even though we're probably close to the point where it makes sense to have a loop with a list of extensions to ignore.

This revision is now accepted and ready to land.Jan 4 2021, 10:42 PM

LGTM even though we're probably close to the point where it makes sense to have a loop with a list of extensions to ignore.

alternatively, we could say: if it has >= 2 '.', skip it

alternatively, we could say: if it has >= 2 '.', skip it

Yes I think that's reasonable if you're up for updating this review with that change (or I'll take this one as is).

alternatively, we could say: if it has >= 2 '.', skip it

Yes I think that's reasonable if you're up for updating this review with that change (or I'll take this one as is).

naïvely, i'd implement this like,

char *first_dot  = strchr(p->fts_name, '.');
char *last_dot = strchrt(p->fts_name, '.');
if (first_dot != NULL && last_dot != NULL && first_dot != last_dot)
        continue;

assuming that .symbols and .debug files usually look like: foo.ko.debug and bar.ko.symbols like with .pkgsave files.

same functionality, written in C instead of python style C. thanks to RhodiumToad:

char *dot = strchr(p->fts_name, '.');
if (dot && strchr(dot+1, '.') != NULL)
        continue;

i don't suppose dot+1 will push us *past* \0, so we don't need to check if we still have enough string left

me_igalic.co edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Jan 5 2021, 10:06 PM

fix @emaste's formatting remarks from IRC

kevans added inline comments.
usr.sbin/kldxref/kldxref.c
759

I think we can safely drop .symbols from this list, @emaste transitioned to .debug in 05117b57a54a -- surely enough time has passed that we can stop explicitly caring about or referencing them, hopefully...

me_igalic.co marked an inline comment as done.

address @kevans' feedback.

address @kevans' feedback, by moving local_rc *.pkgsave skipping into the skipping of scratch files, since that issues a warning.

unfucked this differential, after accidentally updating with the wrong diff