Page MenuHomeFreeBSD

debug.sh take advantage of hooks.sh
ClosedPublic

Authored by sjg on Thu, Sep 5, 10:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 16, 6:36 PM
Unknown Object (File)
Fri, Sep 13, 4:08 PM
Unknown Object (File)
Fri, Sep 13, 4:08 PM
Unknown Object (File)
Fri, Sep 13, 8:12 AM
Unknown Object (File)
Tue, Sep 10, 7:12 PM
Unknown Object (File)
Sun, Sep 8, 6:32 PM
Unknown Object (File)
Fri, Sep 6, 1:50 PM
Unknown Object (File)
Fri, Sep 6, 1:37 PM
Subscribers
None

Details

Summary

Allow Debug{On,Off} to run associated hooks.
This makes it feasible to collect extra debug info at runtime
without needing to modify any potentially verified and hence immutable
scripts.

Like debug.sh, hooks.sh is extremely handy and used extensively
in many parts of Junos and its build environment.
It is provided here in the hope that others may benefit.

We do not dot hooks.sh by default to reduce overhead, but it can
but done from rc.conf et al using

$_HOOKS_SH . /libexec/hooks.sh

to avoid including more than once.

Sponsored by: Juniper Networks, Inc.

Diff Detail

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

Event Timeline

sjg requested review of this revision.Thu, Sep 5, 10:29 PM
sjg created this revision.
libexec/rc/debug.sh
138

Don't you need a dummy "hooks_run" somewhere in the case where dot hooks.sh was not done?

213

Since you're using $local, should this script not sanity check $local somewhere? Something similar to the following perhaps?

case "$local" in
local|:);;
*) local= ;;
esac

libexec/rc/hooks.sh
57

This block doesn't quite look like BSD-2-Clause license.

libexec/rc/debug.sh
138

That what checking for $_HOOKS_SH does, I was trying to keep the overhead down, as you know this stuff gets called a *lot*

213

Yes that's probably a good idea

libexec/rc/hooks.sh
57

Its not, but it is IMO morally equivalent ;-)

Test for $local rather than $isPOSIX_SHELL

sjg marked 2 inline comments as done.Fri, Sep 6, 4:59 PM

_debugShell ensure _TTY is set

This revision is now accepted and ready to land.Tue, Sep 10, 5:18 PM
This revision was automatically updated to reflect the committed changes.