Page MenuHomeFreeBSD

rc: ignore .pkgsave files
Needs ReviewPublic

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

Details

Reviewers
kevans
Group Reviewers
pkgbase
Summary

the local parts of rc already skip .sample files; we add .pkgsave to the
for base, we add an equivalent function and for now only ignore .pkgsave

thanks to RhodiumToad for getting this started in https://reviews.freebsd.org/D27847

Motivation: having this in place means that people can much quicker get into testing pkgbase, instead of cleaning up after pkg

Test Plan

tested on my laptop by

  • copying /etc/rc.d/* to /etc/rc.d/*.pkgsave and
  • *not seeing* daemons getting started twice

Diff Detail

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

Event Timeline

me_igalic.co created this revision.
libexec/rc/rc.subr
2048

Skipping any file with "." in it seems a bit harsh. rc.subr is used by the scripts in /usr/local/etc/rc.d too, including anything users might write for local things. You're basically deciding that people can't have scripts named "mything.dev" "mything.test" "mything.prod" etc. without any way of knowing why this one case silently breaks. Seems not ideal to me.

I suggested this kind of approach in D27959 for kldxref; I think it's reasonable in that case, although perhaps we could indeed end up with something like if_em.test.ko

libexec/rc/rc.subr
2048

as you can see from the function name, this is restricted to /etc/rc.d

/usr/local/etc/rc.d has other restrictions, which we only extended

however, we could log this skip case, so people know what's up

libexec/rc/rc.subr
2048

Ah, right. Still, might be better to only skip the things we know need to be skipped, IMHO.

me_igalic.co edited the summary of this revision. (Show Details)
me_igalic.co marked 2 inline comments as done.

addressed @swills' concerns.

kevans added inline comments.
libexec/rc/rc.subr
2034

I don't think we want this part, though. If you end up with .pkgnew or .pkgsave in the local scripts, then that's indicative of a real problem -- this is based on a vague recollection of a remark by @bapt that ports trying to mark anything as config file rather than using the sample mechanism should be smacked with an oversized broomstick.

2049

We should also skip *.pkgnew here