Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13087

bin/solr's use of whoami can produce warnings

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: master (9.0), 8.4
    • Component/s: SolrCLI
    • Labels:
      None

      Description

      The bin/solr script uses whoami to determine if it is running as root.
      That code is here and was introduced with this commit for SOLR-7826

      This can produce a warning if the effective uid is not present in /etc/passwd.
      For example:

      $ docker run -it -u 88888 bash bash -c 'whoami'
      whoami: unknown uid 88888
      

      This is an unusual situation, but one I encountered and worked around

      The use of whoami can be avoided by using id -u, or better yet $UID$EUID which is built into bash and thus also avoids a subshell invocation. I'm not aware of any downside to this approach.

        Attachments

          Activity

            People

            • Assignee:
              gerlowskija Jason Gerlowski
              Reporter:
              makuk66 Martijn Koster
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: