Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2001 12:19:47 -0800 (PST)
From:      Paul Herman <pherman@frenchfries.net>
To:        freebsd-gnats-submit@freebsd.org
Subject:   alpha/31859: jot(1) broken on alpha
Message-ID:  <200111082019.fA8KJlJ63001@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         31859
>Category:       alpha
>Synopsis:       jot(1) broken on alpha
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-alpha
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 08 12:20:03 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Paul Herman
>Release:        4.3-RELEASE
>Organization:
>Environment:
FreeBSD tick.sc.omation.com 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Thu Aug 23 09:00:51 PDT 2001     pherman@tick.sc.omation.com:/usr/src/sys/compile/tick  alpha    
>Description:
jot -r is broken on alpha, and most likely other 64-bit
platforms.  This is becuase jot assumes that arc4random()
outputs a long rather than int.
>How-To-Repeat:
 
  12:14:43{{ttyq6}pherman@tick}/usr/src/usr.bin/jot//> jot -r 5
  1
  1
  1
  1
  1
     
>Fix:
Manpage for arc4random() specifies a u_int32 as output, and NOT
a u_long.  Patch against 4.4-RELEASE:

Index: jot.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/jot/jot.c,v
retrieving revision 1.13.2.2
diff -u -r1.13.2.2 jot.c
--- jot.c       2001/07/19 07:57:42     1.13.2.2
+++ jot.c       2001/11/08 20:07:38
@@ -277,7 +277,7 @@
        if (randomize) {
                *x = (ender - begin) * (ender > begin ? 1 : -1);
                for (*i = 1; *i <= reps || infinity; (*i)++) {
-                       *y = arc4random() / (double)ULONG_MAX;
+                       *y = arc4random() / (double)UINT_MAX;
                        if (putdata(*y * *x + begin, reps - *i))
                                errx(1, "range error in conversion");
                }

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111082019.fA8KJlJ63001>