From nobody@FreeBSD.org  Thu Nov  8 12:19:47 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 7A85E37B416
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  8 Nov 2001 12:19:47 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id fA8KJlJ63001;
	Thu, 8 Nov 2001 12:19:47 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200111082019.fA8KJlJ63001@freefall.freebsd.org>
Date: Thu, 8 Nov 2001 12:19:47 -0800 (PST)
From: Paul Herman <pherman@frenchfries.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: jot(1) broken on alpha
X-Send-Pr-Version: www-1.0

>Number:         31859
>Category:       alpha
>Synopsis:       jot(1) broken on alpha
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-alpha
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 08 12:20:03 PST 2001
>Closed-Date:    Thu Nov 8 12:50:08 PST 2001
>Last-Modified:  Thu Nov 08 12:50:55 PST 2001
>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:
State-Changed-From-To: open->closed 
State-Changed-By: gallatin 
State-Changed-When: Thu Nov 8 12:50:08 PST 2001 
State-Changed-Why:  
I just fixed this in current using the submitted patch. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31859 
>Unformatted:
