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)
Sat, May 9, 9:08 PM
Unknown Object (File)
Sat, May 9, 9:04 PM
Unknown Object (File)
Thu, May 7, 3:55 PM
Unknown Object (File)
Thu, May 7, 12:41 PM
Unknown Object (File)
Thu, May 7, 6:39 AM
Unknown Object (File)
Wed, May 6, 7:15 PM
Unknown Object (File)
Wed, May 6, 7:15 PM
Unknown Object (File)
Sun, May 3, 1:27 PM

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 $()