Page MenuHomeFreeBSD

debug.sh take advantage of hooks.sh
ClosedPublic

Authored by sjg on Sep 5 2024, 10:29 PM.
Tags
None
Referenced Files
F102078056: D46552.id143043.diff
Thu, Nov 7, 8:39 AM
Unknown Object (File)
Sat, Oct 26, 11:12 PM
Unknown Object (File)
Sat, Oct 19, 2:40 AM
Unknown Object (File)
Fri, Oct 18, 12:48 AM
Unknown Object (File)
Thu, Oct 17, 2:47 PM
Unknown Object (File)
Thu, Oct 17, 12:54 PM
Unknown Object (File)
Thu, Oct 17, 12:30 PM
Unknown Object (File)
Thu, Oct 17, 11:45 AM
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 59356
Build 56243: arc lint + arc unit

Event Timeline

sjg requested review of this revision.Sep 5 2024, 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.Sep 6 2024, 4:59 PM

_debugShell ensure _TTY is set

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