You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2023/01/10 19:30:29 UTC

[solr] branch main updated: SOLR-16457: Use pwd -P (#1282)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new a187c9e86cc SOLR-16457: Use pwd -P (#1282)
a187c9e86cc is described below

commit a187c9e86ccda4d0c6aba845af02576de3a34a62
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Tue Jan 10 14:30:23 2023 -0500

    SOLR-16457: Use pwd -P (#1282)
---
 solr/bin/solr                                  | 14 +++++++-------
 solr/docker/templates/Dockerfile.body.template |  1 -
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/solr/bin/solr b/solr/bin/solr
index 73394d66a56..e29247c18a1 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -87,7 +87,7 @@ done
 CDPATH=''  # Prevent "file or directory not found" for 'cdpath' users
 SOLR_TIP=$(dirname "$SOLR_SCRIPT")/..
 # shellcheck disable=SC2164
-SOLR_TIP=$(cd "$SOLR_TIP"; pwd)
+SOLR_TIP=$(cd "$SOLR_TIP"; pwd -P)
 DEFAULT_SERVER_DIR="$SOLR_TIP/server"
 
 # If an include wasn't specified in the environment, then search for one...
@@ -1511,7 +1511,7 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; then
             fi
 
             if [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then
-              SOLR_SERVER_DIR="$(pwd)/$2"
+              SOLR_SERVER_DIR="$(pwd -P)/$2"
             else
               # see if the arg value is relative to the tip vs full path
               if [[ "$2" != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
@@ -1558,8 +1558,8 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; then
   if [ -z "${SOLR_HOME:-}" ]; then
     SOLR_HOME="$SOLR_SERVER_DIR/solr"
   elif [[ $SOLR_HOME != /* ]]; then
-    if [[ -d "$(pwd)/$SOLR_HOME" ]]; then
-      SOLR_HOME="$(pwd)/$SOLR_HOME"
+    if [[ -d "$(pwd -P)/$SOLR_HOME" ]]; then
+      SOLR_HOME="$(pwd -P)/$SOLR_HOME"
     elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; then
       SOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"
       SOLR_PID_DIR="$SOLR_HOME"
@@ -1660,7 +1660,7 @@ if [ $# -gt 0 ]; then
             fi
 
             if [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then
-              SOLR_SERVER_DIR="$(pwd)/$2"
+              SOLR_SERVER_DIR="$(pwd -P)/$2"
             else
               # see if the arg value is relative to the tip vs full path
               if [[ "$2" != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
@@ -1958,8 +1958,8 @@ fi
 if [ -z "${SOLR_HOME:-}" ]; then
   SOLR_HOME="$SOLR_SERVER_DIR/solr"
 elif [[ $SOLR_HOME != /* ]]; then
-  if [[ -d "$(pwd)/$SOLR_HOME" ]]; then
-    SOLR_HOME="$(pwd)/$SOLR_HOME"
+  if [[ -d "$(pwd -P)/$SOLR_HOME" ]]; then
+    SOLR_HOME="$(pwd -P)/$SOLR_HOME"
   elif [[ -d "$SOLR_SERVER_DIR/$SOLR_HOME" ]]; then
     SOLR_HOME="$SOLR_SERVER_DIR/$SOLR_HOME"
     SOLR_PID_DIR="$SOLR_HOME"
diff --git a/solr/docker/templates/Dockerfile.body.template b/solr/docker/templates/Dockerfile.body.template
index 50e2518368e..63ac7334718 100644
--- a/solr/docker/templates/Dockerfile.body.template
+++ b/solr/docker/templates/Dockerfile.body.template
@@ -45,7 +45,6 @@ ENV SOLR_USER="solr" \
     SOLR_PID_DIR=/var/solr \
     SOLR_LOGS_DIR=/var/solr/logs \
     LOG4J_PROPS=/var/solr/log4j2.xml \
-    SOLR_SERVER_DIR="/opt/solr-${SOLR_VERSION}/server" \
     SOLR_JETTY_HOST="0.0.0.0"
 
 RUN set -ex; \