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

janhoy 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 5a9f914a6a6 SOLR-17039: Entropy calculation fails in Docker due to 
missing 'bc' cmd (#2023)
5a9f914a6a6 is described below

commit 5a9f914a6a6dffd1bbceb8a5cd9a5cc8ad2bd60e
Author: Jan Høydahl <[email protected]>
AuthorDate: Wed Oct 18 22:06:46 2023 +0200

    SOLR-17039: Entropy calculation fails in Docker due to missing 'bc' cmd 
(#2023)
---
 solr/CHANGES.txt | 2 ++
 solr/bin/solr    | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5feaa5bf4e0..a10005c443c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -86,6 +86,8 @@ Bug Fixes
 ---------------------
 * SOLR-6853: Allow '/' characters in the text managed by Managed Resources 
API. (Nikita Rusetskii via Eric Pugh)
 
+* SOLR-17039: Entropy calculation in bin/solr script fails in Docker due to 
missing 'bc' cmd (janhoy)
+
 Dependency Upgrades
 ---------------------
 * SOLR-17012: Update Apache Hadoop to 3.3.6 and Apache Curator to 5.5.0 (Kevin 
Risden)
diff --git a/solr/bin/solr b/solr/bin/solr
index 30c3e3aa52b..3db7f1c7731 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1926,10 +1926,10 @@ function start_solr() {
       # Check if entropy is available and pool size is non-zero
       if [[ $entropy_avail -gt 0 && $pool_size -ne 0 ]]; then
         # Compute the ratio of entropy available to pool size
-        ratio=$(awk -v ea="$entropy_avail" -v ps="$pool_size" 'BEGIN {print 
(ea/ps)*100}')
+        ratio=$(awk -v ea="$entropy_avail" -v ps="$pool_size" 'BEGIN {print 
int((ea/ps)*100)}')
 
         # Check if the ratio is less than 25%
-        if (( $(echo "$ratio < 25" | bc -l) )); then
+        if (( ratio < 25 )); then
           echo "Warning: Available entropy is low. As a result, use of the 
UUIDField, SSL, or any other features that require"
           echo "RNG might not work properly. To check for the amount of 
available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'."
         fi

Reply via email to