You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2019/12/06 20:32:00 UTC

[jira] [Commented] (SOLR-13087) bin/solr's use of whoami can produce warnings

    [ https://issues.apache.org/jira/browse/SOLR-13087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16990147#comment-16990147 ] 

ASF subversion and git services commented on SOLR-13087:
--------------------------------------------------------

Commit 62e0222aeffeb8ca246c0d58e8168efda3a6920f in lucene-solr's branch refs/heads/master from Jason Gerlowski
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=62e0222 ]

SOLR-13087: Remove 'whoami' usage in bin/solr

whoami displays a warning if the effective-uid is not in /etc/password.
This can happen in certain situations when running in a docker
container.  This replaces the 'whoami' usage with a safer check.


> bin/solr's use of whoami can produce warnings
> ---------------------------------------------
>
>                 Key: SOLR-13087
>                 URL: https://issues.apache.org/jira/browse/SOLR-13087
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrCLI
>            Reporter: Martijn Koster
>            Priority: Trivial
>         Attachments: 0001-SOLR-13087-Use-EUID-to-check-for-root-in-bin-solr.patch
>
>
> The {{bin/solr}} script uses {{whoami}} to determine if it is running as root.
>  That code is [here |https://github.com/apache/lucene-solr/blob/master/solr/bin/solr#L1089]and was introduced with [this commit |https://github.com/apache/lucene-solr/commit/7561461f738a447856bb93b0a847b0200fff4c9c]for SOLR-7826
> This can produce a warning if the effective uid is not present in {{/etc/passwd}}.
>  For example:
> {noformat}
> $ docker run -it -u 88888 bash bash -c 'whoami'
> whoami: unknown uid 88888
> {noformat}
> This is an unusual situation, but one I encountered and [worked around|https://github.com/docker-solr/docker-solr/commit/8a4e236e93d6fcda3e33937b332d1911c1e7b8f8#diff-1578307c887a49e90a57418e653ad7f6R49]
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org