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)
Wed, Aug 12, 9:30 PM
Unknown Object (File)
Wed, Aug 12, 2:31 PM
Unknown Object (File)
Mon, Aug 10, 10:00 AM
Unknown Object (File)
Mon, Aug 10, 2:22 AM
Unknown Object (File)
Sat, Aug 8, 7:15 PM
Unknown Object (File)
Sat, Aug 8, 5:37 PM
Unknown Object (File)
Sat, Aug 8, 2:05 PM
Unknown Object (File)
Sat, Aug 8, 3:32 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 $()