Page MenuHomeFreeBSD

rc.d/dumpon: minor hardening/tightening up
Needs ReviewPublic

Authored by ngie on Sat, Jun 27, 6:34 AM.
Tags
None
Referenced Files
F161018590: D57899.diff
Mon, Jun 29, 9:42 PM
Unknown Object (File)
Sun, Jun 28, 10:15 AM
Subscribers

Details

Reviewers
des
Summary
  • Quote variables that should be treated as single words.
  • Replace ${cmd}; if [ $? -eq 0 ] with if ${cmd} for simplicity.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74322
Build 71205: arc lint + arc unit

Event Timeline

ngie requested review of this revision.Sat, Jun 27, 6:34 AM

This conflicts with https://reviews.freebsd.org/D34518 which was recently touched.

libexec/rc/rc.d/dumpon
40

If you're adding quotes, it makes sense to add them here since splitting need not happen twice.

52

These quotes do not affect anything; while it may be useful to add them for consistency, I don't think it makes much sense if other parts are left unquoted but do not need splitting even though splitting is not expected.

60

If you're adding quotes, it makes sense to add them here since $? is not supposed to be split.

67

These quotes do not affect anything either.

98

If you're adding quotes, it makes sense to add them here since this is not supposed to be split.

libexec/rc/rc.d/dumpon
36
40

I thin @ngie's intention is to add quotes that are necessary for correctness, and these are not since splitting has already occurred so $flag will not be split further.

49
60

$? can never be anything other than an integer, so quotes are not needed for correctness.

98

We know that $name is a single word and will not be split.