I ran `shellcheck solr/bin/solr` and one of the warnings jumped out as
potentially relevant. I haven't had a chance to check it further yet.
In solr/bin/solr line 1224:
SOLR_OPTS=(${SOLR_OPTS:-})
           ^------------^ SC2206 (warning): Quote to prevent word
splitting/globbing, or split robustly with mapfile or read -a.

My guess is its being split into an array based on spaces -
https://www.shellcheck.net/wiki/SC2206 has more details about options.

Kevin Risden


On Thu, Oct 12, 2023 at 1:41 PM Ishan Chattopadhyaya <
ichattopadhy...@gmail.com> wrote:

> SOLR_OPTS='-XX:-UseLargePages -Dfoo=bar'
> ./solr/packaging/build/dev/bin/solr
> start -f -a '-Dyak="white space"'
>
> Would this work?
>
> I remember that I did something like this for passing that remote debug
> parameters using -a, but can't remember if they had spaces or not.
>
>
> n Thu, 12 Oct, 2023, 11:06 pm Eric Pugh, <ep...@opensourceconnections.com>
> wrote:
>
> > We need more BATS tests around all these non common approaches for
> dealing
> > with parameters.  Or, figure out how to do less work in our bash scripts
> ;-)
> >
> > > On Oct 12, 2023, at 1:22 PM, Chris Hostetter <hossman_luc...@fucit.org
> >
> > wrote:
> > >
> > >
> > >
> > >
> > > : SOLR_OPTS='-XX:-UseLargePages -Dfoo=bar -Dyak="white space"'
> > > : ./solr/packaging/build/dev/bin/solr start -V -f
> > > :
> > > : Does this work?
> > >
> > > No.  Sorry, i thought i included that in my list of examples...
> > >
> > > $ SOLR_OPTS='-XX:-UseLargePages -Dfoo=bar -Dyak="white space"'
> > ./solr/packaging/build/dev/bin/solr start -f
> > > Error: Could not find or load main class space"
> > > Caused by: java.lang.ClassNotFoundException: space"
> > >
> > >
> > > :
> > > : On Thu, 12 Oct, 2023, 6:08 am Chris Hostetter, <
> > hossman_luc...@fucit.org>
> > > : wrote:
> > > :
> > > : >
> > > : > my bash-fu isn't that great, but AFAICT the way SOLR_OPTS is used
> in
> > > : > bin/solr breaks on any attempt i can think of to quote/escape any
> jvm
> > > : > args included in the SOLR_OPTS env variable.
> > > : >
> > > : > Am i missing something, or is this a bug?
> > > : >
> > > : > (see examples below)
> > > : >
> > > : > -Hoss
> > > : > http://www.lucidworks.com/
> > > : >
> > > : >
> > > : > hossman@slate:~/lucene/solr [j11] [tags/releases/solr/9.3.0] $
> > > : > SOLR_OPTS='-XX:-UseLargePages -Dfoo=bar "-Dyak=white space"'
> > > : > ./solr/packaging/build/dev/bin/solr start -V -f
> > > : > Using Solr root directory:
> > > : > /home/hossman/lucene/solr/solr/packaging/build/dev
> > > : > Using Java: /opt/jdk/11/latest//bin/java
> > > : > openjdk version "11.0.15" 2022-04-19
> > > : > OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10)
> > > : > OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10,
> mixed
> > mode)
> > > : >
> > > : > Starting Solr using the following settings:
> > > : >      JAVA            = /opt/jdk/11/latest//bin/java
> > > : >      SOLR_SERVER_DIR =
> > > : > /home/hossman/lucene/solr/solr/packaging/build/dev/server
> > > : >      SOLR_HOME       =
> > > : > /home/hossman/lucene/solr/solr/packaging/build/dev/server/solr
> > > : >      SOLR_HOST       =
> > > : >      SOLR_PORT       = 8983
> > > : >      STOP_PORT       = 7983
> > > : >      JAVA_MEM_OPTS   = -Xms512m -Xmx512m
> > > : >      GC_TUNE         = -XX:+UseG1GC -XX:+PerfDisableSharedMem
> > > : > -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250
> > -XX:+UseLargePages
> > > : > -XX:+AlwaysPreTouch -XX:+ExplicitGCInvokesConcurrent
> > > : >      GC_LOG_OPTS     =
> > > : >
> >
> -Xlog:gc*:file=/home/hossman/lucene/solr/solr/packaging/build/dev/server/logs/solr_gc.log:time,uptime:filecount=9,filesize=20M
> > > : >      SOLR_TIMEZONE   = UTC
> > > : >      SOLR_OPTS       = -XX:-UseLargePages -Dfoo=bar "-Dyak=white
> > space"
> > > : > -Xss256k
> > > : >
> > > : > Error: Could not find or load main class "-Dyak=white
> > > : > Caused by: java.lang.ClassNotFoundException: "-Dyak=white
> > > : > hossman@slate:~/lucene/solr [j11] [tags/releases/solr/9.3.0] $
> > > : > SOLR_OPTS='-XX:-UseLargePages -Dfoo=bar -Dyak=white\ space'
> > > : > ./solr/packaging/build/dev/bin/solr start -f
> > > : > Error: Could not find or load main class space
> > > : > Caused by: java.lang.ClassNotFoundException: space
> > > : > hossman@slate:~/lucene/solr [j11] [tags/releases/solr/9.3.0] $
> > > : > SOLR_OPTS="-XX:-UseLargePages -Dfoo=bar '-Dyak=white space'"
> > > : > ./solr/packaging/build/dev/bin/solr start -f
> > > : > Error: Could not find or load main class '-Dyak=white
> > > : > Caused by: java.lang.ClassNotFoundException: '-Dyak=white
> > > : > hossman@slate:~/lucene/solr [j11] [tags/releases/solr/9.3.0] $
> > > : > SOLR_OPTS="-XX:-UseLargePages -Dfoo=bar -Dyak='white space'"
> > > : > ./solr/packaging/build/dev/bin/solr start -f
> > > : > Error: Could not find or load main class space'
> > > : > Caused by: java.lang.ClassNotFoundException: space'
> > > : >
> > > : >
> > > : >
> > > : >
> > > :
> > >
> > > -Hoss
> > > http://www.lucidworks.com/
> >
> > _______________________
> > Eric Pugh | Founder & CEO | OpenSource Connections, LLC | 434.466.1467 |
> > http://www.opensourceconnections.com <
> > http://www.opensourceconnections.com/> | My Free/Busy <
> > http://tinyurl.com/eric-cal>
> > Co-Author: Apache Solr Enterprise Search Server, 3rd Ed <
> >
> https://www.packtpub.com/big-data-and-business-intelligence/apache-solr-enterprise-search-server-third-edition-raw
> >
> >
> > This e-mail and all contents, including attachments, is considered to be
> > Company Confidential unless explicitly stated otherwise, regardless of
> > whether attachments are marked as such.
> >
> >
>

Reply via email to