Page MenuHomeFreeBSD

rc: ignore .pkgsave files
ClosedPublic

Authored by freebsd_igalic.co on Jan 4 2021, 9:48 PM.
Referenced Files
F81673454: D27962.id.diff
Fri, Apr 19, 6:16 PM
F81667603: D27962.diff
Fri, Apr 19, 4:52 PM
Unknown Object (File)
Fri, Apr 5, 9:10 AM
Unknown Object (File)
Fri, Apr 5, 9:10 AM
Unknown Object (File)
Fri, Apr 5, 9:10 AM
Unknown Object (File)
Fri, Apr 5, 9:09 AM
Unknown Object (File)
Fri, Apr 5, 9:09 AM
Unknown Object (File)
Fri, Apr 5, 9:06 AM

Details

Reviewers
kevans
Group Reviewers
pkgbase
Commits
rG3693d9140e05: rc: ignore .pkgsave files
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

freebsd_igalic.co created this revision.
libexec/rc/rc.subr
2101

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
2101

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
2101

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

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

addressed @swills' concerns.

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

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.

2101

We should also skip *.pkgnew here

I'll be updating this review and try to revive it.

does this need a documentation update?

libexec/rc/rc.subr
2086

we could move this to the part that has a *warning* about a bunch fragments:

run_rc_script()
…
        *[~#]|*.OLD|*.bak|*.orig|*,v)   # scratch file; skip          
                warn "Ignoring scratch file $_file"
                ;;

So where is this review? It seems to have wound down a bit.

libexec/rc/rc.subr
2086

If you did this, add *~ to the list too... emacs backup files should be ignored too.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 15 2023, 3:08 AM
Closed by commit rG3693d9140e05: rc: ignore .pkgsave files (authored by freebsd_igalic.co, committed by imp). · Explain Why
This revision was automatically updated to reflect the committed changes.