From nobody@FreeBSD.org  Fri Oct 26 07:35:03 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 4765437B406
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Oct 2001 07:35:03 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f9QEZ3699367;
	Fri, 26 Oct 2001 07:35:03 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200110261435.f9QEZ3699367@freefall.freebsd.org>
Date: Fri, 26 Oct 2001 07:35:03 -0700 (PDT)
From: Alan Eldridge <alane@geeksrus.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
X-Send-Pr-Version: www-1.0

>Number:         31508
>Category:       ports
>Synopsis:       Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    wjv
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 26 07:40:01 PDT 2001
>Closed-Date:    Mon Jan 7 05:02:52 PST 2002
>Last-Modified:  Mon Jan 07 05:04:46 PST 2002
>Originator:     Alan Eldridge
>Release:        4.4-RELEASE
>Organization:
>Environment:
FreeBSD wwweasel.geeksrus.net 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Mon Oct 22 16:59:49 EDT 2001     root@wwweasel.geeksrus.net:/usr/src/sys/compile/WWWEASEL  i386
>Description:
There's a typo (?) in Ft.Lib.Uuid.UuidAsString(uuid), where a loop to convert an integer to a string of bytes is only picking up the lower 4 bits of each byte.

This results in half of the bits of the UUID being thrown away in the conversion to string.

I have not yet checked, but this is probably fixed in the newest version of the the 4suite code.
>How-To-Repeat:
[alane@wwweasel ~/sw/ftom/linkman]$ python
Python 2.1.1 (#1, Sep 13 2001, 18:12:15)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "copyright", "credits" or "license" for more information.
>Fix:
Make this fix (changing 0xF to 0xFF).

[alane@wwweasel ~/sw/ftom/linkman]$ diff -u Uuid.py.or Uuid.py
--- Uuid.py.or  Sun Dec  3 05:52:27 2000
+++ Uuid.py     Fri Oct 26 10:27:41 2001
@@ -64,7 +64,7 @@
     newUuid = ''
     curUuid = uuid
     for ctr in range(16):
-        num = int(curUuid & 0xF)
+        num = int(curUuid & 0xFF)
         newChar = chr(num)
         curUuid = curUuid >> 8
         newUuid = newChar + newUuid
[alane@wwweasel ~/sw/ftom/linkman]$

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->wjv 
Responsible-Changed-By: lioux 
Responsible-Changed-When: Thu Dec 20 10:26:21 PST 2001 
Responsible-Changed-Why:  
Over to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31508 

From: alane@geeksrus.net
To: freebsd-gnats-submit@FreeBSD.org, alane@geeksrus.net
Cc:  
Subject: Re: ports/31508: Coding error in py-4suite: Ft/Lib%2
Date: Thu, 20 Dec 2001 13:46:44 -0500 (EST)

 Just checked and problem exists in current version in ports.
 
 

From: Alan E <alane@geeksrus.net>
To: freebsd-gnats-submit@FreeBSD.org, alane@geeksrus.net
Cc: wjv@FreeBSD.org
Subject: Re: ports/31508: Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
Date: Sun, 6 Jan 2002 03:16:22 -0500

 --------------Boundary-00=_ABCID3VG62URRTQ5O7OV
 Content-Type: text/plain;
   charset="iso-8859-1"
 Content-Transfer-Encoding: 8bit
 
 Submitted on Oct 26. Over to maintainer on Dec 20. No response.
 
 Please commit this patch. Also, I will take maintainship if the current 
 maintainer doesn't want it anymore.
 
 -- 
 Alan Eldridge
 Pmmfmffmmfmp mmmpppppffmpmfpmpppff $PffMmmPppMpmPpfPpm mfpmmmmmfpmpmpppff.
 
 --------------Boundary-00=_ABCID3VG62URRTQ5O7OV
 Content-Type: text/x-diff;
   charset="iso-8859-1";
   name="py-4suite-Uuid.patch"
 Content-Transfer-Encoding: 8bit
 Content-Description: Fix error in code that's been there forever.
 Content-Disposition: attachment; filename="py-4suite-Uuid.patch"
 
 Index: textproc/py-4suite/files/patch-Lib-Uuid.py
 ===================================================================
 RCS file: textproc/py-4suite/files/patch-Lib-Uuid.py
 diff -N textproc/py-4suite/files/patch-Lib-Uuid.py
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ textproc/py-4suite/files/patch-Lib-Uuid.py	6 Jan 2002 06:57:17 -0000
 @@ -0,0 +1,11 @@
 +--- Lib/Uuid.py.or	Fri Aug 10 01:28:49 2001
 ++++ Lib/Uuid.py	Sun Jan  6 01:56:54 2002
 +@@ -64,7 +64,7 @@
 +     newUuid = ''
 +     curUuid = uuid
 +     for ctr in range(16):
 +-        num = int(curUuid & 0xF)
 ++        num = int(curUuid & 0xFF)
 +         newChar = chr(num)
 +         curUuid = curUuid >> 8
 +         newUuid = newChar + newUuid
 
 --------------Boundary-00=_ABCID3VG62URRTQ5O7OV--

From: Johann Visagie <johann@egenetics.com>
To: Alan E <alane@geeksrus.net>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/31508: Coding error in py-4suite: Ft/Lib/Uuid.py throws away half of generated UUID
Date: Mon, 7 Jan 2002 10:58:19 +0200

 Alan E on 2002-01-06 (Sun) at 03:16:22 -0500:
 > 
 > Submitted on Oct 26. Over to maintainer on Dec 20. No response.
 > 
 > Please commit this patch. Also, I will take maintainship if the current 
 > maintainer doesn't want it anymore.
 
 *ahem*  It's summer vacation here in the Southern Hemisphere, and (as
 I've notified the other committers) I have been out of touch for a
 while.  Back now;  I'll handle this PR soon.
 
 BTW, I admit that I sometimes miss things in the noise on -ports.  Since
 this isn't a perfect world, you may get a faster response if you Cc: the
 maintainer on ports PRs.  :-)
 
 -- V
State-Changed-From-To: open->closed 
State-Changed-By: wjv 
State-Changed-When: Mon Jan 7 05:02:52 PST 2002 
State-Changed-Why:  
Committed, thanks for your patience! 

BTW, 0.11.1 is still the current version of 4Suite;  I therefore 
recmmend that you liaise with the 4Suite authors about including 
your fix in subsequent versions. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31508 
>Unformatted:
 >>> import Uuid
 >>> u = Uuid.GenerateUuid()
 >>> u
 293274167793379733969387239632193121121L
 >>> hex(u)
 '0xDCA28CD7BC1B44DDB23830439C76EB61L'
 >>> Uuid.UuidAsString(u)
 'c020c07-c0b-40d-208-30c06b01'
 >>>
 
