JoshRosen commented on code in PR #36315:
URL: https://github.com/apache/spark/pull/36315#discussion_r855748988


##########
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:
   Why do we need a separate `which` command? Why can't we just invoke `id` 
directly (e.g. just change this to `val cmdSeq = Seq("id", "-Gn", username)` 
and leave line 43 unchanged?



##########
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:
   Why do we need a separate `which` command? Why can't we just invoke `id` 
directly (e.g. just change this to `val cmdSeq = Seq("id", "-Gn", username)` 
and leave line 43 unchanged)?



-- 
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]

Reply via email to