Skip to content

Commit

Permalink
SOLR-17039: Entropy calculation fails in Docker due to missing 'bc' c…
Browse files Browse the repository at this point in the history
…md (#2023)

(cherry picked from commit 5a9f914)
  • Loading branch information
janhoy committed Oct 18, 2023
1 parent 3a05c38 commit 0095589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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)
Expand Down
4 changes: 2 additions & 2 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -2402,10 +2402,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
Expand Down

0 comments on commit 0095589

Please sign in to comment.