File: Attempt-to-work-around-awk-returning-negative-number-from.patch

package info (click to toggle)
openscad 2021.01-9
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 36,096 kB
  • sloc: cpp: 53,199; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 118
file content (27 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From: Kristian Nielsen <knielsen@knielsen-hq.org>
Date: Thu, 27 Jun 2024 23:06:41 +0200
Subject: Attempt to work-around awk returning negative number from rand()

This was seen in the reproducible build CI, breaking the tests and
presumed to be the cause of extra test artifacts in the package.

Forwarded: not-needed
---
 tests/virtualfb.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/virtualfb.sh b/tests/virtualfb.sh
index f6e0fcd..76a5447 100755
--- a/tests/virtualfb.sh
+++ b/tests/virtualfb.sh
@@ -52,7 +52,9 @@ start()
     exit 1
   fi
 
-  VFB_DISPLAY=`echo | awk 'BEGIN{srand();} {printf ":%.0f", rand()*1000+100};'`
+  # Try to work-around wierd problem on Debian i368 reproducible CI. The rand()
+  # function seems to sometimes return negative numbers.
+  VFB_DISPLAY=`echo | awk 'BEGIN{srand();} {r=rand()*1000; printf ":%.0f", (r>=0 ? r : -r)+100};'`
   if [ $debug ]; then
     echo debug VFB_DISPLAY $VFB_DISPLAY
     echo debug VFB_BINARY $VFB_BINARY