Page MenuHomeFreeBSD

nanobsd: minor formatting cleanup
ClosedPublic

Authored by ngie on Sep 17 2025, 6:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 16, 7:54 PM
Unknown Object (File)
Thu, Oct 16, 7:19 PM
Unknown Object (File)
Thu, Oct 16, 2:27 AM
Unknown Object (File)
Wed, Oct 15, 7:33 AM
Unknown Object (File)
Wed, Oct 15, 1:38 AM
Unknown Object (File)
Fri, Oct 10, 4:02 PM
Unknown Object (File)
Fri, Oct 10, 3:35 AM
Unknown Object (File)
Fri, Oct 10, 3:35 AM
Subscribers

Details

Summary
  • Reformat function definitions

POSIX states that compound commands, i.e., ones that use (..) or
{ .. } , are permissible as function definitions, however, many shell
syntax validators do not acknowledge the former format.

Switch to the latter format so more naive editors, like the vim syntax
highlighter, better parse the syntax of the file.

Moreover, replacing (..) with {..} replaces several subshells with
their non-subshell equivalents. Given that set -e is used liberally
and exit is not used in the calling code when set -e is not
enforced, there is no net loss by making this change.

  • Clean trailing whitespace.
  • Reindent some related comments to match the indentation of the previous line.
  • Add shebangs to the tops of files to help syntax colorizers and file identifiers understand that the files are in shell syntax.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ngie requested review of this revision.Sep 17 2025, 6:23 PM
ngie removed a subscriber: imp.
ngie added a subscriber: jilles.

There's a few of these elsewhere in the nanobsd tree.
It's also the only place in the tree we do this style, so this is good, I think.

This revision is now accepted and ready to land.Sep 17 2025, 6:30 PM
ngie edited the summary of this revision. (Show Details)

Use local with variables for explicitness

This revision now requires review to proceed.Sep 17 2025, 6:33 PM
This revision is now accepted and ready to land.Sep 17 2025, 6:36 PM
ngie retitled this revision from nanobsd: reformat function definitions to nanobsd: minor formatting cleanup.Sep 17 2025, 6:44 PM
ngie edited the summary of this revision. (Show Details)

Expand scope to include other files under tools/tools/nanobsd

This revision now requires review to proceed.Sep 17 2025, 6:44 PM
This revision was not accepted when it landed; it landed in state Needs Review.Sep 18 2025, 7:18 PM
This revision was automatically updated to reflect the committed changes.
tools/tools/nanobsd/defaults.sh
257

So this function now changes the caller's current directory.

274

So this function now changes the caller's current directory.

526

So this function now changes the caller's current directory.

tools/tools/nanobsd/defaults.sh
257

You're right -- this is a behavioral change.

274

You're right; this is a behavioral change.

526

This is still executed in a subshell.

tools/tools/nanobsd/defaults.sh
770

This is broken too. I'll push a fix I've tested.