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, Jan 7, 9:11 AM
Unknown Object (File)
Thu, Dec 12, 4:35 PM
Unknown Object (File)
Nov 25 2024, 12:33 AM
Unknown Object (File)
Nov 20 2024, 9:05 AM
Unknown Object (File)
Oct 2 2024, 10:13 PM
Unknown Object (File)
Oct 2 2024, 5:26 PM
Unknown Object (File)
Oct 1 2024, 3:16 AM
Unknown Object (File)
Sep 9 2024, 12:13 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 $()