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 Dec 5, 2023
1 parent a1cadec commit 518caea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/upgrade-not
================== 9.4.1 ==================
Bug Fixes
---------------------
(No changes)
* SOLR-17039: Entropy calculation in bin/solr script fails in Docker due to missing 'bc' cmd (janhoy)

Dependency Upgrades
---------------------
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 518caea

Please sign in to comment.