Apache Solr open-source search software
SOLR-17039: Entropy calculation fails in Docker due to missing 'bc' cmd (#2023)
Jan Høydahl5a9f914a6a6d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 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/solrindex 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-zeroif [[ $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 )); thenecho "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