JoshRosen commented on code in PR #36315:
URL: https://github.com/apache/spark/pull/36315#discussion_r855751881
##########
core/src/main/scala/org/apache/spark/security/ShellBasedGroupsMappingProvider.scala:
##########
@@ -36,10 +36,12 @@ private[spark] class ShellBasedGroupsMappingProvider
extends GroupMappingService
userGroups
}
- // shells out a "bash -c id -Gn username" to get user groups
+ // shells out a "id -Gn username" to get user groups
private def getUnixGroups(username: String): Set[String] = {
- val cmdSeq = Seq("bash", "-c", "id -Gn " + username)
+ val idPath = Utils.executeAndGetOutput("which" :: "id" :: Nil).stripLineEnd
Review Comment:
Are you concerned about whether the `id` command might resolve differently
in bash vs. the default shell? That's fair: it might be unlikely to be
different, but maybe we want to play it safe.
What do you think about caching the value in a `private lazy val` right
before this method so we only invoke it once?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]