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)
Dec 11 2023, 7:29 PM
Unknown Object (File)
Dec 6 2023, 8:56 AM
Unknown Object (File)
Nov 23 2023, 5:06 PM
Unknown Object (File)
Nov 23 2023, 4:57 PM
Unknown Object (File)
Nov 23 2023, 3:24 PM
Unknown Object (File)
Nov 11 2023, 12:26 PM
Unknown Object (File)
Nov 9 2023, 12:24 PM
Unknown Object (File)
Oct 17 2023, 9:08 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 $()