Page MenuHomeFreeBSD

Add quotes around variables in adduser.sh and replace backticks with $()
Needs ReviewPublic

Authored by bcr on Jun 24 2023, 8:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 25, 1:05 AM
Unknown Object (File)
Nov 6 2025, 7:36 PM
Unknown Object (File)
Nov 5 2025, 9:33 PM
Unknown Object (File)
Nov 5 2025, 9:26 PM
Unknown Object (File)
Nov 5 2025, 2:32 PM
Unknown Object (File)
Oct 21 2025, 10:20 PM
Unknown Object (File)
Oct 20 2025, 1:09 AM
Unknown Object (File)
Oct 20 2025, 1:09 AM

Details

Reviewers
None
Group Reviewers
Src Committers
Summary

This patch does the following:

  • Replaces backticks with $()
  • add double quotes around variables to prevent word splitting and globbing
Test Plan

Run through the adduser.sh to see if a user gets created like before

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bcr requested review of this revision.Jun 24 2023, 8:32 AM

Most of the $()'s should be quoted too, since you are already there, maybe get the script through shellcheck?

(And for variables, it's a good idea to use ${var} instead of $var.

usr.sbin/adduser/adduser.sh
291

shouldn't this be quoted too?

Most of the $()'s should be quoted too, since you are already there, maybe get the script through shellcheck?

That's what I did, trying to keep the diffs small enough by not doing too much at once.

(And for variables, it's a good idea to use ${var} instead of $var.

I can do that, will update the diff to include this and the comment above. Thanks.

Address comments:

  • turn $vars into ${var}
  • quote them and the $()